MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / lockMesh

Method lockMesh

Engine/source/ts/assimp/assimpAppMesh.cpp:73–270  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

71}
72
73void AssimpAppMesh::lockMesh(F32 t, const MatrixF& objOffset)
74{
75 // After this function, the following are expected to be populated:
76 // points, normals, uvs, primitives, indices
77 // There is also colors and uv2s but those don't seem to be required.
78 points.reserve(mMeshData->mNumVertices);
79 uvs.reserve(mMeshData->mNumVertices);
80 normals.reserve(mMeshData->mNumVertices);
81
82 bool flipNormals = ColladaUtils::getOptions().invertNormals;
83
84 bool noUVFound = false;
85 for (U32 i = 0; i<mMeshData->mNumVertices; i++)
86 {
87 // Points and Normals
88 aiVector3D pt = mMeshData->mVertices[i];
89 aiVector3D nrm;
90 if (mMeshData->HasNormals())
91 nrm = mMeshData->mNormals[i];
92 else
93 nrm.Set(0, 0, 0);
94
95 Point3F tmpVert;
96 Point3F tmpNormal;
97
98 tmpVert = Point3F(pt.x, pt.y, pt.z);
99 tmpNormal = Point3F(nrm.x, nrm.y, nrm.z);
100 if (flipNormals)
101 tmpNormal *= -1.0f;
102
103 objOffset.mulP(tmpVert);
104
105 points.push_back(tmpVert);
106
107 if (mMeshData->HasTextureCoords(0))
108 {
109 uvs.push_back(Point2F(mMeshData->mTextureCoords[0][i].x, mMeshData->mTextureCoords[0][i].y));
110 }
111 else
112 {
113 // I don't know if there's any solution to this issue.
114 // If it's not mapped, it's not mapped.
115 noUVFound = true;
116 uvs.push_back(Point2F(1, 1));
117 }
118
119 // UV2s
120 if (mMeshData->HasTextureCoords(1))
121 {
122 uv2s.push_back(Point2F(mMeshData->mTextureCoords[1][i].x, mMeshData->mTextureCoords[1][i].y));
123 }
124
125 // Vertex Colors
126 if (mMeshData->HasVertexColors(0))
127 {
128 LinearColorF vColor(mMeshData->mColors[0][i].r,
129 mMeshData->mColors[0][i].g,
130 mMeshData->mColors[0][i].b,

Callers

nothing calls this directly

Calls 15

printfFunction · 0.85
mulPMethod · 0.80
toColorIMethod · 0.80
incrementMethod · 0.80
C_StrMethod · 0.80
Point3FClass · 0.50
Point2FClass · 0.50
warnfFunction · 0.50
reserveMethod · 0.45
HasNormalsMethod · 0.45
SetMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected