Commits

Jeremy Sandell committed 6e86ba2

wrapped methods getMesh, setMaterial, hasSkeleton, getSkeleton, and isHardwareAnimationEnabled

  • Participants
  • Parent commits db31610

Comments (0)

Files changed (4)

contrib/d2/import/llcoi/ogre_interface.d

 alias void* PlaneListHandle;
 alias void* PlaneBoundedVolumeHandle;
 alias void* MeshHandle;
+alias void* MeshPtrHandle;
 alias void* TimerHandle;
 alias void* WindowListenerHandle;
 alias void* AxisAlignedBoxHandle;
 
 // Ogre::Entity
 EntityHandle create_entity(const char* entity_name, const char* mesh_file);
+///Ogre::Entity::getMesh() const
+const(MeshPtrHandle) entity_get_mesh(const EntityHandle handle);
 ///Ogre::Entity::getNumSubEntities() const
 uint entity_get_num_sub_entities(const EntityHandle handle);
 //Ogre::Entity::clone(std::string const&) const
 int entity_get_cast_shadows(const EntityHandle handle);
 int entity_get_receives_shadows(EntityHandle handle);
 ///Ogre::Entity::setMaterialName(std::string const&, std::string const&)
+void entity_set_material_name(EntityHandle handle, const char* material_name, const char* group_name);
 ///Ogre::Entity::setMaterial(Ogre::MaterialPtr const&)
-void entity_set_material_name(EntityHandle handle, const char* material_name, const char* group_name);
+void entity_set_material(EntityHandle handle, MaterialPtrHandle mat);
 ///Ogre::Entity::_notifyCurrentCamera(Ogre::Camera*)
 void entity__notify_current_camera(EntityHandle handle, CameraHandle cam);
 ///Ogre::Entity::setRenderQueueGroup(unsigned char)
 void entity_set_display_skeleton(EntityHandle handle, int display);
 //Ogre::Entity::getDisplaySkeleton() const
 int entity_get_display_skeleton(const EntityHandle handle);
+///Ogre::Entity::hasSkeleton() const
+int entity_has_skeleton(const EntityHandle handle);
+///Ogre::Entity::getSkeleton() const
+SkeletonInstanceHandle entity_get_skeleton(const EntityHandle handle);
+///Ogre::Entity::isHardwareAnimationEnabled()
+int entity_is_hardware_animation_enabled(EntityHandle handle);
+
 
 // Light
 LightHandle create_light(const char* light_name);
-
 void destroy_light(LightHandle handle);
-
 void light_set_position(LightHandle light_handle, const float x, const float y, const float z);
-
 //Ogre::Light::getPosition() const
 void light_get_position(LightHandle handle, ref coiVector3 pos);
 //Ogre::Light::getPosition() const

contrib/d2/import/llcoi/ogre_interface.di

 alias void* PlaneListHandle;
 alias void* PlaneBoundedVolumeHandle;
 alias void* MeshHandle;
+alias void* MeshPtrHandle;
 alias void* TimerHandle;
 alias void* WindowListenerHandle;
 alias void* AxisAlignedBoxHandle;
 
 // Ogre::Entity
 EntityHandle create_entity(const char* entity_name, const char* mesh_file);
+///Ogre::Entity::getMesh() const
+const(MeshPtrHandle) entity_get_mesh(const EntityHandle handle);
 ///Ogre::Entity::getNumSubEntities() const
 uint entity_get_num_sub_entities(const EntityHandle handle);
 //Ogre::Entity::clone(std::string const&) const
 int entity_get_cast_shadows(const EntityHandle handle);
 int entity_get_receives_shadows(EntityHandle handle);
 ///Ogre::Entity::setMaterialName(std::string const&, std::string const&)
+void entity_set_material_name(EntityHandle handle, const char* material_name, const char* group_name);
 ///Ogre::Entity::setMaterial(Ogre::MaterialPtr const&)
-void entity_set_material_name(EntityHandle handle, const char* material_name, const char* group_name);
+void entity_set_material(EntityHandle handle, MaterialPtrHandle mat);
 ///Ogre::Entity::_notifyCurrentCamera(Ogre::Camera*)
 void entity__notify_current_camera(EntityHandle handle, CameraHandle cam);
 ///Ogre::Entity::setRenderQueueGroup(unsigned char)
 void entity_set_display_skeleton(EntityHandle handle, int display);
 //Ogre::Entity::getDisplaySkeleton() const
 int entity_get_display_skeleton(const EntityHandle handle);
+///Ogre::Entity::hasSkeleton() const
+int entity_has_skeleton(const EntityHandle handle);
+///Ogre::Entity::getSkeleton() const
+SkeletonInstanceHandle entity_get_skeleton(const EntityHandle handle);
+///Ogre::Entity::isHardwareAnimationEnabled()
+int entity_is_hardware_animation_enabled(EntityHandle handle);
+
 
 // Light
 LightHandle create_light(const char* light_name);
-
 void destroy_light(LightHandle handle);
-
 void light_set_position(LightHandle light_handle, const float x, const float y, const float z);
-
 //Ogre::Light::getPosition() const
 void light_get_position(LightHandle handle, ref coiVector3 pos);
 //Ogre::Light::getPosition() const

interface/include/entity_bind.h

 #define EntityHandle void*
 #define CameraHandle void*
 #define AxisAlignedBoxHandle void*
+#define MeshHandle void*
+#define MeshPtrHandle void*
+#define MaterialPtrHandle void*
+#define SkeletonInstanceHandle void*
 
 // Entity
 DLL EntityHandle create_entity(const char* entity_name, const char* mesh_file);
