Base class for primitive shape components (Cube, Sphere, Plane). Supports multi-instance rendering within a single component, custom materials, and hardware instancing.
More...
#include <Primitive/CPrimitive.h>
|
| CEntity * | addPrimitive (const core::vector3df &pos, const core::vector3df &rotDeg, const core::vector3df &scale) |
| | Add a primitive instance to this component.
|
| CMaterial * | getMaterial () |
| | Get the active material.
|
| CMesh * | getMesh () |
| | Get the internal mesh used for rendering.
|
| const SColor & | getColor () |
| | Get the default material color.
|
| void | setColor (const SColor &color) |
| | Set the default material color.
|
| void | setCustomMaterial (CMaterial *material) |
| | Set a custom material for all instances.
|
| void | setInstancing (bool b) |
| | Enable or disable hardware instancing.
|
| bool | isInstancing () |
| | Check if hardware instancing is enabled.
|
| void | setEnableNormalMap (bool b) |
| | Enable or disable normal map support (uses tangent vertices).
|
| bool | isUseNormalMap () |
| | Check if normal map is enabled.
|
| CPrimiviteData::EPrimitive | getType () |
| | Get the primitive type.
|
| Public Member Functions inherited from Skylicht::CEntityHandler |
| virtual void | updateComponent () |
| virtual void | onUpdateCullingLayer (u32 mask) |
|
CEntity * | searchEntityByID (const char *id) |
|
virtual CEntity * | createEntity () |
|
virtual CEntity * | createEntity (CEntity *parent) |
|
virtual void | removeEntity (CEntity *entity) |
|
virtual void | removeAllEntities () |
|
void | regenerateEntityId () |
|
core::array< CEntity * > & | getEntities () |
|
int | getEntityCount () |
|
void | getEntitiesTransforms (core::array< core::matrix4 > &result) |
|
void | setShadowCasting (bool b) |
|
bool | isShadowCasting () |
|
const char * | getName () |
| virtual void | reset () |
| virtual void | startComponent () |
| virtual void | endUpdate () |
|
virtual void | onEnable (bool b) |
|
void | setEnable (bool b) |
|
bool | isEnable () |
|
CGameObject * | getGameObject () |
|
void | setEnableSerializable (bool b) |
|
bool | isSerializable () |
|
void | addLinkComponent (CComponentSystem *comp) |
|
void | removeAllLink () |
|
virtual | ~IActivatorObject () |
| | Virtual destructor for polymorphic activator objects.
|
|
|
CPrimiviteData::EPrimitive | m_type |
|
SColor | m_color |
|
bool | m_instancing |
|
bool | m_useCustomMaterial |
|
bool | m_useNormalMap |
|
CMaterial * | m_material |
|
CMaterial * | m_customMaterial |
|
std::string | m_materialPath |
| Protected Attributes inherited from Skylicht::CEntityHandler |
|
core::array< CEntity * > | m_entities |
|
bool | m_shadowCasting |
|
CGameObject * | m_gameObject |
|
bool | m_enable |
|
bool | m_serializable |
|
std::vector< CComponentSystem * > | m_linkComponent |
|
|
static int | useComponent (CComponentSystem *used) |
Base class for primitive shape components (Cube, Sphere, Plane). Supports multi-instance rendering within a single component, custom materials, and hardware instancing.
- Note
- By default, primitives use Deferred shaders, which means they will only render on a Deferred Pipeline. If you are using a Forward Pipeline (common on mobile), you must call setCustomMaterial() with a material that uses a forward-compatible shader.
Example
CCube* cubes = cubeManager->addComponent<
CCube>();
Component for rendering cube primitives.
Definition CCube.h:44
This object class stores information for a GameObject.
Definition CGameObject.h:52
void setInstancing(bool b)
Enable or disable hardware instancing.
CEntity * addPrimitive(const core::vector3df &pos, const core::vector3df &rotDeg, const core::vector3df &scale)
Add a primitive instance to this component.
vector3d< f32 > vector3df
Typedef for a f32 3d vector.
Definition vector3d.h:445
◆ addPrimitive()
Add a primitive instance to this component.
- Parameters
-
| pos | Relative position. |
| rotDeg | Relative rotation in degrees. |
| scale | Relative scale. |
- Returns
- Pointer to the created entity.
◆ createSerializable()
◆ getColor()
| const SColor & Skylicht::CPrimitive::getColor |
( |
| ) |
|
|
inline |
Get the default material color.
- Returns
- SColor value.
◆ getMaterial()
| CMaterial * Skylicht::CPrimitive::getMaterial |
( |
| ) |
|
Get the active material.
- Returns
- Pointer to CMaterial.
- Note
- By default, this returns the internal material which is loaded with a Deferred shader. It will not render correctly on a Forward Pipeline unless a custom material is set.
◆ getMesh()
| CMesh * Skylicht::CPrimitive::getMesh |
( |
| ) |
|
Get the internal mesh used for rendering.
- Returns
- Pointer to CMesh.
◆ getType()
| CPrimiviteData::EPrimitive Skylicht::CPrimitive::getType |
( |
| ) |
|
|
inline |
Get the primitive type.
- Returns
- EPrimitive value.
◆ initComponent()
| virtual void Skylicht::CPrimitive::initComponent |
( |
| ) |
|
|
protectedvirtual |
◆ isInstancing()
| bool Skylicht::CPrimitive::isInstancing |
( |
| ) |
|
|
inline |
Check if hardware instancing is enabled.
- Returns
- True if enabled.
◆ isUseNormalMap()
| bool Skylicht::CPrimitive::isUseNormalMap |
( |
| ) |
|
|
inline |
Check if normal map is enabled.
- Returns
- True if enabled.
◆ loadSerializable()
◆ setColor()
| void Skylicht::CPrimitive::setColor |
( |
const SColor & | color | ) |
|
Set the default material color.
- Parameters
-
◆ setCustomMaterial()
| void Skylicht::CPrimitive::setCustomMaterial |
( |
CMaterial * | material | ) |
|
Set a custom material for all instances.
- Parameters
-
◆ setEnableNormalMap()
| void Skylicht::CPrimitive::setEnableNormalMap |
( |
bool | b | ) |
|
|
inline |
Enable or disable normal map support (uses tangent vertices).
- Parameters
-
◆ setInstancing()
| void Skylicht::CPrimitive::setInstancing |
( |
bool | b | ) |
|
Enable or disable hardware instancing.
- Parameters
-
| b | True to enable instancing. |
◆ spawn()
| virtual CEntity * Skylicht::CPrimitive::spawn |
( |
| ) |
|
|
protectedvirtual |
The documentation for this class was generated from the following file: