GuiObjectView

consoledoc.h

GUI control which displays a 3D model.

More...

Model

filename

The object model shape file to show in the view.

string

The skin to use on the object model.

Animation

string

The animation sequence to play on the model.

Mounting

filename

Optional shape file to mount on the primary model (e.g. weapon).

string

Skin name used on mounted shape file.

string

Name of node on primary model to which to mount the secondary shape.

Lighting

LinearColorF

Diffuse color of the sunlight used to render the model.

LinearColorF

Ambient color of the sunlight used to render the model.

Point3F

Direction from which the model is illuminated.

Camera

float

Distance from which to render the model.

float

Maxiumum distance to which the camera can be zoomed out.

float

Minimum distance below which the camera will not zoom in further.

float

Multiplier for mouse camera operations.

Point3F

Set the camera rotation.

Callbacks

void

Called whenever the mouse enters the control.

void

Called whenever the mouse leaves the control.

Public Functions

float

Return the current multiplier for camera zooming and rotation.

string

Return the model displayed in this view.

string

Return the name of the mounted model.

string
getMountSkin(int param1, int param2)

Return the name of skin used on the mounted model.

float

Return the current distance at which the camera orbits the object.

string

Return the name of skin used on the primary model.

void
setCameraSpeed(float factor)

Sets the multiplier for the camera rotation and zoom speed.

void
setLightAmbient(LinearColorF color)

Set the light ambient color on the sun object used to render the model.

void
setLightColor(LinearColorF color)

Set the light color on the sun object used to render the model.

void
setLightDirection(Point3F direction)

Set the light direction from which to light the model.

void
setModel(string shapeName)

Sets the model to be displayed in this control.

void
setMount(string shapeName, string mountNodeIndexOrName)

Mounts the given model to the specified mount point of the primary model displayed in this control.

void
setMountedModel(string shapeName)

Sets the model to be mounted on the primary model.

void
setMountSkin(string skinName)

Sets the skin to use on the mounted model.

void
setOrbitDistance(float distance)

Sets the distance at which the camera orbits the object. Clamped to the acceptable range defined in the class by min and max orbit distances.

void
setSeq(string indexOrName)

Sets the animation to play for the viewed object.

void
setSkin(string skinName)

Sets the skin to use on the model being displayed.

Detailed Description

GUI control which displays a 3D model.

Model displayed in the control can have other objects mounted onto it, and the light settings can be adjusted.

new GuiObjectView(ObjectPreview)
{
   shapeFile = "art/shapes/items/kit/healthkit.dts";
   mountedNode = "mount0";
   lightColor = "1 1 1 1";
   lightAmbient = "0.5 0.5 0.5 1";
   lightDirection = "0 0.707 -0.707";
   orbitDiststance = "2";
   minOrbitDiststance = "0.917688";
   maxOrbitDiststance = "5";
   cameraSpeed = "0.01";
   cameraZRot = "0";
   forceFOV = "0";
   reflectPriority = "0";
};

Model

filename shapeFile 

The object model shape file to show in the view.

string skin 

The skin to use on the object model.

Animation

string animSequence 

The animation sequence to play on the model.

Mounting

filename mountedShapeFile 

Optional shape file to mount on the primary model (e.g. weapon).

string mountedSkin 

Skin name used on mounted shape file.

string mountedNode 

Name of node on primary model to which to mount the secondary shape.

Lighting

LinearColorF lightColor 

Diffuse color of the sunlight used to render the model.

LinearColorF lightAmbient 

Ambient color of the sunlight used to render the model.

Point3F lightDirection 

Direction from which the model is illuminated.

Camera

float orbitDiststance 

Distance from which to render the model.

float minOrbitDiststance 

Maxiumum distance to which the camera can be zoomed out.

float maxOrbitDiststance 

Minimum distance below which the camera will not zoom in further.

float cameraSpeed 

Multiplier for mouse camera operations.

Point3F cameraRotation 

Set the camera rotation.

Callbacks

onMouseEnter()

Called whenever the mouse enters the control.

// The mouse has entered the control, causing the callback to occur
GuiObjectView::onMouseEnter(%this)
   {
      // Code to run when the mouse enters this control
   }

onMouseLeave()

Called whenever the mouse leaves the control.

// The mouse has left the control, causing the callback to occur
GuiObjectView::onMouseLeave(%this)
   {
      // Code to run when the mouse leaves this control
   }

Public Functions

getCameraSpeed()

Return the current multiplier for camera zooming and rotation.

// Request the current camera zooming and rotation multiplier value
%multiplier = %thisGuiObjectView.getCameraSpeed();

return:

Camera zooming / rotation multiplier value.

getModel()

Return the model displayed in this view.

// Request the displayed model name from the GuiObjectView object.
%modelName = %thisGuiObjectView.getModel();

return:

Name of the displayed model.

getMountedModel()

Return the name of the mounted model.