+///Ogre::Entity::getMesh() const
+DLL const MeshPtrHandle entity_get_mesh(const EntityHandle handle);
 ///Ogre::Entity::getNumSubEntities() const
 DLL unsigned int entity_get_num_sub_entities(const EntityHandle handle);
 //Ogre::Entity::clone(std::string const&) const
 DLL int entity_get_cast_shadows(const EntityHandle handle);
 DLL int entity_get_receives_shadows(EntityHandle handle);
 ///Ogre::Entity::setMaterialName(std::string const&, std::string const&)
+DLL void entity_set_material_name(EntityHandle handle, const char* material_name, const char* group_name);
 ///Ogre::Entity::setMaterial(Ogre::MaterialPtr const&)
-DLL void entity_set_material_name(EntityHandle handle, const char* material_name, const char* group_name);
+DLL void entity_set_material(EntityHandle handle, MaterialPtrHandle mat);
 ///Ogre::Entity::_notifyCurrentCamera(Ogre::Camera*)
 DLL void entity__notify_current_camera(EntityHandle handle, CameraHandle cam);
 ///Ogre::Entity::setRenderQueueGroup(unsigned char)
 DLL void entity_set_display_skeleton(EntityHandle handle, int display);
 //Ogre::Entity::getDisplaySkeleton() const
 DLL int entity_get_display_skeleton(const EntityHandle handle);
-
+///Ogre::Entity::hasSkeleton() const
+DLL int entity_has_skeleton(const EntityHandle handle);
+///Ogre::Entity::getSkeleton() const
+DLL SkeletonInstanceHandle entity_get_skeleton(const EntityHandle handle);
+///Ogre::Entity::isHardwareAnimationEnabled()
+DLL int entity_is_hardware_animation_enabled(EntityHandle handle);
 #endif

interface/source/entity_bind.cpp

     return static_cast<EntityHandle>(entity);
 }
 
+///Ogre::Entity::getMesh() const
+const MeshPtrHandle entity_get_mesh(const EntityHandle handle)
+{
+    const Ogre::Entity* ent = static_cast<const Ogre::Entity*>(handle);
+    const Ogre::MeshPtr& ptr = ent->getMesh();
+    return static_cast<MeshPtrHandle>(ptr.get());
+}
+
+
 ///Ogre::Entity::getNumSubEntities() const
 unsigned int entity_get_num_sub_entities(const EntityHandle handle)
 {
 }
 
 ///Ogre::Entity::setMaterialName(std::string const&, std::string const&)
+void entity_set_material(EntityHandle handle, MaterialPtrHandle mat)
+{
+    Ogre::Entity* ent = static_cast<Ogre::Entity*>(handle);
+    Ogre::Material* material = static_cast<Ogre::Material*>(mat);
+    Ogre::MaterialPtr ptr(material);
+    ent->setMaterial(ptr);
+}
+
 ///Ogre::Entity::setMaterial(Ogre::MaterialPtr const&)
 void entity_set_material_name(EntityHandle handle, const char* material_name, const char* group_name)
 {
     return static_cast<const AxisAlignedBoxHandle>(&box);
 }
 
+
 //Ogre::Entity::getBoundingRadius() const
 coiReal entity_get_bounding_radius(const EntityHandle handle)
 {
     return entity->getDisplaySkeleton();
 }
 
-// How do we handle the fact that Ogre::Entity is an Ogre::MovableObject ?
-// Duplicate?
+///Ogre::Entity::hasSkeleton() const
+int entity_has_skeleton(const EntityHandle handle)
+{
+    const Ogre::Entity* ent = static_cast<const Ogre::Entity*>(handle);
+    return ent->hasSkeleton();
+}
+
+///Ogre::Entity::getSkeleton() const
+SkeletonInstanceHandle entity_get_skeleton(const EntityHandle handle)
+{
+    const Ogre::Entity* ent = static_cast<const Ogre::Entity*>(handle);
+    Ogre::SkeletonInstance* skel = ent->getSkeleton();
+    return static_cast<SkeletonInstanceHandle>(skel);
+}
+
+///Ogre::Entity::isHardwareAnimationEnabled()
+int entity_is_hardware_animation_enabled(EntityHandle handle)
+{
+    Ogre::Entity* ent = static_cast<Ogre::Entity*>(handle);
+    return ent->isHardwareAnimationEnabled();
+}
 
 /*
 ///Ogre::Entity::operator=(Ogre::Entity const&)
 ///Ogre::Entity::Entity(Ogre::Entity const&)
 ///Ogre::Entity::~Entity()
-///Ogre::Entity::getMesh() const
 ///Ogre::Entity::getSubEntity(unsigned int) const
 ///Ogre::Entity::getSubEntity(std::string const&) const
-///Ogre::Entity::getChildObjectsBoundingBox() const
 ///Ogre::Entity::_updateRenderQueue(Ogre::RenderQueue*)
 ///Ogre::Entity::getMovableType() const
 ///Ogre::Entity::getAnimationState(std::string const&) const
 ///Ogre::Entity::getShadowVolumeRenderableIterator(Ogre::ShadowTechnique, Ogre::Light const*, Ogre::HardwareIndexBufferSharedPtr*, bool, float, unsigned long)
 ///Ogre::Entity::_getBoneMatrices() const
 ///Ogre::Entity::_getNumBoneMatrices() const
-///Ogre::Entity::hasSkeleton() const
-///Ogre::Entity::getSkeleton() const
-///Ogre::Entity::isHardwareAnimationEnabled()
 ///Ogre::Entity::_notifyAttached(Ogre::Node*, bool)
 ///Ogre::Entity::getSoftwareAnimationRequests() const
 ///Ogre::Entity::getSoftwareAnimationNormalsRequests() const