Revision a20f274f
Added by Leszek Koltunski over 8 years ago
| src/main/java/org/distorted/library/effect/FragmentEffect.java | ||
|---|---|---|
| 21 | 21 |
|
| 22 | 22 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 23 | 23 |
/** |
| 24 |
* Fragment Effect - an Effect that works by injecting certain code into the main Fragment shader.
|
|
| 24 |
* Abstract class that represents an Effect that works by injecting certain code into the main Fragment shader.
|
|
| 25 | 25 |
*/ |
| 26 | 26 |
public abstract class FragmentEffect extends Effect |
| 27 | 27 |
{
|
| src/main/java/org/distorted/library/effect/MatrixEffect.java | ||
|---|---|---|
| 21 | 21 |
|
| 22 | 22 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 23 | 23 |
/** |
| 24 |
* Matrix Effect - an Effect that works by modifying the ModelView matrix.
|
|
| 24 |
* Abstract class that represents an Effect that works by modifying the ModelView matrix.
|
|
| 25 | 25 |
*/ |
| 26 | 26 |
public abstract class MatrixEffect extends Effect |
| 27 | 27 |
{
|
| src/main/java/org/distorted/library/effect/PostprocessEffect.java | ||
|---|---|---|
| 30 | 30 |
|
| 31 | 31 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 32 | 32 |
/** |
| 33 |
* Postprocessing Effect - an Effect that works by running a certain Shader Program(s) on a Framebuffer.
|
|
| 33 |
* Abstract class that represents an Effect that works by running a certain Shader Program(s) on a Framebuffer.
|
|
| 34 | 34 |
*/ |
| 35 | 35 |
public abstract class PostprocessEffect extends Effect implements DistortedMaster.Slave |
| 36 | 36 |
{
|
| src/main/java/org/distorted/library/effect/PostprocessEffectGlow.java | ||
|---|---|---|
| 249 | 249 |
" alpha += ( texture(u_ColorTexture,vec2(v_TexCoord.x+u_Offsets[i],v_TexCoord.y)).a + \n"+ |
| 250 | 250 |
" texture(u_ColorTexture,vec2(v_TexCoord.x-u_Offsets[i],v_TexCoord.y)).a ) * u_Weights[i]; \n"+ |
| 251 | 251 |
" } \n"+ |
| 252 |
" fragColor = vec4(u_Color.rgb,u_Color.a*alpha); \n"+
|
|
| 252 |
" fragColor = vec4(u_Color.rgb,alpha); \n"+
|
|
| 253 | 253 |
" }"; |
| 254 | 254 |
|
| 255 | 255 |
final String glowFragment2 = |
| ... | ... | |
| 273 | 273 |
" alpha += ( texture(u_ColorTexture,vec2(v_TexCoord.x,v_TexCoord.y+u_Offsets[i])).a + \n"+ |
| 274 | 274 |
" texture(u_ColorTexture,vec2(v_TexCoord.x,v_TexCoord.y-u_Offsets[i])).a ) * u_Weights[i]; \n"+ |
| 275 | 275 |
" } \n"+ |
| 276 |
" fragColor = vec4(u_Color.rgb,u_Color.a*alpha); \n"+
|
|
| 276 |
" fragColor = vec4(u_Color.rgb,alpha); \n"+
|
|
| 277 | 277 |
" }"; |
| 278 | 278 |
|
| 279 | 279 |
mIndex1 = PostprocessEffect.register("BLUR1", glowVertex,glowFragment1);
|
| src/main/java/org/distorted/library/effect/VertexEffect.java | ||
|---|---|---|
| 21 | 21 |
|
| 22 | 22 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 23 | 23 |
/** |
| 24 |
* Vertex Effect - an Effect that works by injecting certain code into the main Vertex shader.
|
|
| 24 |
* Abstract class that represents an Effect that works by injecting certain code into the main Vertex shader.
|
|
| 25 | 25 |
*/ |
| 26 | 26 |
public abstract class VertexEffect extends Effect |
| 27 | 27 |
{
|
| src/main/java/org/distorted/library/type/Dynamic.java | ||
|---|---|---|
| 333 | 333 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 334 | 334 |
// helper function in case we are interpolating through exactly 2 points |
| 335 | 335 |
|
| 336 |
protected void computeOrthonormalBase2(Static1D curr, Static1D next)
|
|
| 336 |
protected void computeOrthonormalBase2(Static curr, Static next)
|
|
| 337 | 337 |
{
|
| 338 | 338 |
switch(mDimension) |
| 339 | 339 |
{
|
| 340 |
case 1: baseV[0][0] = (next.x-curr.x); |
|
| 340 |
case 1: Static1D curr1 = (Static1D)curr; |
|
| 341 |
Static1D next1 = (Static1D)next; |
|
| 342 |
baseV[0][0] = (next1.x-curr1.x); |
|
| 341 | 343 |
break; |
| 342 | 344 |
case 2: Static2D curr2 = (Static2D)curr; |
| 343 | 345 |
Static2D next2 = (Static2D)next; |
| src/main/java/org/distorted/library/type/Static1D.java | ||
|---|---|---|
| 30 | 30 |
{
|
| 31 | 31 |
float x; |
| 32 | 32 |
|
| 33 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 34 |
|
|
| 35 |
Static1D(int dim, float ox) |
|
| 36 |
{
|
|
| 37 |
super(dim); |
|
| 38 |
x = ox; |
|
| 39 |
} |
|
| 40 |
|
|
| 41 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 42 |
/** |
|
| 43 |
* Constructor that initialises the value of the single float to ox. |
|
| 44 |
* |
|
| 45 |
* @param ox value of the single float. |
|
| 46 |
*/ |
|
| 47 |
public Static1D(int ox) |
|
| 48 |
{
|
|
| 49 |
super(1); |
|
| 50 |
x = ox; |
|
| 51 |
} |
|
| 52 |
|
|
| 53 | 33 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 54 | 34 |
/** |
| 55 | 35 |
* Constructor that initialises the value of the single float to ox. |
| ... | ... | |
| 61 | 41 |
super(1); |
| 62 | 42 |
x = ox; |
| 63 | 43 |
} |
| 64 |
|
|
| 65 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 66 |
/** |
|
| 67 |
* Resets the value of the single float. |
|
| 68 |
* |
|
| 69 |
* @param ox new value of the single float. |
|
| 70 |
*/ |
|
| 71 |
public void set(int ox) |
|
| 72 |
{
|
|
| 73 |
x = ox; |
|
| 74 |
} |
|
| 75 | 44 |
|
| 76 | 45 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 77 | 46 |
/** |
| ... | ... | |
| 84 | 53 |
x = ox; |
| 85 | 54 |
} |
| 86 | 55 |
|
| 87 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 88 |
/** |
|
| 89 |
* Resets the value of the first float. |
|
| 90 |
* |
|
| 91 |
* @param ox new value of the first float. |
|
| 92 |
*/ |
|
| 93 |
public void set1(int ox) |
|
| 94 |
{
|
|
| 95 |
x = ox; |
|
| 96 |
} |
|
| 97 |
|
|
| 98 | 56 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 99 | 57 |
/** |
| 100 | 58 |
* Resets the value of the first float. |
| ... | ... | |
| 112 | 70 |
* |
| 113 | 71 |
* @return The single float. |
| 114 | 72 |
*/ |
| 115 |
public float getX()
|
|
| 73 |
public float get1()
|
|
| 116 | 74 |
{
|
| 117 | 75 |
return x; |
| 118 | 76 |
} |
| ... | ... | |
| 120 | 78 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 121 | 79 |
/** |
| 122 | 80 |
* 'Interpolation' between the single Point (i.e. always this very value) returned to the buffer. |
| 123 |
* <p> |
|
| 124 | 81 |
* |
| 125 | 82 |
* @param buffer Float buffer we will write the results to. |
| 126 | 83 |
* @param offset Offset in the buffer where to write the result. |
| src/main/java/org/distorted/library/type/Static2D.java | ||
|---|---|---|
| 26 | 26 |
* a few of which the Dynamic interpolates between. |
| 27 | 27 |
*/ |
| 28 | 28 |
|
| 29 |
public class Static2D extends Static1D implements Data2D
|
|
| 29 |
public class Static2D extends Static implements Data2D |
|
| 30 | 30 |
{
|
| 31 |
float y; |
|
| 32 |
|
|
| 33 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 34 |
|
|
| 35 |
Static2D(int dim, float ox, float oy) |
|
| 36 |
{
|
|
| 37 |
super(dim,ox); |
|
| 38 |
y = oy; |
|
| 39 |
} |
|
| 40 |
|
|
| 41 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 42 |
/** |
|
| 43 |
* Constructor that initialises the value of the two floats to (ox,oy). |
|
| 44 |
* |
|
| 45 |
* @param ox value of the first float. |
|
| 46 |
* @param oy value of the second float. |
|
| 47 |
*/ |
|
| 48 |
public Static2D(int ox, int oy) |
|
| 49 |
{
|
|
| 50 |
super(2,ox); |
|
| 51 |
y = oy; |
|
| 52 |
} |
|
| 31 |
float x,y; |
|
| 53 | 32 |
|
| 54 | 33 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 55 | 34 |
/** |
| ... | ... | |
| 60 | 39 |
*/ |
| 61 | 40 |
public Static2D(float ox, float oy) |
| 62 | 41 |
{
|
| 63 |
super(2,ox); |
|
| 42 |
super(2); |
|
| 43 |
x = ox; |
|
| 64 | 44 |
y = oy; |
| 65 | 45 |
} |
| 66 |
|
|
| 46 |
|
|
| 67 | 47 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 68 | 48 |
/** |
| 69 | 49 |
* Reset the value of the floats to (ox,oy). |
| 70 | 50 |
* |
| 71 | 51 |
* @param ox new value of the first float |
| 72 |
* @param oy new value of the second float
|
|
| 52 |
* @param oy new value of the seond float |
|
| 73 | 53 |
*/ |
| 74 |
public void set(int ox, int oy)
|
|
| 54 |
public void set(float ox, float oy)
|
|
| 75 | 55 |
{
|
| 76 | 56 |
x = ox; |
| 77 | 57 |
y = oy; |
| ... | ... | |
| 79 | 59 |
|
| 80 | 60 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 81 | 61 |
/** |
| 82 |
* Reset the value of the floats to (ox,oy). |
|
| 83 |
* |
|
| 84 |
* @param ox new value of the first float |
|
| 85 |
* @param oy new value of the seond float |
|
| 62 |
* Resets the value of the first float. |
|
| 63 |
* |
|
| 64 |
* @param ox new value of the first float. |
|
| 86 | 65 |
*/ |
| 87 |
public void set(float ox, float oy)
|
|
| 66 |
public void set1(float ox)
|
|
| 88 | 67 |
{
|
| 89 | 68 |
x = ox; |
| 90 |
y = oy; |
|
| 91 | 69 |
} |
| 92 | 70 |
|
| 93 | 71 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| ... | ... | |
| 96 | 74 |
* |
| 97 | 75 |
* @param oy new value of the second float. |
| 98 | 76 |
*/ |
| 99 |
public void set2(int oy)
|
|
| 77 |
public void set2(float oy)
|
|
| 100 | 78 |
{
|
| 101 | 79 |
y = oy; |
| 102 | 80 |
} |
| 103 | 81 |
|
| 104 | 82 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 105 | 83 |
/** |
| 106 |
* Resets the value of the second float.
|
|
| 84 |
* Return the value of the first float contained.
|
|
| 107 | 85 |
* |
| 108 |
* @param oy new value of the second float.
|
|
| 86 |
* @return The first float.
|
|
| 109 | 87 |
*/ |
| 110 |
public void set2(float oy)
|
|
| 88 |
public float get1()
|
|
| 111 | 89 |
{
|
| 112 |
y = oy;
|
|
| 90 |
return x;
|
|
| 113 | 91 |
} |
| 114 | 92 |
|
| 115 | 93 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| ... | ... | |
| 118 | 96 |
* |
| 119 | 97 |
* @return The second float. |
| 120 | 98 |
*/ |
| 121 |
public float getY()
|
|
| 99 |
public float get2()
|
|
| 122 | 100 |
{
|
| 123 | 101 |
return y; |
| 124 | 102 |
} |
| ... | ... | |
| 126 | 104 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 127 | 105 |
/** |
| 128 | 106 |
* 'Interpolation' between the single Point (i.e. always this very value) returned to the buffer. |
| 129 |
* <p> |
|
| 130 | 107 |
* |
| 131 | 108 |
* @param buffer Float buffer we will write the results to. |
| 132 | 109 |
* @param offset Offset in the buffer where to write the result. |
| src/main/java/org/distorted/library/type/Static3D.java | ||
|---|---|---|
| 26 | 26 |
* a few of which the Dynamic interpolates between. |
| 27 | 27 |
*/ |
| 28 | 28 |
|
| 29 |
public class Static3D extends Static2D implements Data3D
|
|
| 29 |
public class Static3D extends Static implements Data3D |
|
| 30 | 30 |
{
|
| 31 |
float z; |
|
| 32 |
|
|
| 33 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 34 |
|
|
| 35 |
Static3D(int dim, float vx, float vy, float vz) |
|
| 36 |
{
|
|
| 37 |
super(dim,vx,vy); |
|
| 38 |
z = vz; |
|
| 39 |
} |
|
| 40 |
|
|
| 41 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 42 |
/** |
|
| 43 |
* Constructor that initialises the value of the three floats to (vx,vy,vz). |
|
| 44 |
* |
|
| 45 |
* @param vx value of the first float. |
|
| 46 |
* @param vy value of the second float. |
|
| 47 |
* @param vz value of the third float. |
|
| 48 |
*/ |
|
| 49 |
public Static3D(int vx, int vy, int vz) |
|
| 50 |
{
|
|
| 51 |
super(3,vx,vy); |
|
| 52 |
z = vz; |
|
| 53 |
} |
|
| 31 |
float x,y,z; |
|
| 54 | 32 |
|
| 55 | 33 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 56 | 34 |
/** |
| ... | ... | |
| 62 | 40 |
*/ |
| 63 | 41 |
public Static3D(float vx, float vy, float vz) |
| 64 | 42 |
{
|
| 65 |
super(3,vx,vy); |
|
| 43 |
super(3); |
|
| 44 |
x = vx; |
|
| 45 |
y = vy; |
|
| 66 | 46 |
z = vz; |
| 67 | 47 |
} |
| 68 | 48 |
|
| ... | ... | |
| 74 | 54 |
* @param vy new value of the second float |
| 75 | 55 |
* @param vz new value of the third float |
| 76 | 56 |
*/ |
| 77 |
public void set(int vx, int vy, int vz)
|
|
| 57 |
public void set(float vx, float vy, float vz)
|
|
| 78 | 58 |
{
|
| 79 | 59 |
x = vx; |
| 80 | 60 |
y = vy; |
| ... | ... | |
| 83 | 63 |
|
| 84 | 64 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 85 | 65 |
/** |
| 86 |
* Reset the value of the floats to (vx,vy,vz). |
|
| 87 |
* |
|
| 88 |
* @param vx new value of the first float |
|
| 89 |
* @param vy new value of the second float |
|
| 90 |
* @param vz new value of the third float |
|
| 66 |
* Resets the value of the first float. |
|
| 67 |
* |
|
| 68 |
* @param ox new value of the first float. |
|
| 91 | 69 |
*/ |
| 92 |
public void set(float vx, float vy, float vz)
|
|
| 70 |
public void set1(float ox)
|
|
| 93 | 71 |
{
|
| 94 |
x = vx; |
|
| 95 |
y = vy; |
|
| 96 |
z = vz; |
|
| 72 |
x = ox; |
|
| 97 | 73 |
} |
| 98 | 74 |
|
| 99 | 75 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 100 | 76 |
/** |
| 101 |
* Resets the value of the third float.
|
|
| 77 |
* Resets the value of the second float.
|
|
| 102 | 78 |
* |
| 103 |
* @param oz new value of the third float.
|
|
| 79 |
* @param oy new value of the second float.
|
|
| 104 | 80 |
*/ |
| 105 |
public void set3(int oz)
|
|
| 81 |
public void set2(float oy)
|
|
| 106 | 82 |
{
|
| 107 |
z = oz;
|
|
| 83 |
y = oy;
|
|
| 108 | 84 |
} |
| 109 | 85 |
|
| 110 | 86 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| ... | ... | |
| 118 | 94 |
z = oz; |
| 119 | 95 |
} |
| 120 | 96 |
|
| 97 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 98 |
/** |
|
| 99 |
* Return the value of the first float contained. |
|
| 100 |
* |
|
| 101 |
* @return The first float. |
|
| 102 |
*/ |
|
| 103 |
public float get1() |
|
| 104 |
{
|
|
| 105 |
return x; |
|
| 106 |
} |
|
| 107 |
|
|
| 108 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 109 |
/** |
|
| 110 |
* Return the value of the second float contained. |
|
| 111 |
* |
|
| 112 |
* @return The second float. |
|
| 113 |
*/ |
|
| 114 |
public float get2() |
|
| 115 |
{
|
|
| 116 |
return y; |
|
| 117 |
} |
|
| 118 |
|
|
| 121 | 119 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 122 | 120 |
/** |
| 123 | 121 |
* Return the value of the third float contained. |
| 124 | 122 |
* |
| 125 | 123 |
* @return The third float. |
| 126 | 124 |
*/ |
| 127 |
public float getZ()
|
|
| 125 |
public float get3()
|
|
| 128 | 126 |
{
|
| 129 | 127 |
return z; |
| 130 | 128 |
} |
| ... | ... | |
| 132 | 130 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 133 | 131 |
/** |
| 134 | 132 |
* 'Interpolation' between the single Point (i.e. always this very value) returned to the buffer. |
| 135 |
* <p> |
|
| 136 | 133 |
* |
| 137 | 134 |
* @param buffer Float buffer we will write the results to. |
| 138 | 135 |
* @param offset Offset in the buffer where to write the result. |
| src/main/java/org/distorted/library/type/Static4D.java | ||
|---|---|---|
| 26 | 26 |
* a few of which the Dynamic interpolates between. |
| 27 | 27 |
*/ |
| 28 | 28 |
|
| 29 |
public class Static4D extends Static3D implements Data4D
|
|
| 29 |
public class Static4D extends Static implements Data4D |
|
| 30 | 30 |
{
|
| 31 |
float w; |
|
| 32 |
|
|
| 33 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 34 |
|
|
| 35 |
Static4D(int dim, float vx, float vy, float vz, float vw) |
|
| 36 |
{
|
|
| 37 |
super(dim,vx,vy,vz); |
|
| 38 |
w = vw; |
|
| 39 |
} |
|
| 40 |
|
|
| 41 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 42 |
/** |
|
| 43 |
* Constructor that initialises the value of the four floats to (vx,vy,vz,vw). |
|
| 44 |
* |
|
| 45 |
* @param vx value of the first float. |
|
| 46 |
* @param vy value of the second float. |
|
| 47 |
* @param vz value of the third float. |
|
| 48 |
* @param vw value of the fourth float. |
|
| 49 |
*/ |
|
| 50 |
public Static4D(int vx, int vy, int vz, int vw) |
|
| 51 |
{
|
|
| 52 |
super(4,vx,vy,vz); |
|
| 53 |
w = vw; |
|
| 54 |
} |
|
| 31 |
float x,y,z,w; |
|
| 55 | 32 |
|
| 56 | 33 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 57 | 34 |
/** |
| ... | ... | |
| 64 | 41 |
*/ |
| 65 | 42 |
public Static4D(float vx, float vy, float vz, float vw) |
| 66 | 43 |
{
|
| 67 |
super(4,vx,vy,vz); |
|
| 44 |
super(4); |
|
| 45 |
x = vx; |
|
| 46 |
y = vy; |
|
| 47 |
z = vz; |
|
| 68 | 48 |
w = vw; |
| 69 | 49 |
} |
| 70 | 50 |
|
| ... | ... | |
| 77 | 57 |
* @param vz new value of the third float |
| 78 | 58 |
* @param vw new value of the fourth float |
| 79 | 59 |
*/ |
| 80 |
public void set(int vx, int vy, int vz, int vw)
|
|
| 60 |
public void set(float vx, float vy, float vz, float vw)
|
|
| 81 | 61 |
{
|
| 82 | 62 |
x = vx; |
| 83 | 63 |
y = vy; |
| ... | ... | |
| 87 | 67 |
|
| 88 | 68 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 89 | 69 |
/** |
| 90 |
* Reset the value of the floats to (vx,vy,vz,vw). |
|
| 91 |
* |
|
| 92 |
* @param vx new value of the first float |
|
| 93 |
* @param vy new value of the second float |
|
| 94 |
* @param vz new value of the third float |
|
| 95 |
* @param vw new value of the fourth float |
|
| 70 |
* Resets the value of the first float. |
|
| 71 |
* |
|
| 72 |
* @param ox new value of the first float. |
|
| 96 | 73 |
*/ |
| 97 |
public void set(float vx, float vy, float vz, float vw)
|
|
| 74 |
public void set1(float ox)
|
|
| 98 | 75 |
{
|
| 99 |
x = vx; |
|
| 100 |
y = vy; |
|
| 101 |
z = vz; |
|
| 102 |
w = vw; |
|
| 76 |
x = ox; |
|
| 103 | 77 |
} |
| 104 | 78 |
|
| 105 | 79 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 106 | 80 |
/** |
| 107 |
* Resets the value of the fourth float.
|
|
| 81 |
* Resets the value of the second float.
|
|
| 108 | 82 |
* |
| 109 |
* @param ow new value of the fourth float.
|
|
| 83 |
* @param oy new value of the second float.
|
|
| 110 | 84 |
*/ |
| 111 |
public void set4(int ow)
|
|
| 85 |
public void set2(float oy)
|
|
| 112 | 86 |
{
|
| 113 |
w = ow; |
|
| 87 |
y = oy; |
|
| 88 |
} |
|
| 89 |
|
|
| 90 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 91 |
/** |
|
| 92 |
* Resets the value of the third float. |
|
| 93 |
* |
|
| 94 |
* @param oz new value of the third float. |
|
| 95 |
*/ |
|
| 96 |
public void set3(float oz) |
|
| 97 |
{
|
|
| 98 |
z = oz; |
|
| 114 | 99 |
} |
| 115 | 100 |
|
| 116 | 101 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| ... | ... | |
| 124 | 109 |
w = ow; |
| 125 | 110 |
} |
| 126 | 111 |
|
| 112 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 113 |
/** |
|
| 114 |
* Return the value of the first float contained. |
|
| 115 |
* |
|
| 116 |
* @return The first float. |
|
| 117 |
*/ |
|
| 118 |
public float get1() |
|
| 119 |
{
|
|
| 120 |
return x; |
|
| 121 |
} |
|
| 122 |
|
|
| 123 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 124 |
/** |
|
| 125 |
* Return the value of the second float contained. |
|
| 126 |
* |
|
| 127 |
* @return The second float. |
|
| 128 |
*/ |
|
| 129 |
public float get2() |
|
| 130 |
{
|
|
| 131 |
return y; |
|
| 132 |
} |
|
| 133 |
|
|
| 134 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 135 |
/** |
|
| 136 |
* Return the value of the third float contained. |
|
| 137 |
* |
|
| 138 |
* @return The third float. |
|
| 139 |
*/ |
|
| 140 |
public float get3() |
|
| 141 |
{
|
|
| 142 |
return z; |
|
| 143 |
} |
|
| 144 |
|
|
| 127 | 145 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 128 | 146 |
/** |
| 129 | 147 |
* Return the value of the fourth float contained. |
| 130 |
*
|
|
| 148 |
* |
|
| 131 | 149 |
* @return The fourth float. |
| 132 | 150 |
*/ |
| 133 |
public float getW()
|
|
| 151 |
public float get4()
|
|
| 134 | 152 |
{
|
| 135 |
return w;
|
|
| 153 |
return w; |
|
| 136 | 154 |
} |
| 137 | 155 |
|
| 138 | 156 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 139 | 157 |
/** |
| 140 | 158 |
* 'Interpolation' between the single Point (i.e. always this very value) returned to the buffer. |
| 141 |
* <p> |
|
| 142 | 159 |
* |
| 143 | 160 |
* @param buffer Float buffer we will write the results to. |
| 144 | 161 |
* @param offset Offset in the buffer where to write the result. |
| src/main/java/org/distorted/library/type/Static5D.java | ||
|---|---|---|
| 26 | 26 |
* a few of which the Dynamic interpolates between. |
| 27 | 27 |
*/ |
| 28 | 28 |
|
| 29 |
public class Static5D extends Static4D implements Data5D
|
|
| 29 |
public class Static5D extends Static implements Data5D |
|
| 30 | 30 |
{
|
| 31 |
float v; |
|
| 32 |
|
|
| 33 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 34 |
/** |
|
| 35 |
* Constructor that initialises the value of the five floats to (vx,vy,vz,vw,vv). |
|
| 36 |
* |
|
| 37 |
* @param vx value of the first float. |
|
| 38 |
* @param vy value of the second float. |
|
| 39 |
* @param vz value of the third float. |
|
| 40 |
* @param vw value of the fourth float. |
|
| 41 |
* @param vv value of the fifth float. |
|
| 42 |
*/ |
|
| 43 |
public Static5D(int vx, int vy, int vz, int vw, int vv) |
|
| 44 |
{
|
|
| 45 |
super(5,vx,vy,vz,vw); |
|
| 46 |
v = vv; |
|
| 47 |
} |
|
| 31 |
float x,y,z,w,v; |
|
| 48 | 32 |
|
| 49 | 33 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 50 | 34 |
/** |
| ... | ... | |
| 58 | 42 |
*/ |
| 59 | 43 |
public Static5D(float vx, float vy, float vz, float vw, float vv) |
| 60 | 44 |
{
|
| 61 |
super(5,vx,vy,vz,vw); |
|
| 45 |
super(5); |
|
| 46 |
x = vx; |
|
| 47 |
y = vy; |
|
| 48 |
z = vz; |
|
| 49 |
w = vw; |
|
| 62 | 50 |
v = vv; |
| 63 | 51 |
} |
| 64 | 52 |
|
| ... | ... | |
| 72 | 60 |
* @param vw new value of the fourth float |
| 73 | 61 |
* @param vv new value of the fifth float |
| 74 | 62 |
*/ |
| 75 |
public void set(int vx, int vy, int vz, int vw, int vv)
|
|
| 63 |
public void set(float vx, float vy, float vz, float vw, float vv)
|
|
| 76 | 64 |
{
|
| 77 | 65 |
x = vx; |
| 78 | 66 |
y = vy; |
| ... | ... | |
| 83 | 71 |
|
| 84 | 72 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 85 | 73 |
/** |
| 86 |
* Reset the value of the floats to (vx,vy,vz,vw,vv). |
|
| 87 |
* |
|
| 88 |
* @param vx new value of the first float |
|
| 89 |
* @param vy new value of the second float |
|
| 90 |
* @param vz new value of the third float |
|
| 91 |
* @param vw new value of the fourth float |
|
| 92 |
* @param vv new value of the fifth float |
|
| 74 |
* Resets the value of the first float. |
|
| 75 |
* |
|
| 76 |
* @param ox new value of the first float. |
|
| 93 | 77 |
*/ |
| 94 |
public void set(float vx, float vy, float vz, float vw, float vv)
|
|
| 78 |
public void set1(float ox)
|
|
| 95 | 79 |
{
|
| 96 |
x = vx; |
|
| 97 |
y = vy; |
|
| 98 |
z = vz; |
|
| 99 |
w = vw; |
|
| 100 |
v = vv; |
|
| 80 |
x = ox; |
|
| 101 | 81 |
} |
| 102 | 82 |
|
| 103 | 83 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 104 | 84 |
/** |
| 105 |
* Resets the value of the fifth float.
|
|
| 85 |
* Resets the value of the second float.
|
|
| 106 | 86 |
* |
| 107 |
* @param ov new value of the fifth float.
|
|
| 87 |
* @param oy new value of the second float.
|
|
| 108 | 88 |
*/ |
| 109 |
public void set5(int ov)
|
|
| 89 |
public void set2(float oy)
|
|
| 110 | 90 |
{
|
| 111 |
v = ov; |
|
| 91 |
y = oy; |
|
| 92 |
} |
|
| 93 |
|
|
| 94 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 95 |
/** |
|
| 96 |
* Resets the value of the third float. |
|
| 97 |
* |
|
| 98 |
* @param oz new value of the third float. |
|
| 99 |
*/ |
|
| 100 |
public void set3(float oz) |
|
| 101 |
{
|
|
| 102 |
z = oz; |
|
| 103 |
} |
|
| 104 |
|
|
| 105 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 106 |
/** |
|
| 107 |
* Resets the value of the fourth float. |
|
| 108 |
* |
|
| 109 |
* @param ow new value of the fourth float. |
|
| 110 |
*/ |
|
| 111 |
public void set4(float ow) |
|
| 112 |
{
|
|
| 113 |
w = ow; |
|
| 112 | 114 |
} |
| 113 | 115 |
|
| 114 | 116 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| ... | ... | |
| 122 | 124 |
v = ov; |
| 123 | 125 |
} |
| 124 | 126 |
|
| 127 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 128 |
/** |
|
| 129 |
* Return the value of the first float contained. |
|
| 130 |
* |
|
| 131 |
* @return The first float. |
|
| 132 |
*/ |
|
| 133 |
public float get1() |
|
| 134 |
{
|
|
| 135 |
return x; |
|
| 136 |
} |
|
| 137 |
|
|
| 138 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 139 |
/** |
|
| 140 |
* Return the value of the second float contained. |
|
| 141 |
* |
|
| 142 |
* @return The second float. |
|
| 143 |
*/ |
|
| 144 |
public float get2() |
|
| 145 |
{
|
|
| 146 |
return y; |
|
| 147 |
} |
|
| 148 |
|
|
| 149 |
|
|
| 150 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 151 |
/** |
|
| 152 |
* Return the value of the third float contained. |
|
| 153 |
* |
|
| 154 |
* @return The third float. |
|
| 155 |
*/ |
|
| 156 |
public float get3() |
|
| 157 |
{
|
|
| 158 |
return z; |
|
| 159 |
} |
|
| 160 |
|
|
| 161 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 162 |
/** |
|
| 163 |
* Return the value of the fourth float contained. |
|
| 164 |
* |
|
| 165 |
* @return The fourth float. |
|
| 166 |
*/ |
|
| 167 |
public float get4() |
|
| 168 |
{
|
|
| 169 |
return w; |
|
| 170 |
} |
|
| 171 |
|
|
| 125 | 172 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 126 | 173 |
/** |
| 127 | 174 |
* Return the value of the fifth float contained. |
| 128 | 175 |
* |
| 129 | 176 |
* @return The fifth float. |
| 130 | 177 |
*/ |
| 131 |
public float getV()
|
|
| 178 |
public float get5()
|
|
| 132 | 179 |
{
|
| 133 | 180 |
return v; |
| 134 | 181 |
} |
| ... | ... | |
| 136 | 183 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 137 | 184 |
/** |
| 138 | 185 |
* 'Interpolation' between the single Point (i.e. always this very value) returned to the buffer. |
| 139 |
* <p> |
|
| 140 | 186 |
* |
| 141 | 187 |
* @param buffer Float buffer we will write the results to. |
| 142 | 188 |
* @param offset Offset in the buffer where to write the result. |
Also available in: Unified diff
Simplify Statics.