Components
Azure Remote Rendering uses the Entity Component System pattern. While entities represent the position and the hierarchical composition of objects, components are responsible for implementing behavior.
The most frequently used types of components are mesh components, which add meshes into the rendering pipeline. Similarly, light components are used to add lighting and cut plane components are used to cut open meshes.
All these components use the transform (position, rotation, scale) of the entity they are attached to, as their reference point.
Working with components
You can easily add, remove, and manipulate components programmatically:
// create a point light component
RenderingSession session = GetCurrentlyConnectedSession();
PointLightComponent lightComponent = session.Connection.CreateComponent(ObjectType.PointLightComponent, ownerEntity) as PointLightComponent;
lightComponent.Color = new Color4Ub(255, 150, 20, 255);
lightComponent.Intensity = 11;
// ...
// destroy the component
lightComponent.Destroy();
lightComponent = null;
// create a point light component
ApiHandle<RenderingSession> session = GetCurrentlyConnectedSession();
ApiHandle<PointLightComponent> lightComponent = session->Connection()->CreateComponent(ObjectType::PointLightComponent, ownerEntity)->as<PointLightComponent>();
// ...
// destroy the component
lightComponent->Destroy();
lightComponent = nullptr;
A component is attached to an entity at creation time. It cannot be moved to another entity afterwards. Components are explicitly deleted with Component.Destroy()
or automatically when the component's owner entity is destroyed.
Only one instance of each component type may be added to an entity at a time.
Unity specific
The Unity integration has additional extension functions for interacting with components. See Unity game objects and components.
API documentation
- C# ComponentBase
- C# RenderingConnection.CreateComponent()
- C# Entity.FindComponentOfType()
- C++ ComponentBase
- C++ RenderingConnection::CreateComponent()
- C++ Entity::FindComponentOfType()
Next steps
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for