MCPcopy Create free account
hub / github.com/GarageGames/Torque3D / createShape

Method createShape

Engine/source/T3D/examples/renderShapeExample.cpp:183–222  ·  view source on GitHub ↗

----------------------------------------------------------------------------- Object Rendering -----------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

181// Object Rendering
182//-----------------------------------------------------------------------------
183void RenderShapeExample::createShape()
184{
185 if ( mShapeFile.isEmpty() )
186 return;
187
188 // If this is the same shape then no reason to update it
189 if ( mShapeInstance && mShapeFile.equal( mShape.getPath().getFullPath(), String::NoCase ) )
190 return;
191
192 // Clean up our previous shape
193 if ( mShapeInstance )
194 SAFE_DELETE( mShapeInstance );
195 mShape = NULL;
196
197 // Attempt to get the resource from the ResourceManager
198 mShape = ResourceManager::get().load( mShapeFile );
199
200 if ( !mShape )
201 {
202 Con::errorf( "RenderShapeExample::createShape() - Unable to load shape: %s", mShapeFile.c_str() );
203 return;
204 }
205
206 // Attempt to preload the Materials for this shape
207 if ( isClientObject() &&
208 !mShape->preloadMaterialList( mShape.getPath() ) &&
209 NetConnection::filesWereDownloaded() )
210 {
211 mShape = NULL;
212 return;
213 }
214
215 // Update the bounding box
216 mObjBox = mShape->bounds;
217 resetWorldBox();
218 setRenderTransform(mObjToWorld);
219
220 // Create the TSShapeInstance
221 mShapeInstance = new TSShapeInstance( mShape, isClientObject() );
222}
223
224void RenderShapeExample::prepRenderImage( SceneRenderState *state )
225{

Callers 1

initMethod · 0.80

Calls 8

errorfFunction · 0.85
preloadMaterialListMethod · 0.80
getFunction · 0.50
isEmptyMethod · 0.45
equalMethod · 0.45
getPathMethod · 0.45
loadMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected