| 71 | } |
| 72 | |
| 73 | static dmGameObject::CreateResult CompLightCreate(const dmGameObject::ComponentCreateParams& params) |
| 74 | { |
| 75 | LightWorld* world = (LightWorld*) params.m_World; |
| 76 | LightContext* context = (LightContext*)params.m_Context; |
| 77 | |
| 78 | if (world->m_Components.Full()) |
| 79 | { |
| 80 | ShowFullBufferError("Light", LIGHT_MAX_COUNT_KEY, world->m_Components.Capacity()); |
| 81 | return dmGameObject::CREATE_RESULT_UNKNOWN_ERROR; |
| 82 | } |
| 83 | |
| 84 | LightComponent* light = new LightComponent; |
| 85 | memset(light, 0, sizeof(LightComponent)); |
| 86 | |
| 87 | light->m_Instance = params.m_Instance; |
| 88 | light->m_LightResource = (LightResource*) params.m_Resource; |
| 89 | light->m_LightInstance = dmRender::NewLightInstance(context->m_RenderContext, GetLightPrototype(light->m_LightResource)); |
| 90 | if (light->m_LightInstance == 0) |
| 91 | { |
| 92 | ShowFullBufferError("Light", LIGHT_MAX_COUNT_KEY, (int) context->m_MaxLightCount); |
| 93 | delete light; |
| 94 | return dmGameObject::CREATE_RESULT_UNKNOWN_ERROR; |
| 95 | } |
| 96 | |
| 97 | world->m_Components.Push(light); |
| 98 | *params.m_UserData = (uintptr_t) light; |
| 99 | return dmGameObject::CREATE_RESULT_OK; |
| 100 | } |
| 101 | |
| 102 | static void* CompLightGetComponent(const dmGameObject::ComponentGetParams& params) |
| 103 | { |
nothing calls this directly
no test coverage detected