MQScene class

MQScene class manages an information of a rendering view.

For rendering
InitSize Specify a size of an image for a rendering
GetProjMatrix Store a matrix for a perspective transform
GetViewMatrix Store a matrix for a view transform
Camera
GetCameraPosition Get a camera position
SetCameraPosition Set a camera position
GetCameraAngle Get a camera direction
SetCameraAngle Set a camera direction
GetLookAtPosition Get a camera look at position
SetLookAtPosition Set a camera look at position
GetRotationCenter Get a rotation center of the view
SetRotationCenter Set a rotation center of the view
GetFOV Get a viewing angle
SetFOV Set a viewing angle
GetZoom Get a zoom rate
SetZoom Set a zoom rate
GetOrtho Get an orthogonal projection
SetOrtho Set an orthogonal projection
GetFrontClip Get a front clip
GetBackClip Get a back clip
Entire scene
GetGlobalDirectionalLight Get a direction of a directional light
SetGlobalDirectionalLight Set a direction of a directional light
AddGlobalDirectionalLight Add a directional light
DeleteGlobalDirectionalLight Delete a directional light
GetGlobalDirectionalLightNum Get a number of directional lights
GetGlobalDirectionalLightDirection Get a direction of a directional light
GetGlobalDirectionalLightColor Get a color of a directional light
SetGlobalDirectionalLightDirection Set a direction of a directional light
SetGlobalDirectionalLightColor Set a color of a directional light
GetGlobalAmbientColor Get an ambient color in the entire scene
SetGlobalAmbientColor Set an ambient color in the entire scene
Transform
Convert3DToScreen Convert a 3D space coordinate to a screen coordinate
ConvertScreenTo3D Convert a screen coordinate to a 3D coordinate
GetVisibleFace Acquire whether faces are displayed on a view
Background image
GetBackgroundImage Get a filename of a background image
SetBackgroundImage Set a filename of a background image
GetBackgroundImagePosition Get a placement of a background image
SetBackgroundImagePosition Set a placement of a background image

void MQScene::InitSize(int width, int height);

width
A horizontal size for the rendering area
height
A vertical size for the rendering area

(new in Rev2.10)

It specifies a size of an image for a rendering.


void MQScene::GetProjMatrix(float *matrix);

matrix
A buffer to be set a 4x4 matrix

(new in Rev2.10)

It stores a matrix for a projection to the buffer specified by matrix which array has 16 lengths.

The arrangement of the matrix is compatible with the one used by glLoadMatrixf() in OpenGL. However, please be careful that the compatibility of a part of parameters may be lost in the future version.


void MQScene::GetViewMatrix(float *matrix);

matrix
A buffer to be set a 4x4 matrix

(new in Rev2.10)

It stores a matrix for a view transform to the buffer specified by matrix which array has 16 lengths.

The arrangement of the matrix is compatible with the one used by glLoadMatrixf() in OpenGL.


MQPoint MQScene::GetCameraPosition();

Return value
A camera position

(new in Rev2.40)

It gets a camera position.


void MQScene::SetCameraPosition(const MQPoint& p);

p
A camera position

(new in Rev2.40)

It sets a camera position.

When the camera position has been changed, the look at point may also move together. Therefore, when you want to move both a position of a camera and a look at point, SetCameraPosition() must be called before calling SetLookAtPosition().


MQAngle MQScene::GetCameraAngle();

Return value
A camera direction

(new in Rev2.40)

It gets a camera direction.


void MQScene::SetCameraAngle(const MQAngle& angle);

angle
A camera direction

(new in Rev2.40)

It sets a camera direction.


MQPoint MQScene::GetLookAtPosition();

Return value
A look at position of the camera

(new in Rev2.40)

It gets a look at position of the camera.


void MQScene::SetLookAtPosition(const MQPoint& p);

p
A look at position of the camera

(new in Rev2.40)

It sets a look at position of the camera. A rotation center is also set as the same position as the look at point.

When the camera position has been changed, the look at point may also move together. Therefore, when you want to move both a position of a camera and a look at point, SetLookAtPosition() must be called after calling SetCameraPosition().


MQPoint MQScene::GetRotationCenter();

Return value
A center position of the rotation

(new in Rev2.40)

It gets the center position of the rotation of the view.


void MQScene::SetRotationCenter(const MQPoint& p);

p
A center position of the rotation

(new in Rev2.40)

It sets the center position of the rotation of the view.


float MQScene::GetFOV();

Return value
A viewing angle (in radian)

(new in Rev2.40)

It gets a view angle of the view.


void MQScene::SetFOV(float fov);

fov
A viewing angle (in radian)

(new in Rev2.40)

It sets a view angle of the view.


float MQScene::GetZoom();

Return value
A zoom rate

(new in Rev4.30)

It returns a zoom rate.


void MQScene::SetZoom(float zoom);

zoom
A zoom rate

(new in Rev4.30)

It specifies a zoom rate.


bool MQScene::GetOrtho();

Return value
An orthogonal projection

(new in Rev4.02)

It returns the view is orthogonal or perspective.


void MQScene::SetOrtho(bool ortho);

ortho
An orthogonal projection

(new in Rev4.02)

It specifies the view is orthogonal or perspective.


float MQScene::GetFrontClip();

