5 #include <unordered_map>
22 using std::unique_ptr;
23 using std::unordered_map;
39 ObjectInternal::ObjectInternal(
const string&
id,
Model* model,
int instances) :
71 if (nodeId !=
"" && nodeId != objectNode->node->getId())
74 const auto& facesEntities = objectNode->node->getFacesEntities();
75 for (
auto facesEntityIdx = 0; facesEntityIdx < facesEntities.size(); facesEntityIdx++) {
76 const auto& facesEntity = facesEntities[facesEntityIdx];
78 if (facesEntityId !=
"" && facesEntityId != facesEntity.getId())
81 objectNode->specularMaterialDynamicDiffuseTextureIdsByEntities[facesEntityIdx] = textureId;
90 if (nodeId !=
"" && nodeId != objectNode->node->getId())
93 const auto& facesEntities = objectNode->node->getFacesEntities();
94 for (
auto facesEntityIdx = 0; facesEntityIdx < facesEntities.size(); facesEntityIdx++) {
95 const auto& facesEntity = facesEntities[facesEntityIdx];
97 if (facesEntityId !=
"" && facesEntityId != facesEntity.getId())
100 objectNode->textureMatricesByEntities[facesEntityIdx].set(textureMatrix);
108 unordered_map<string, Matrix4x4*> _overriddenTransformMatrices;
110 _overriddenTransformMatrices[overriddenTransformMatrixId] =
new Matrix4x4(*overriddenTransformMatrix);
119 unordered_map<string, Matrix4x4*> _overriddenTransformMatrices;
121 _overriddenTransformMatrices[overriddenTransformMatrixId] =
new Matrix4x4(*overriddenTransformMatrix);
Color 4 definition class.
void set(float r, float g, float b, float a)
Sets this color by its components.
Represents a model face, consisting of vertex, normal, tangent and bitangent vectors,...
Node faces entity A node can have multiple entities containing faces and a applied material.
Representation of a 3D model.
BoundingBox * getBoundingBox()
Axis aligned bounding box used for frustum, this is not directly connectable with physics engine.
void fromBoundingVolume(BoundingBox *original)
Set up this bounding volume from given bounding volume.
void fromBoundingVolumeWithTransform(BoundingBox *original, const Transform &transform)
Create bounding volume from given original(of same type) with applied transform.
void extend(BoundingBox *boundingBox)
Extend bounding box with given bounding box.
Bounding volume interface.
static BoundingBox * createBoundingBox(Model *model, const unordered_map< string, Matrix4x4 * > overriddenNodeTransformMatrices=unordered_map< string, Matrix4x4 * >())
Creates a bounding box from given model.
Transform parentTransform
vector< Transform > instanceTransform
void setNodeTransformMatrix(const string &id, const Matrix4x4 &matrix)
Set transform matrix for given node.
void unsetNodeTransformMatrix(const string &id)
Unset transform matrix for given node.
vector< ObjectAnimation * > instanceAnimations
vector< ObjectNode * > objectNodes
void setTransform(const Transform &transform)
BoundingBox worldBoundingBox
void setTextureMatrix(const Matrix3x3 &textureMatrix, const string &nodeId=string(), const string &facesEntityId=string())
Set texture matrix.
void setNodeTransformMatrix(const string &id, const Matrix4x4 &matrix)
Set node transform matrix.
virtual ~ObjectInternal()
Destructor.
void unbindDiffuseTexture(const string &nodeId=string(), const string &facesEntityId=string())
Unbind dynamic texture to a node and faces entity of this object.
void bindDiffuseTexture(int32_t textureId, const string &nodeId=string(), const string &facesEntityId=string())
Bind a texture to a node and faces entity.
void updateBoundingBox()
Update bounding volume.
bool nodeTransformMatrixUpdate
void unsetNodeTransformMatrix(const string &id)
Unset node transform matrix.
Object node specifically for rendering.
static constexpr int32_t TEXTUREID_NONE
Matrix3x3 class representing matrix3x3 mathematical structure and operations for 2d space.
Matrix4x4 class representing matrix4x4 mathematical structure and operations for 3d space.
Vector3 class representing vector3 mathematical structure and operations with x, y,...
virtual int32_t getColorTextureId()=0