#include "utils/logger.h" #include "server/entity.h" IMPLEMENT_RTTI_BASE( Entity ); Entity::Entity() : m_position(0.0f), m_rotation(0.0f), m_scale(1.0f), m_model(nullptr) { } Entity::~Entity() { } void Entity::LoadModel(const char* filename) { //m_model = g_modelManager->LoadModel(filename); //if (!m_model) //{ // Msg("Failed to load %s, no physic or animation", filename); // return; //} //// get model bounds //m_boundingBox = m_model->GetBoundingBox(); } IMPLEMENT_RTTI( LightEntity, Entity ); LightEntity::LightEntity() { } LightEntity::~LightEntity() { } void TestRTTI() { Entity* entity = new Entity(); LogMsg("entity classname: %s", entity->GetRuntimeClass()->m_pClassName); LightEntity* light = new LightEntity(); LogMsg("light classname: %s", light->GetRuntimeClass()->m_pClassName); LightEntity* lightCasted = DynamicCast< LightEntity, Entity >( entity ); LogMsg("light from entity casted: %s", lightCasted ? "successful" : "failed"); delete entity; entity = light; lightCasted = DynamicCast< LightEntity, Entity >( entity ); LogMsg("light from entity(LightEntity) casted: %s", lightCasted ? "successful" : "failed"); entity = NULL; delete light; }