Interface sandy.core.face.IPolygon

Description

Face

Method Index

createNormale(), destroy(), enableEvents(), getBackSkin(), getMaxDepth(), getMinDepth(), getSkin(), getTextureMatrix(), getUVCoords(), getVertices(), getZAverage(), isVisible(), refresh(), render(), setBackSkin(), setNormale(), setSkin(), setUVCoords(), swapCulling(), updateTextureMatrix()

Method Detail

getUVCoords

public function getUVCoords(Void):Array

setUVCoords

public function setUVCoords(pUv1:UVCoord, pUv2:UVCoord, pUv3:UVCoord):Void

createNormale

public function createNormale(Void):Vector

create the normal vector of the Face

This method must be called when a face is created. Quite often a single normal vector is used for many faces , so in this case, use sandy.core.face.IPolygon.setNotmale(Vertex)

A vertex is returned rather than a mb.sandy.core.data.Vector4 because it migth be useful to have it transform coordinates.

Return

Vertex the normal vector

enableEvents

public function enableEvents(b:Boolean):Void

Enable or not the events onPress, onRollOver and onRollOut with this face.

Parameters

bBoolean True to enable the events, false otherwise.

isVisible

public function isVisible(Void):Boolean

Say if the face is visible by the camera or not

This method is called during the object rendering, it is very useful to prevent from displaying unvisible faces.

If the user wants to display unvisible faces, he must use mb.sandy.core.Object3D#drawAllFaces property.

Return

Boolean a boolean set at true if the face is visible, false otherwise.

render

public function render(mc:MovieClip, pS:Skin, pSb:Skin):Void

Display the Face of the Object3D into a MovieClip.

This method is called when we want to display the face. It calls it skin mb.sandy.skin.Skin specific rendering method, depending of the type of the face

mc represent the MovieClip where the Face must be displayed.

Parameters

mcThe MovieClip

setNormale

public function setNormale(n:Vector):Void

Set the normale vector of the face. Useful when the normale for this face is alleady computed

This method is called mainly in primitives, when th object is created. It can saves some CPU calculations when somes faces have the same normale vector

n represent the normale vector, but here as a Vertex, because the Vertex class is used in the engine.

Parameters

nthe normal Vector

setSkin

public function setSkin(s:Skin):Void

Set skin of this face.

This method is called when the object is changing its skin. You can also call directly this method to apply a specific skin to a face, if you have the reference of the face

s represent the skin which is will be applied during the rendering.

Parameters

sthe Skin

setBackSkin

public function setBackSkin(s:Skin):Void

Set skin to the back of this face.

This method is called when the object is changing its back skin. You can also call directly this method to apply a specific skin to a face, if you have the reference of the face

s represent the skin which is will be applied during the rendering.

Parameters

sthe Skin

getSkin

public function getSkin(Void):Skin

returns skin of this face.

This method is called by Object3D.getSkin

Return

The Skin of the Face

updateTextureMatrix

public function updateTextureMatrix(s:Skin):Void

Update the texture matrix in case that one of its vertex has been changed

getTextureMatrix

public function getTextureMatrix(Void):Matrix

Returns the precomputed matrix for the texture algorithm.

getBackSkin

public function getBackSkin(Void):Skin

returns back skin of this face.

This method is called by Object3D.getBackSkin

Return

The Skin of the Face

getZAverage

public function getZAverage(Void):Number

Retusn the average of depth of this face

This method is called when the object is rendering, and it's very useful to do the z-sorting

Return

a Number containing the average

getMinDepth

public function getMinDepth(Void):Number

Returns the min depth of its vertex.

Parameters

Void

Return

number the minimum depth of it's vertex

getMaxDepth

public function getMaxDepth(Void):Number

Returns the max depth of its vertex.

Parameters

Void

Return

number the maximum depth of it's vertex

refresh

public function refresh(mc:MovieClip, pS:Skin, pSb:Skin):Void

Force the face to refresh. Mainly used when skin has changed and the object didn't move. In that case we just need to refresh the movieclip, not to compute it again.

Parameters

swapCulling

public function swapCulling(Void):Void

This method change the value of the "normal" clipping side.

Parameters

Void

getVertices

public function getVertices(Void):Array

Allows you to get the vertex of the face. Very usefull when you want to make some calculation on a face after it has been clicked.

Parameters

Void

Return

Array The array of vertex.

destroy

public function destroy(Void):Void

Destroy the face instance and remove all the event it was listening.