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.
    • Method Detail

      • setName

        void setName​(@NonNull
                     java.lang.String name)
        Set a new name to the entity. Name could be empty.
        Parameters:
        name - (string): new entity name.
      • getName

        @NonNull
        java.lang.String getName()
        Returns:
        entity name (string)
      • addChild

        void addChild​(@Nullable
                      Entity child)
        add entiy as child to hierarchy
        Parameters:
        child - (entity): child entity.
      • removeChild

        void removeChild​(@Nullable
                         Entity child)
        remove entiy as child to hierarchy
        Parameters:
        child - (entity): child entity.
      • getChildren

        @NonNull
        java.util.ArrayList<Entity> getChildren()
        get all child entites list.
      • clearChildren

        void clearChildren()
        remove all child entites list.
      • findChildByName

        @Nullable
        Entity findChildByName​(@NonNull
                               java.lang.String entityName)
        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

        @Nullable
        Entity 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

        void addIntoLayer​(@Nullable
                          Layer layer)
        Add entity for given layer if it is wasn't added before.
        Parameters:
        layer - (layer): layer to add.
      • removeFromLayer

        void removeFromLayer​(@Nullable
                             Layer layer)
        Removes entity from given layer if it is was added before.
      • getLayers

        @NonNull
        java.util.ArrayList<Layer> getLayers()
        returns list of layers in which entity was added.
      • addComponent

        void addComponent​(@Nullable
                          Component component)
        add given component to entity if component of given type wasn't added before.
        Parameters:
        component - (component): component to add.
      • hasComponent

        boolean hasComponent​(@NonNull
                             ComponentType type)
        check if component of given type was added.
        Parameters:
        component_type - (component_type): component type to check.
        Returns:
        flag (bool)
      • getComponent

        @Nullable
        Component getComponent​(@NonNull
                               ComponentType type)
        get component of given type.
        Parameters:
        component_type - (component_type): component type to get.
        Returns:
        component of given type (component)
      • removeComponent

        void removeComponent​(@Nullable
                             Component component)
        remove given component to entity if component of given component was added before.
        Parameters:
        component - (component): component to remove.