ProtoTracer  1.0
Real-time 3D rendering and animation engine
Loading...
Searching...
No Matches
Object3D Class Reference

Represents a 3D object with geometry, material, and transformation data. More...

#include <Object3D.h>

Collaboration diagram for Object3D:

Public Member Functions

 Object3D (IStaticTriangleGroup *originalTriangles, ITriangleGroup *modifiedTriangles, Material *material)
 Constructs an Object3D instance.
 
 ~Object3D ()
 Destructor for Object3D.
 
void Enable ()
 Enables the object, making it visible and active.
 
void Disable ()
 Disables the object, making it invisible and inactive.
 
bool IsEnabled ()
 Checks if the object is enabled.
 
Vector3D GetCenterOffset ()
 Retrieves the object's center offset.
 
void GetMinMaxDimensions (Vector3D &minimum, Vector3D &maximum)
 Retrieves the minimum and maximum dimensions of the object.
 
Vector3D GetSize ()
 Retrieves the size of the object.
 
TransformGetTransform ()
 Retrieves the object's transformation data.
 
void SetTransform (Transform &t)
 Sets the object's transformation data.
 
void ResetVertices ()
 Resets the object's vertices to their original positions.
 
void UpdateTransform ()
 Updates the object's geometry based on its transformation data.
 
ITriangleGroupGetTriangleGroup ()
 Retrieves the modifiable geometry of the object.
 
MaterialGetMaterial ()
 Retrieves the material assigned to the object.
 
void SetMaterial (Material *material)
 Sets the material for the object.
 

Private Attributes

Transform transform
 Transform object representing the object's position, rotation, and scale.
 
IStaticTriangleGrouporiginalTriangles
 Pointer to the static representation of the object's geometry.
 
ITriangleGroupmodifiedTriangles
 Pointer to the modifiable representation of the object's geometry.
 
Materialmaterial
 Pointer to the material assigned to the object.
 
bool enabled = true
 Indicates whether the object is currently enabled.
 

Detailed Description

Represents a 3D object with geometry, material, and transformation data.

The Object3D class manages the geometric representation, transformation, and material properties of a 3D object. It provides methods to enable or disable the object, modify its transformations, reset its geometry, and retrieve its material or geometry data.

Definition at line 28 of file Object3D.h.

Constructor & Destructor Documentation

◆ Object3D()

Object3D ( IStaticTriangleGroup originalTriangles,
ITriangleGroup modifiedTriangles,
Material material 
)

Constructs an Object3D instance.

Parameters
originalTrianglesPointer to the static representation of the object's geometry.
modifiedTrianglesPointer to the modifiable representation of the object's geometry.
materialPointer to the material assigned to the object.

Definition at line 3 of file Object3D.cpp.

References material.

◆ ~Object3D()

~Object3D ( )

Destructor for Object3D.

Definition at line 7 of file Object3D.cpp.

Member Function Documentation

◆ Disable()

void Disable ( )

Disables the object, making it invisible and inactive.

Definition at line 13 of file Object3D.cpp.

References enabled.

◆ Enable()

void Enable ( )

Enables the object, making it visible and active.

Definition at line 9 of file Object3D.cpp.

References enabled.

◆ GetCenterOffset()

Vector3D GetCenterOffset ( )

Retrieves the object's center offset.

Returns
A Vector3D representing the object's center offset.

Definition at line 21 of file Object3D.cpp.

References Vector3D::Divide(), ITriangleGroup::GetVertexCount(), ITriangleGroup::GetVertices(), and modifiedTriangles.

◆ GetMaterial()

Material * GetMaterial ( )

Retrieves the material assigned to the object.

Returns
Pointer to the Material assigned to the object.

Definition at line 76 of file Object3D.cpp.

References material.

Referenced by Rasterizer::Rasterize().

◆ GetMinMaxDimensions()

void GetMinMaxDimensions ( Vector3D minimum,
Vector3D maximum 
)

Retrieves the minimum and maximum dimensions of the object.

Parameters
minimumReference to a Vector3D to store the minimum dimensions.
maximumReference to a Vector3D to store the maximum dimensions.

Definition at line 31 of file Object3D.cpp.

References ITriangleGroup::GetVertexCount(), ITriangleGroup::GetVertices(), Vector3D::Max(), Vector3D::Min(), and modifiedTriangles.

Referenced by GetSize().

◆ GetSize()

Vector3D GetSize ( )

Retrieves the size of the object.

Returns
A Vector3D representing the object's size.

Definition at line 38 of file Object3D.cpp.

References GetMinMaxDimensions().

◆ GetTransform()

Transform * GetTransform ( )

Retrieves the object's transformation data.

Returns
Pointer to the Transform object.

Definition at line 46 of file Object3D.cpp.

References transform.

Referenced by BoundaryMotionSimulator::Update(), and PhysicsSimulator::Update().

◆ GetTriangleGroup()

◆ IsEnabled()

bool IsEnabled ( )

Checks if the object is enabled.

Returns
True if the object is enabled, otherwise false.

Definition at line 17 of file Object3D.cpp.

References enabled.

Referenced by Rasterizer::Rasterize().

◆ ResetVertices()

void ResetVertices ( )

Resets the object's vertices to their original positions.

Definition at line 54 of file Object3D.cpp.

References ITriangleGroup::GetVertexCount(), IStaticTriangleGroup::GetVertices(), ITriangleGroup::GetVertices(), modifiedTriangles, and originalTriangles.

Referenced by BoundaryMotionSimulator::Update(), and Crash::Update().

◆ SetMaterial()

void SetMaterial ( Material material)

Sets the material for the object.

Parameters
materialPointer to the new Material to be assigned.

Definition at line 80 of file Object3D.cpp.

References material.

◆ SetTransform()

void SetTransform ( Transform t)

Sets the object's transformation data.

Parameters
tReference to the new Transform.

Definition at line 50 of file Object3D.cpp.

References transform.

◆ UpdateTransform()

Member Data Documentation

◆ enabled

bool enabled = true
private

Indicates whether the object is currently enabled.

Definition at line 34 of file Object3D.h.

Referenced by Disable(), Enable(), and IsEnabled().

◆ material

Material* material
private

Pointer to the material assigned to the object.

Definition at line 33 of file Object3D.h.

Referenced by GetMaterial(), Object3D(), and SetMaterial().

◆ modifiedTriangles

ITriangleGroup* modifiedTriangles
private

Pointer to the modifiable representation of the object's geometry.

Definition at line 32 of file Object3D.h.

Referenced by GetCenterOffset(), GetMinMaxDimensions(), GetTriangleGroup(), ResetVertices(), and UpdateTransform().

◆ originalTriangles

IStaticTriangleGroup* originalTriangles
private

Pointer to the static representation of the object's geometry.

Definition at line 31 of file Object3D.h.

Referenced by ResetVertices().

◆ transform

Transform transform
private

Transform object representing the object's position, rotation, and scale.

Definition at line 30 of file Object3D.h.

Referenced by GetTransform(), SetTransform(), and UpdateTransform().


The documentation for this class was generated from the following files: