| 332 | } |
| 333 | |
| 334 | dmGameObject::CreateResult CompModelDeleteWorld(const dmGameObject::ComponentDeleteWorldParams& params) |
| 335 | { |
| 336 | ModelContext* context = (ModelContext*)params.m_Context; |
| 337 | ModelWorld* world = (ModelWorld*)params.m_World; |
| 338 | dmGraphics::HContext graphics_context = dmRender::GetGraphicsContext(context->m_RenderContext); |
| 339 | dmGraphics::DeleteVertexDeclaration(world->m_VertexDeclaration); |
| 340 | dmGraphics::DeleteVertexDeclaration(world->m_VertexDeclarationSkinned); |
| 341 | dmGraphics::DeleteVertexDeclaration(world->m_InstanceVertexDeclaration); |
| 342 | dmGraphics::DeleteVertexDeclaration(world->m_InstanceVertexDeclarationSkinned); |
| 343 | |
| 344 | for(uint32_t i = 0; i < VERTEX_BUFFER_MAX_BATCHES; ++i) |
| 345 | { |
| 346 | dmRender::DeleteBufferedRenderBuffer(context->m_RenderContext, world->m_VertexBuffers[i]); |
| 347 | } |
| 348 | |
| 349 | dmRender::DeleteBufferedRenderBuffer(context->m_RenderContext, world->m_InstanceBufferLocalSpace); |
| 350 | |
| 351 | for (int i = 0; i < world->m_ScratchConstantBuffers.Size(); ++i) |
| 352 | { |
| 353 | if (world->m_ScratchConstantBuffers[i]) |
| 354 | { |
| 355 | DestroyRenderConstants(world->m_ScratchConstantBuffers[i]); |
| 356 | } |
| 357 | } |
| 358 | |
| 359 | dmResource::UnregisterResourceReloadedCallback(((ModelContext*)params.m_Context)->m_Factory, ResourceReloadedCallback, world); |
| 360 | |
| 361 | dmRig::DeleteContext(world->m_RigContext); |
| 362 | |
| 363 | if (world->m_SkinnedAnimationData.m_BindPoseCacheBuffer) |
| 364 | free(world->m_SkinnedAnimationData.m_BindPoseCacheBuffer); |
| 365 | if (world->m_SkinnedAnimationData.m_BindPoseCacheTexture) |
| 366 | dmGraphics::DeleteTexture(graphics_context, world->m_SkinnedAnimationData.m_BindPoseCacheTexture); |
| 367 | |
| 368 | DestroyMaterialAttributeInfos(world->m_DynamicVertexAttributePool); |
| 369 | |
| 370 | delete [] world->m_VertexBufferData; |
| 371 | delete [] world->m_VertexBufferDispatchCounts; |
| 372 | delete [] world->m_VertexBuffers; |
| 373 | |
| 374 | delete world; |
| 375 | |
| 376 | return dmGameObject::CREATE_RESULT_OK; |
| 377 | } |
| 378 | |
| 379 | static void CompModelEventCallback(dmRig::RigEventType event_type, void* event_data, void* user_data1, void* user_data2) |
| 380 | { |
nothing calls this directly
no test coverage detected