Browse Source

Trade::ObjectData: support for empty instances.

The instance has then ID -1.
pull/279/head
Vladimír Vondruš 14 years ago
parent
commit
1720a67984
  1. 17
      src/Trade/ObjectData.h

17
src/Trade/ObjectData.h

@ -40,7 +40,8 @@ class ObjectData {
enum class InstanceType {
Camera, /**< Camera instance (see CameraData) */
Light, /**< Light instance (see LightData) */
Mesh /**< Mesh instance (see MeshData) */
Mesh, /**< Mesh instance (see MeshData) */
Empty /**< Empty */
};
/**
@ -51,7 +52,15 @@ class ObjectData {
* @param instanceType Instance type
* @param instanceId Instance ID
*/
inline ObjectData(const std::string& name, std::vector<unsigned int> children, const Matrix4& transformation, InstanceType instanceType, unsigned int instanceId): _name(name), _children(children), _transformation(transformation), _instanceType(instanceType), _instanceId(instanceId) {}
inline ObjectData(const std::string& name, const std::vector<unsigned int>& children, const Matrix4& transformation, InstanceType instanceType, unsigned int instanceId): _name(name), _children(children), _transformation(transformation), _instanceType(instanceType), _instanceId(instanceId) {}
/**
* @brief Constructor for empty instance
* @param name Object name
* @param children Child objects
* @param transformation Transformation (relative to parent)
*/
inline ObjectData(const std::string& name, const std::vector<unsigned int>& children, const Matrix4& transformation): _name(name), _children(children), _transformation(transformation), _instanceType(InstanceType::Empty), _instanceId(-1) {}
/** @brief Destructor */
inline virtual ~ObjectData() {}
@ -79,14 +88,14 @@ class ObjectData {
* @return ID of given camera / light / mesh etc., specified by
* instanceType()
*/
inline unsigned int instanceId() const { return _instanceId; }
inline int instanceId() const { return _instanceId; }
private:
std::string _name;
std::vector<unsigned int> _children;
Matrix4 _transformation;
InstanceType _instanceType;
unsigned int _instanceId;
int _instanceId;
};
}}

Loading…
Cancel
Save