OGRE

xiaoxiao2021-03-06  21

1. The camera is different from Entity, and Entity is the ability to adjust its own position, so it can only hook it into the scene node, through the position adjustment of the scene node to adjust its own position, but photo The image has this capability, so you can control independently. Of course, the camera can be attached to the scene node to bring a lot of convenience. If you want to connect the camera and the light to the scene node, the method is nothing distinguished from the hook Entity, which is done through the ATTACHOBJECT function of the node. The parameter of the AttachObject function is the MovableObject type, and the MovableObject class is the base class of the Entity, Camera, and Light classes, so the attachObject function can receive parameters of the entity, Camera, and Light types.

2. Set up mcamera = mscenemgr-> createcamera ("Playercam") in Creatscene;, it will cover the original Camera, equal to a new Camera, rather than the original. Can match the keyboard mouse moving Camera. Then you cannot use the direction. Mcamera-> setPosition (Vector3 (0, 0, 200)); mcamera-> Lookat (Vector3 (0, 0, 300)); this and OpenGL The Lookat function is similar, but it is a function, here is the two functions, Camera's position and lookt coordinates of the coordinates of Camera are the direction turned by Camera. Decideting a camera with three sets of parameters, the first group is its location coordinate Position, the second group is its viewing direction Lookat, the third group is the direction of rotation of the camera in this line of sight.

3. Plane.NORMAL = Vector3 :: Unit_y; // The normal direction Plane.d = 100; // The distance from the origin of the world can be set from the normal direction of the plane and all positions parallel to this plane, and then these flat groups The distance from the origin is set out of this plane.

4. Using a normal scene manager in ordinary cases. If you want to use a special scene manager, you can make a selection through the MROOT-> GetSceneManager () function. There is such a function setWorldGeometry in the OGRE's SceneManager class, which is to read the world information (in the complex scene, the field terrain, etc. constant scene content, which is different from the programmer hand-added scene elements), And manage it. For ordinary scene managers, there is no "World Surface (Terrain, Room ...)" concept, calling this function will only throw a "World Geometry is not supported by the gener screneManager. And OGRE is Its engine provides a ST_Interior Interior Scene Manager implemented through the BSP algorithm, which re-implements the setWorldGeEth, which enables the SetWorldGeEth, which can read a .BSP indoor scene file and manage it ..BSP is Quake and CS, etc. The scene file type used by the indoor game. GGRE also provides ST_EXTERIOR_CLOSE outdoor closed scene manager to implement ST_EXTERIOR_CLOSE outdoor closed through the eight fork algorithm, which also re-implements a setWorldGeetry function, which can read a setWorldGeetry function. CFG Outdoor scenario configuration file, and load topographic elevation in grayscale form. Need not to note that special scene managers can not only manage those "world surface" not only manage complex scenes (buildings in complex scenes, field terrain, etc. The scene content of the change scene, which also has the full functionality of the ordinary scene manager. So when applying, it is still possible to add SceneNEnode and Entity and other scene elements to the scene after loading "unchanging the world" through the SetWorldGeetry function. The movement of these normal scene elements can be controlled by FrameLisner. Only they will exercise in a scene with a building or hillside. 5. Ogre supports large complex scenes in addition to the ordinary scenes we have seen, such as: wide The field terrain and complex buildings and maze. The main difficulty of 3D engines support large complex scenarios is the organization and clipping of the scene. The triangle number of large scenes is extremely large, and if there is no effective scene organization and cutting method, computer is rendering The efficiency will be low. Solve a big way is to organize the scene with the data structure such as BSP or top tree, picking out the contents of the camera as seen by the quick retrieval algorithm associated with these data structures, and then send it to the renderer Rendering so that the load of the graphics processor will decrease. In the type of scene manager in OGRE, there are four types: ST_GENERIC, normal scene ST_EXTERIOR_CLOSE, outdoor closed scene ST_EXTERIOR_FAR, outdoor unlimited scene ST_Interior interior Scene In addition to the first ordinary Outside the scene, several other types of scene managers are dealt with complex scenes. There is an SceneManageRenumerator class in the OGRE engine, and its role is to manage the implemented scene manager. A SceneManageRenumerator object is aggregated in the root class of the OGRE, which is available to the scenario manager you need.

转载请注明原文地址:https://www.9cbs.com/read-60375.html

New Post(0)