Return value
A front clip

(new in Rev4.50)

It returns a distance from a camera to a front clipping plane.


float MQScene::GetBackClip();

Return value
A back clip

(new in Rev4.50)

It returns a distance from a camera to a back clipping plane.


MQPoint MQScene::GetGlobalDirectionalLight();

(in Rev3.11)

This function is obsolete. You can use GetGlobalDirectionalLightDirection() to get a direction of a global directional light.


void MQScene::SetGlobalDirectionalLight(const MQPoint& vec);

(in Rev3.11)

This function is obsolete. You can use SetGlobalDirectionalLightDirection() to set a direction of a global directional light.


int MQScene::AddGlobalDirectionalLight();

Return value
[0 or larger] An index of the light
[-1] Failure

(new in Rev3.11)

It adds a directional light.

You must set a direction and a color of the added light by SetGlobalDirectionalLightDirection() and SetGlobalDirectionalLightColor().

It will not add a light and return -1 when the maximum number of lights already exist.


BOOL MQScene::DeleteGlobalDirectionalLight(int index);

index
An index of the light
Return value
[TRUE] Succeed
[FALSE] Failure

(new in Rev3.11)

It deletes a directional light.

The light will not be deleted and return FALSE when only one light exists.


int MQScene::GetGlobalDirectionalLightNum();

Return value
A number of the global directional lights

(new in Rev3.11)

It gets a number of global directional lights.


MQPoint MQScene::GetGlobalDirectionalLightDirection(int index);

index
An index of the light
Return value
A direction of the directional light

(new in Rev3.11)

It gets a color of the specified global directional light. The index must be from 0 to GetGlobalDirectionalLightNum()-1.


MQColor MQScene::GetGlobalDirectionalLightColor(int index);

index
An index of the light
Return value
A color of the directional light

(new in Rev3.11)

It gets a direction of the specified global directional light. The index must be from 0 to GetGlobalDirectionalLightNum()-1.


void MQScene::SetGlobalDirectionalLightDirection(int index, const MQPoint& vec);

index
An index of the light
vec
A direction of a directional light

(new in Rev3.11)

It sets a direction of the specified global directional light. The index must be from 0 to GetGlobalDirectionalLightNum()-1.


void MQScene::SetGlobalDirectionalLightColor(int index, const MQColor& color);

index
An index of the light
color
A color of a directional light

(new in Rev3.11)

It sets a color of the specified global directional light. The index must be from 0 to GetGlobalDirectionalLightNum()-1.


MQColor MQScene::GetGlobalAmbientColor();

Return value
An ambient color

(new in Rev2.40)

It gets an ambient color in the entire scene


void MQScene::SetGlobalAmbientColor(const MQColor& amb);

amb
An ambient color

(new in Rev2.40)

It sets an ambient color in the entire scene.


MQPoint MQScene::Convert3DToScreen(const MQPoint& p, float *out_w);

p
An absolute coordinate in a 3D space
out_w
[OUT] Homogeneous coordinate
Return value
A coordinate on the screen

(new in Rev2.40)

It converts the 3D space coordinate to the screen coordinate.

It returns (0,0,0) when the specified position is in front than the front clipping plane.


MQPoint MQScene::ConvertScreenTo3D(const MQPoint& p);

p
A coordinate on the screen
Return value
An absolute coordinate in a 3D space

(new in Rev2.40)

It converts the screen coordinate to the 3D space coordinate.


BOOL MQScene::GetVisibleFace(MQObject obj, BOOL *visible);

obj
An object
visible
[OUT] The visibility of each face
Return value
Succeed or failed to get

(new in Rev2.41)

It acquires whether faces are displayed on a view.

The 'visible' must have the same size of an array as the number of the faces acquired by MQObject::GetFaceCount(). By calling this function, the visibility of each face in the view will be stored in the 'visible'.

The visibility of the face is variable by the 'Hide' operation, with the option for the front face only, or whether the face is in the front of the viewpoint.


std::wstring MQScene::GetBackgroundImage();

Return value
Filename

(new in Rev4.71)

It returns a filename of a background image. It returns an empty string if a background image is not set.


BOOL MQScene::SetBackgroundImage(const std::wstring& name);

name
Filename
Return value
Succeed or failed

(new in Rev4.71)

It specifies a filename of a background image. A background image will be unset if 'name' is empty. It returns NULL if it failed to load a file.


BOOL MQScene::GetBackgroundImagePosition(float& x1, float& y1, float& x2, float& y2, float& rotation);

x1
X coordinate at the left
y1
Y coordinate at the top
x2
X coordinate at the right
y2
Y coordinate at the bottom
rotation
A rotation angle (in degree)
Return value
Succeed or failed

(new in Rev4.71)

It returns a position and an angle of a background image. It returns FALSE if a background image is not set.


BOOL MQScene::SetBackgroundImagePosition(float& x1, float& y1, float& x2, float& y2, float& rotation);

x1
X coordinate at the left
y1
Y coordinate at the top
x2
X coordinate at the right
y2
Y coordinate at the bottom
rotation
A rotation angle (in degree)
Return value
Succeed or failed

(new in Rev4.71)

It specifies a position and an angle of a background image. It returns FALSE if a background image is not set.