Scenario object Creation
All objects in the scenario, including movable and unmovable: lights, cameras, entities, particle system,
Billboards, skyboxes, static geometry, and world geometry are all created by the scenario manager. Scenario
Everything is managed by the scenario manager. Anything obtained through the scenario manager must be destroyed by the scenario manager.
You cannot delete the pointer obtained by the scenario manager.
Scenario nodes have only one parent node and may have multiple child nodes. Nodes in attach and detach scenarios are free of charge.
Before explicitly telling the scenario manager to destroy these nodes, they always exist. If you do not want to render content on certain nodes in the scenario,
We can easily detach them. There is always a Root node in the scenario. Attach Multiple content objects
On the same node. You cannot attach an instance object to two scenario nodes at the same time, nor can a scenario node have two parent nodes.
The scene node always performs space operations (translation, rotation, scaling) rather than entity objects.
Scenario Query
The second most common function of scenario manager is to perform scenario query. Including Ray query, ball query, bind box query, and bind plane
Query, intersection query. Terrain clamping
How tall, I will always step on your feet .. (isn't it like taking notes? ^_^ ). All these queries are maskble, which indicates
To filter out the types of objects that do not care about during the query. For example, when you query a ball, you only want to see how many lights it contains.
In the ball, you do not have to return the results. In fact, you do not have to calculate the results.
Spatial Relationship and 3D Transformation
The world, parent, and local transformations in the world space are relative to the source point (, 0) of the global coordinate system, which is also the location of the root scene node. Therefore, we can consider that the transformation in the world space is relative to the Root scene node. The transformation in the parent space is relative to the parent node of the field node, and the transformation in the local space is relative to the node connected to the object. In most cases, we perform translation in the parent space and rotation in the local space. These operations in the ogre are all in this way.
Object space
The relationship between the vertex data exported from the model and its source point remains unchanged. When it is mounted to the scene node, this node is considered to be
Its source point. During modeling and export, the measurement unit is not assumed to be exported in the world unit (that is, no unit ).
Ogre translation is different from the setting position: translation can have multiple reference points (world, local, parent space), and setPosition ()
Always relative to the parent-space coordinate system.
Movable scenario object
Resource-based objects: The most common object is mesh (accompanied by skeleton), which is managed by the resource management system.
The scenario manager is not responsible for actual loading. It calls the Ogreuq Resource Manager to complete the loading.
Quadrilateral-based objects: Particle System, announcement board, ribbon trail, overlay, and sky box. They are usually for cameras,
Use Dynamic materials. Their primary resources are scripts that define how materials are mapped and their lifecycles (for particle systems and ribbon trail ). The sky box is directly defined by the scenario manager.
Skyplane, skydome, skybox
The main similarity is that they keep a constant distance from the camera. They can be other objects in the scene
Rendering before or after. They use common ogre material, so texture animation is no different from other textures. They can
It is opened or closed by the scenario manager, and the distance from the camera can also be set.
Skyplane is a plane. Define the relationship between the distance and the normal value and the camera position. It can be bent and divided into multiple segments. The texture can be tiled multiple times. Skydome is composed of five planes with no space at the bottom. You can change the texture coordinates to change the curvature of the image. There is a value for adjustment. The lower the value, the softer the curvature. The higher the value, the steep it is. Skybox is like skydome, but it cannot "Bend" material coordinates. It can be made of cubes. Hardware acceleration can be used to achieve high rendering efficiency.
Light
Limits on the use of light: a single channel usually supports a maximum of 8 lights. Use more lights through multiple channels.
The distance between light and an object determines the actual effect of light on the object. Ogre supports point light, equal light, and spotlight.
World ry
When creating a mesh-based scene or level, it should be divided into smaller parts for ease of reduction. Paging Scene Manager provides such a tool.
Spatial Splitting Scheme
Ogre is based on a hardware accelerated rendering engine. Therefore, space separation based on actual polygon is performed in the batching mode to maximize the ry.
The effect is much better. Modern GPUs prefer to render a few large batches of geometry instead
Small batches.
The more visible geometry you can render in a single batch, the better your application's
Performance is likely to be (within reason, of course; other classic issues such as fillrate and
Overdraw can still take over if you just blindly blast polygons at the GPU, batched or not ).
Static ry usage notes:
The static ry must be created during use.
The ry with the same material will be placed in the same rendering operation (batch): different materials still require a separate batch.
The effort is to maximize the number of called triangles and minimize the number of calls.
Objects contained in static geometry cannot be moved. Only one world switch is applied to the complete static geometry object.
More memory is occupied than movable ry of the same size.
If everything in the group is within the cone, all objects in the group will be rendered.