44 static constexpr int kMinDivisions = 2;
58 void setDivisions(
int divX,
int divY,
int divZ);
67 void setSize(
float sx,
float sy,
float sz);
76 void setOrigin(
float ox,
float oy,
float oz);
98 void setPointScale(
int ix,
int iy,
int iz,
float sx,
float sy,
float sz);
100 void setPointOffset(
int ix,
int iy,
int iz,
float dx,
float dy,
float dz);
103 void setScale(
float sx,
float sy,
float sz);
108 float getPointScaleX(
int ix,
int iy,
int iz)
const;
110 float getPointScaleY(
int ix,
int iy,
int iz)
const;
112 float getPointScaleZ(
int ix,
int iy,
int iz)
const;
114 float getPointOffsetX(
int ix,
int iy,
int iz)
const;
116 float getPointOffsetY(
int ix,
int iy,
int iz)
const;
118 float getPointOffsetZ(
int ix,
int iy,
int iz)
const;
133 void bindPositions(
const float* posXYZ,
int count);
141 float getBindPositionX(
int vertexIndex)
const;
143 float getBindPositionY(
int vertexIndex)
const;
145 float getBindPositionZ(
int vertexIndex)
const;
154 void deformPositions(
const float* inPosXYZ,
float* outPosXYZ,
int count)
const;
157 bool deformPositionsTo(
const std::vector<float>& inPosXYZ, std::vector<float>& outPosXYZ)
const;
164 bool deformNormals(
const float* posXYZ,
const float* inNrmXYZ,
float* outNrmXYZ,
int count)
const;
167 bool updateDeformedPositions(
const std::vector<float>& inPosXYZ);
170 bool updateDeformedPositions();
176 bool updateDeformedNormals(
const std::vector<float>& posXYZ,
const std::vector<float>& inNrmXYZ);
185 float getDeformedPositionX(
int vertexIndex)
const;
187 float getDeformedPositionY(
int vertexIndex)
const;
189 float getDeformedPositionZ(
int vertexIndex)
const;
192 std::vector<float> getDeformedPositions()
const;
194 std::vector<float> getDeformedNormals()
const;
197 struct ControlPoint {
198 float ox = 0.f,
oy = 0.f, oz = 0.f;
199 float sx = 1.f,
sy = 1.f,
sz = 1.f;
202 void requirePoint(
int ix,
int iy,
int iz)
const;
203 void requireVertex(
int vertexIndex)
const;
204 int pointIndex(
int ix,
int iy,
int iz)
const;
205 void computeCell(
float x,
float y,
float z,
int&
i0,
int& j0,
int& k0,
float& fu,
float& fv,
float& fw)
const;
207 int divX_ = kMinDivisions;
208 int divY_ = kMinDivisions;
209 int divZ_ = kMinDivisions;
213 float originX_ = 0.f;
214 float originY_ = 0.f;
215 float originZ_ = 0.f;
218 std::vector<ControlPoint> points_;
219 std::vector<float> bindPos_;
220 int vertexCount_ = 0;
222 std::vector<float> deformedPos_;
223 std::vector<float> deformedNrm_;
224 bool deformedValid_ =
false;
225 bool deformedNrmValid_ =
false;
#define EVENGINE_API_WORLD
CPU 3D lattice scale-deformer (晶格缩放变形).
float getSizeZ() const
Returns the size z.
AnimLattice(const AnimLattice &)=delete
bool getClamp() const
Returns the clamp.
float getOriginZ() const
Returns the origin z.
int getDivisionsY() const
Returns the divisions y.
float getOriginY() const
Returns the origin y.
void setClamp(bool clamp)
When true (default), vertices outside the box are clamped to the boundary cells; when false,...
AnimLattice & operator=(const AnimLattice &)=delete
int getDivisionsX() const
Returns the divisions x.
int getPointCount() const
Total control point count (divX * divY * divZ).
float getSizeY() const
Returns the size y.
float getOriginX() const
Returns the origin x.
bool hasDeformedPositions() const
True after a successful updateDeformedPositions().
int getDivisionsZ() const
Returns the divisions z.
int getVertexCount() const
Returns the vertex count.
float getSizeX() const
Returns the size x.
bool hasDeformedNormals() const
True after a successful updateDeformedNormals().
CPU-side decoded 3D model (Assimp scene owned via medialoader::ModelScene). Does not upload to GPU — ...