MCPcopy Create free account
hub / github.com/carbonengine/trinity / GenLineSets

Method GenLineSets

trinity/Tr2TranslationTool.cpp:139–300  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

137}
138
139void Tr2TranslationTool::GenLineSets()
140{
141 /*
142 TODO.
143 This creates the cones, lines and collision geometry.
144 There are some hard coded paths in this that we might want to replace.
145 Vector constants and magic numbers that would be nice to remove.
146 */
147 Matrix rotateMat, translation, transform;
148 rotateMat = RotationZMatrix( -XM_PI / 2.0f );
149 translation = TranslationMatrix( 0.0f, 1.0f, 0.0f );
150 transform = translation * rotateMat;
151 Vector3* c_tris = NULL;
152 int numVectors = 0;
153 int subDivisions = 20;
154
155 Tr2SolidSetPtr xCone;
156 Tr2SolidSetPtr yCone;
157 Tr2SolidSetPtr zCone;
158 Tr2LineSetPtr xLine;
159 Tr2LineSetPtr yLine;
160 Tr2LineSetPtr zLine;
161 Tr2LineSetPtr wLine;
162 Tr2EffectPtr mSolidEffect;
163 Tr2EffectPtr mLineEffect;
164 Tr2EffectPtr pEffect;
165
166 if( !xCone.CreateInstance() ||
167 !yCone.CreateInstance() ||
168 !zCone.CreateInstance() ||
169 !xLine.CreateInstance() ||
170 !yLine.CreateInstance() ||
171 !zLine.CreateInstance() ||
172 !wLine.CreateInstance() ||
173 !pEffect.CreateInstance() ||
174 !mLineEffect.CreateInstance() ||
175 !mSolidEffect.CreateInstance() )
176 {
177 return;
178 }
179
180 mSolidEffect->SetEffectPathName( "res:/Graphics/Effect/Managed/Utility/SolidsNoZ.fx" );
181 mLineEffect->SetEffectPathName( "res:/Graphics/Effect/Managed/Utility/LinesNoZ.fx" );
182 pEffect->SetEffectPathName( "res:/Graphics/Effect/Managed/Utility/PrimitivePicking.fx" );
183
184 xLine->AddLine( v3Zero, v4Red, v3X, v4Red );
185 c_tris = Tr2ManipulationTool::GetTrianglesAroundLine( Vector3( 0.3f, 0.0f, 0.0f ), (Vector3&)v3X, 0.08f, &numVectors );
186 for( int i = 0; i < numVectors / 3; i++ )
187 {
188 xLine->AddPickingTriangle( c_tris[i * 3], c_tris[i * 3 + 1], c_tris[i * 3 + 2] );
189 }
190 delete[] c_tris;
191
192 xLine->SubmitChanges();
193 xLine->m_name = "x";
194
195 yLine->AddLine( v3Zero, v4Green, v3Y, v4Green );
196 c_tris = Tr2ManipulationTool::GetTrianglesAroundLine( Vector3( 0.0f, 0.3f, 0.0f ), (Vector3&)v3Y, 0.08f, &numVectors );

Callers

nothing calls this directly

Calls 7

CreateInstanceMethod · 0.80
SetEffectPathNameMethod · 0.80
AddPickingTriangleMethod · 0.80
AddTriangleMethod · 0.80
Vector3Class · 0.70
AddLineMethod · 0.45
SubmitChangesMethod · 0.45

Tested by

no test coverage detected