Revision 0f10a0b6
Added by Leszek Koltunski about 4 years ago
src/main/java/org/distorted/library/mesh/MeshBase.java | ||
---|---|---|
65 | 65 |
private int mNumVertices; |
66 | 66 |
private float[] mVertAttribs; // packed: PosX,PosY,PosZ, NorX,NorY,NorZ, InfX,InfY,InfZ, TexS,TexT |
67 | 67 |
private float mInflate; |
68 |
private float mBoundingX, mBoundingY, mBoundingZ; |
|
69 | 68 |
private float mStretchX, mStretchY, mStretchZ; |
70 | 69 |
|
71 | 70 |
private static class Component |
... | ... | |
99 | 98 |
|
100 | 99 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
101 | 100 |
|
102 |
MeshBase(float bx, float by, float bz)
|
|
101 |
MeshBase() |
|
103 | 102 |
{ |
104 |
mBoundingX = bx/2; |
|
105 |
mBoundingY = by/2; |
|
106 |
mBoundingZ = bz/2; |
|
107 |
|
|
108 | 103 |
mStretchX = 1.0f; |
109 | 104 |
mStretchY = 1.0f; |
110 | 105 |
mStretchZ = 1.0f; |
... | ... | |
122 | 117 |
|
123 | 118 |
MeshBase(MeshBase original) |
124 | 119 |
{ |
125 |
mBoundingX = original.mBoundingX; |
|
126 |
mBoundingY = original.mBoundingY; |
|
127 |
mBoundingZ = original.mBoundingZ; |
|
128 |
|
|
129 | 120 |
mStretchX = original.mStretchX; |
130 | 121 |
mStretchY = original.mStretchY; |
131 | 122 |
mStretchZ = original.mStretchZ; |
... | ... | |
155 | 146 |
return mComponent.size(); |
156 | 147 |
} |
157 | 148 |
|
158 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
159 |
|
|
160 |
void setBounding(float bx, float by, float bz) |
|
161 |
{ |
|
162 |
mBoundingX = bx/2; |
|
163 |
mBoundingY = by/2; |
|
164 |
mBoundingZ = bz/2; |
|
165 |
} |
|
166 |
|
|
167 | 149 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
168 | 150 |
// when a derived class is done computing its mesh, it has to call this method. |
169 | 151 |
|
... | ... | |
533 | 515 |
return (component>=0 && component<mComponent.size()) ? mComponent.get(component).mTextureMap : null; |
534 | 516 |
} |
535 | 517 |
|
536 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
537 |
/** |
|
538 |
* Each mesh has its 'bounding box' - return half of its X-length. |
|
539 |
* <p> |
|
540 |
* In case of all 'simple' Meshes, the bounding box is always 1x1x1 (Sphere, Cubes) or 1x1x0 |
|
541 |
* (Rectangles, Triangles, Quad - i.e. all 'flat' Meshes). But this can be something else in case of |
|
542 |
* MeshComponent. |
|
543 |
*/ |
|
544 |
public float getBoundingX() |
|
545 |
{ |
|
546 |
return mBoundingX*mStretchX; |
|
547 |
} |
|
548 |
|
|
549 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
550 |
/** |
|
551 |
* Each mesh has its 'bounding box' - return half of its Y-length. |
|
552 |
*/ |
|
553 |
public float getBoundingY() |
|
554 |
{ |
|
555 |
return mBoundingY*mStretchY; |
|
556 |
} |
|
557 |
|
|
558 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
559 |
/** |
|
560 |
* Each mesh has its 'bounding box' - return half of its Z-length. |
|
561 |
*/ |
|
562 |
public float getBoundingZ() |
|
563 |
{ |
|
564 |
return mBoundingZ*mStretchZ; |
|
565 |
} |
|
566 |
|
|
567 | 518 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
568 | 519 |
/** |
569 | 520 |
* Sometimes we want to display a Mesh on a rectangular screen. Then we need to stretch it by |
Also available in: Unified diff
A lot of changes.
1) main vertex shader: remove support for degree_object. This functionality will hopefully come back when we introduce other than circular regions.
2) MeshBase: remove the need to set a Bounding box (this is the point of the whole thing - we wanted to get rid of this so that the advances in MeshJoined will be easier)
3) Set ground for removing the MeshBase.setStretch / getStretch (another thing needed to advance MeshJoined )
4) since we removed the Bounding box, we need to change the DEFORN effect to have 1 additional parameter, the 'radius' which takes over the function of the bounding box in the vertex shader.
5) since the'res no bounding box, simplify the postprocessing Halo (remove EffectQueueMatrix.magnify() )
6) adjust applications.
After this we will hopefully be ready to introduce MeshBase.preApply(VertexEffect), i.e. bending several simple Meshes with any VertexEffect - including the freshly-introduced PseudoMatrix-Vertex effects like VertexEffectScale - and then combining them into one MeshJoined.