Functions related to camera in ogre

Source: Internet
Author: User


// Create a camera

// Scenemanager is a pointer to an existing scenario manager instance.

// Here we construct a camera named "maincam.

Camera * camera = scenemgr-> createcamera ("maincam ");

 

// You do not need to calculate anything. You can directly obtain this size from the view. The actual view aspect ratio is.

Camera-> setaspectratio (1.333333f );

 

// The 30-degree angle allows us to see a long and distant view

Camera-> setfovy (30366f); // W indicates the angle here.

Camera-> setnearclipdistance (5.0f); // The distance from the camera to the plane XY

Camera-> setfarclipdistance (1000.0f); // The distance from the camera to the plane x 'y'

 

// Set the point-to-line Point Object rendering in the rendering mode.

Camera-> setpolygonmode (pm_wireframe );

Camera-> setpolygonmode (pm_points );

Camera-> setpolygonmode (pm_solevels );

Polygonmode mode = camera-> getpolygonmode (); // skip this step.

 

// Camera position change

 

// Confirm that we already have a pointer to camera.

Camera-> setposition (200, 10,200 );

 

// You can also use a three-dimensional vector to set camera coordinates. It is easier to do so when we get the scene coordinates.

// Camera-> setposition (vector3 (200, 10,200 ));

 

// Assume that the camera is still in the 200 and 10,200 space positions we set earlier.
Camera-> move (10, 0, 0); // move the camera to 210, 10,200

Camera-> moverelative (0, 0, 10); // move the camera to 210, 10,210

 

// Move, moverelative, and setposition

// Setposition: sets the absolute coordinates of the camera. Move and moverelative are used to move the camera to the relative position of the current position.

// The difference between moverelative and move is that the former is moved in the camera's local coordinate. Assume that the camera image is rotated 90 degrees to Move Forward 10.

// Unit. Then, the local coordinates move 10 to the z direction, and the world coordinates move 10 units to the X direction.

 

 

// Pointing, direction, lookat

Void setdirection (real X, real y, real Z );

Void setdirection (const vector3 & VEC );

Vector3 getdirection (void) const;

Vector3 getup (void) const;

Vector3 getright (void) const;

Void lookat (const vector3 & angle );

Void lookat (real X, real y, real Z );

Void roll (const radian & angle); // scroll around the Z axis. The right-hand rotation is clockwise.

Void roll (real degrees) {roll (angle (degrees ));}

Void yaw (const radian & angle); // yaw around Y axis

Void yaw (real degrees) {yaw (angle (degrees ));}

Void pitch (const radian & angle); // skew around the X axis

Void pitch (real degrees) {yaw (angle (degrees ));}

Void rotate (const vector3 & axis, const radian & angle );

Void rotate (const vector3 & axis, real degrees ){

Rotate (axis, angle (degrees ));}

Void setfixedyawaxis (bool usefixed, const vector3 & fixedaxis = vector3: unit_y)

// Setting the degree of freedom on the Y axis cannot be rotated around the Y axis

Const quaternion & getorientation (void) const

Void setorientation (const quaternion & Q );

 

// Automatic Tracking

/* The first parameter in the method determines whether to enable automatic tracing. You can reset this parameter before rendering any frame. Before turning off automatic tracing, make sure that the tracked node is not deleted (otherwise, the system throws an exception ). The second parameter of the method is the pointer of the tracked node. Unless your first parameter is false (null can be used at this time), you must be sure that the pointer to the node must be valid during the call. Sometimes you may find that the object you want to track is too large, so that you do not know where to "View". At this time, you can set the third parameter to set the focus,It is a positioning point relative to the scene node in a local space.. */

Void setautotracking (bool enabled, scenenode * target = 0, const vector3 & offset = vector3: zero );

 

// Obtain the camera Information

Const quaternion & getderivedorientation (void) const;

Const vector3 & getderivedposition (void) const;

Vector3 getderiveddirection (void) const;

Vector3 getderivedup (void) const;

Vector3 getderivedright (void) const;

Const quaternion & getrealorientation (void) const;

Const vector3 & getrealposition (void) const;

Vector3 getrealdirection (void) const;

Vector3 getrealup (void) const;

Vector3 getrealright (void) const;

/* The method with the keyword "real" returns the coordinates of the world space, the return value of a method with the keyword "derived" is in the local coordinate system of "axis binding" (that is, the origin of this coordinate system is the point where the camera is located, and the axis is the same as the world coordinate system ). */

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.