Package com.banuba.sdk.scene
Interface Entity
- All Known Implementing Classes:
Entity.CppProxy
public interface Entity
A structure element of the scene.
To construct a scene, you should form a hierarchy of entities to create its
structure, then add different components such as lights, cameras, and
geometry to entities to create visible content.
Each entity has a name which could be used for finding the entity in a hierarchy.
Entities in the scene form a tree hierarchy between parents and children.
Each entity could be in an enabled or disabled state. The disabling of the entity
is equivalent to removing the entity and all its children from the hierarchy.
An entity is a container for components. Each entity could contain several components,
but only one component of each component type. The Transform component is mandatory
and it implicitly placed in each entity.
-
Nested Class Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
add entiy as child to hierarchyvoid
addComponent
(Component component) add given component to entity if component of given type wasn't added before.void
addIntoLayer
(Layer layer) Add entity for given layer if it is wasn't added before.void
remove all child entites list.findChildByName
(String entityName) Perform depth-first traverse of entity tree.get all child entites list.getComponent
(ComponentType type) get component of given type.returns list of layers in which entity was added.getName()
boolean
hasComponent
(ComponentType type) check if component of given type was added.boolean
isActive()
void
removeChild
(Entity child) remove entiy as child to hierarchyvoid
removeComponent
(Component component) remove given component to entity if component of given component was added before.void
removeFromLayer
(Layer layer) Removes entity from given layer if it is was added before.void
setActive
(boolean active) Set enable/disable entity flag.void
Set a new name to the entity.
-
Method Details
-
setName
Set a new name to the entity. Name could be empty.- Parameters:
name
- (string): new entity name.
-
getName
- Returns:
- entity name (string)
-
addChild
add entiy as child to hierarchy- Parameters:
child
- (entity): child entity.
-
removeChild
remove entiy as child to hierarchy- Parameters:
child
- (entity): child entity.
-
getChildren
get all child entites list. -
clearChildren
void clearChildren()remove all child entites list. -
findChildByName
Perform depth-first traverse of entity tree. Return first found child with name `entityName` or NULL if such an entity doesn't exist.- Parameters:
entityName
- (string): name of desired entity- Returns:
- found entity (entity) or null
-
getParent
- Returns:
- parent entity and null if given entity is root.
-
setActive
void setActive(boolean active) Set enable/disable entity flag. The disabling of the entity is equivalent to removing the entity and all its children from the hierarchy.- Parameters:
active
- (bool) activity flag.
-
isActive
boolean isActive()- Returns:
- activity flag (bool)
-
addIntoLayer
Add entity for given layer if it is wasn't added before.- Parameters:
layer
- (layer): layer to add.
-
removeFromLayer
Removes entity from given layer if it is was added before. -
getLayers
returns list of layers in which entity was added. -
addComponent
add given component to entity if component of given type wasn't added before.- Parameters:
component
- (component): component to add.
-
hasComponent
check if component of given type was added.- Parameters:
component_type
- (component_type): component type to check.- Returns:
- flag (bool)
-
getComponent
get component of given type.- Parameters:
component_type
- (component_type): component type to get.- Returns:
- component of given type (component)
-
removeComponent
remove given component to entity if component of given component was added before.- Parameters:
component
- (component): component to remove.
-