// Request the name of the mounted model from the GuiObjectView object
%mountedModelName = %thisGuiObjectView.getMountedModel();

return:

Name of the mounted model.

getMountSkin(int param1, int param2)

Return the name of skin used on the mounted model.

// Request the skin name from the model mounted on to the main model in the control
%mountModelSkin = %thisGuiObjectView.getMountSkin();

return:

Name of the skin used on the mounted model.

getOrbitDistance()

Return the current distance at which the camera orbits the object.

// Request the current orbit distance
%orbitDistance = %thisGuiObjectView.getOrbitDistance();

return:

The distance at which the camera orbits the object.

getSkin()

Return the name of skin used on the primary model.

// Request the name of the skin used on the primary model in the control
%skinName = %thisGuiObjectView.getSkin();

return:

Name of the skin used on the primary model.

setCameraSpeed(float factor)

Sets the multiplier for the camera rotation and zoom speed.

Parameters:

factor

Multiplier for camera rotation and zoom speed.

// Set the factor value
%factor = "0.75";

// Inform the GuiObjectView object to set the camera speed.
%thisGuiObjectView.setCameraSpeed(%factor);

setLightAmbient(LinearColorF color)

Set the light ambient color on the sun object used to render the model.

Parameters:

color

Ambient color of sunlight.

// Define the sun ambient color value
%color = "1.0 0.4 0.6";

// Inform the GuiObjectView object to set the sun ambient color to the requested value
%thisGuiObjectView.setLightAmbient(%color);

setLightColor(LinearColorF color)

Set the light color on the sun object used to render the model.

Parameters:

color

Color of sunlight.

// Set the color value for the sun
%color = "1.0 0.4 0.5";

// Inform the GuiObjectView object to change the sun color to the defined value
%thisGuiObjectView.setLightColor(%color);

setLightDirection(Point3F direction)

Set the light direction from which to light the model.

Parameters:

direction

XYZ direction from which the light will shine on the model

// Set the light direction
%direction = "1.0 0.2 0.4"

// Inform the GuiObjectView object to change the light direction to the defined value
%thisGuiObjectView.setLightDirection(%direction);

setModel(string shapeName)

Sets the model to be displayed in this control.

Parameters:

shapeName

Name of the model to display.

// Define the model we want to display
%shapeName = "gideon.dts";

// Tell the GuiObjectView object to display the defined model
%thisGuiObjectView.setModel(%shapeName);

setMount(string shapeName, string mountNodeIndexOrName)

Mounts the given model to the specified mount point of the primary model displayed in this control.

Detailed description

Parameters:

shapeName

Name of the model to mount.

mountNodeIndexOrName

Index or name of the mount point to be mounted to. If index, corresponds to "mountN" in your shape where N is the number passed here.

// Set the shapeName to mount
%shapeName = "GideonGlasses.dts"

// Set the mount node of the primary model in the control to mount the new shape at
%mountNodeIndexOrName = "3";
//OR:
%mountNodeIndexOrName = "Face";

// Inform the GuiObjectView object to mount the shape at the specified node.
%thisGuiObjectView.setMount(%shapeName,%mountNodeIndexOrName);

setMountedModel(string shapeName)

Sets the model to be mounted on the primary model.

Parameters:

shapeName

Name of the model to mount.

// Define the model name to mount
%modelToMount = "GideonGlasses.dts";

// Inform the GuiObjectView object to mount the defined model to the existing model in the control
%thisGuiObjectView.setMountedModel(%modelToMount);

setMountSkin(string skinName)

Sets the skin to use on the mounted model.

Parameters:

skinName

Name of the skin to set on the model mounted to the main model in the control

// Define the name of the skin
%skinName = "BronzeGlasses";

// Inform the GuiObjectView Control of the skin to use on the mounted model
%thisGuiObjectViewCtrl.setMountSkin(%skinName);

setOrbitDistance(float distance)

Sets the distance at which the camera orbits the object. Clamped to the acceptable range defined in the class by min and max orbit distances.

Detailed description

Parameters:

distance

The distance to set the orbit to (will be clamped).

// Define the orbit distance value
%orbitDistance = "1.5";

// Inform the GuiObjectView object to set the orbit distance to the defined value
%thisGuiObjectView.setOrbitDistance(%orbitDistance);

setSeq(string indexOrName)

Sets the animation to play for the viewed object.

Parameters:

indexOrName

The index or name of the animation to play.

// Set the animation index value, or animation sequence name.
%indexVal = "3";
//OR:
%indexVal = "idle";

// Inform the GuiObjectView object to set the animation sequence of the object in the control.
%thisGuiObjectVew.setSeq(%indexVal);

setSkin(string skinName)

Sets the skin to use on the model being displayed.

Parameters:

skinName

Name of the skin to use.

// Define the skin we want to apply to the main model in the control
%skinName = "disco_gideon";

// Inform the GuiObjectView control to update the skin the to defined skin
%thisGuiObjectView.setSkin(%skinName);