r3frmapp

r3frmapp

Class

real/raytr/r3frmapp.h

Library

r3raytr

Description:

Mapping rendering class. Mapping objects typically perform the following tasks: - They connect objects in the scene hierarcy to other objects in libraries such as the material library. In othwer words, mapping object maps a source object in a library to a number of target objects in the hierarchy. - Usually mapping objects perform a geometric transformation, such as linear transformation or computation of spherical coordinates. Evaluation of mapping objects is performed using R3FROM_EVALUATE and R3FROM_POSTEVALUATE. In both methods, parameter p3 is a ptr to a raysample object, which contains all parameter information in channels. p1 is an integer describing the shading phase. POSTEVALUATE is similar to EVALUATE, except that it is used only after a EVALUATE method and position in r3chasc channel has not changed after that; therefore, possible geometric transformation is not necessary to perform, because the raysample already contains the result. Mapping objects are evaluated in the same order as they were defined in the hierarchy - starting from root. Priority attribute overrules this: the higher the value, the earlier mapping will be evaluated (note hat mapping evaluated last has most control - it can replace values computed by earlier objects).

See Also

real/raytr/r3frhob.h

Super Class

r3Frhob

R3CLID_FRHOB

JavaScript

r3Frmapping

Class Identifier

R3CLID_FRMAPPING - 164

Methods

LINKTOSOURCE, OPTIMIZEMAPPING, ENUMINPUTCHANNELS, ENUMOUTPUTCHANNELS, PHASEQUERY, ENUMMAPPEDOBJECTS, REGISTEROUTPUTCHANNEL, ANALYZESCOPE, EVALMAPCOORDS,

Attributes

SourceName, Priority, SrcBaseClass, Source, ImgX, ImgY, ImgW, ImgH, Hor, Projection, Matrix, FiniteDimensions, Scope, ScopeBlend, WeakProperty, EvaluateAlways, AutoLink,

Registration

int R3RegisterFrMappingClass(R3APP *app);

R3FRMM_LINKTOSOURCE

Method

LINKTOSOURCE

Identifier

R3FRMM_LINKTOSOURCE

Param 3:

R3LIST, addres of the list header to be searched from

JavaScript

obj.LINKTOSOURCE(p3);

Description

Searches given object list, compares source name and stores address of the matching object

R3FRMM_OPTIMIZEMAPPING

Method

OPTIMIZEMAPPING

Identifier

R3FRMM_OPTIMIZEMAPPING

JavaScript

obj.OPTIMIZEMAPPING();

Description

Signals that sources & mappings are ready, optimizations for rendering can be executed

R3FRMM_ENUMINPUTCHANNELS

Method

ENUMINPUTCHANNELS

Identifier

R3FRMM_ENUMINPUTCHANNELS

Param 1:

R3OBJ*, callback object

Param 2:

R3INT, phase mask. Only channels in defined phases will be reported. A particular phase is * indicated by 1<<phaseindex. 0xFFFFFFFF includes all phases.

Param 3:

R3INT, callback method

JavaScript

obj.ENUMINPUTCHANNELS(p1, p2, p3);

Description

report channels that are referenced as inputs (by the mapping itself or linked sub objects) * in EVALUATE method using a given callback method to the given callback object. * Some systems may want to know in advance (e.g for optimization & resource allocation) * which channels will be referenced as inputs by the object. The callback goes as: * R3SendMsgA2(p1, p3, usedphases, channelname) * where usedphase is the union of all bits (1<<phaseindex) where channel is used (use value from * caller if unknown).

R3FRMM_ENUMOUTPUTCHANNELS

Method

ENUMOUTPUTCHANNELS

Identifier

R3FRMM_ENUMOUTPUTCHANNELS

Param 1:

R3OBJ*, callback object

Param 2:

R3INT, phase mask. Only channels in defined phases will be reported. A particular phase is * indicated by 1<<phaseindex. 0xFFFFFFFF includes all phases.

Param 3:

R3INT, callback method

JavaScript

obj.ENUMOUTPUTCHANNELS(p1, p2, p3);

Description

report channels affected (by the mapping itself or linked sub objects) in EVALUATE method using a given callback method to the given callback object. Some systems may want to know in advance (e.g for optimization & resource allocation) which channels will be affected by the object.

R3FRMM_PHASEQUERY

Method

PHASEQUERY

Identifier

R3FRMM_PHASEQUERY

JavaScript

obj.PHASEQUERY();

Description

Asks which material evaluation phases are being used * Normally mapping sends query to the material/effect linked to it

R3FRMM_ENUMMAPPEDOBJECTS

Method

ENUMMAPPEDOBJECTS

Identifier

R3FRMM_ENUMMAPPEDOBJECTS

JavaScript

obj.ENUMMAPPEDOBJECTS();

Description

enumerates material etc. objects linked to this mapping * by R3SendMsgA(cbobj, cbmth, mappedobject);

R3FRMM_REGISTEROUTPUTCHANNEL

Method

REGISTEROUTPUTCHANNEL

Identifier

R3FRMM_REGISTEROUTPUTCHANNEL

JavaScript

obj.REGISTEROUTPUTCHANNEL();

Description

R3FRMM_ANALYZESCOPE

Method

ANALYZESCOPE

Identifier

R3FRMM_ANALYZESCOPE

JavaScript

obj.ANALYZESCOPE();

Description

R3FRMM_EVALMAPCOORDS

Method

EVALMAPCOORDS

Identifier

R3FRMM_EVALMAPCOORDS

Param 1:

R3VECTOR, point to be projected

Param 3:

R3VECTOR, the result of mapping is stored here.

JavaScript

obj.EVALMAPCOORDS(p1, p3);

Description

Evluate mapping coordinate projection

SourceName

Attribute

SourceName

Identifier

R3FRMA_SourceName

JavaScript type

String

C type

char*

Description

name of mapped object

Syntax


jsobj.SetSourceName(value);
value = jsobj.GetSourceName();


char* value = ...;
R3SetAttrs(r3obj, R3FRMA_SourceName, value, R3TAG_END);
char* value;
R3GetAttrs(r3obj, R3FRMA_SourceName, &value, R3TAG_END);

Priority

Attribute

Priority

Identifier

R3FRMA_Priority

JavaScript type

Integer

C type

R3INT

Description

evaluation priority -100...+100 - overrules hierarchical order.

Syntax


jsobj.SetPriority(value);
value = jsobj.GetPriority();


R3INT value = ...;
R3SetAttrs(r3obj, R3FRMA_Priority, value, R3TAG_END);
R3INT value;
R3GetAttrs(r3obj, R3FRMA_Priority, &value, R3TAG_END);

SrcBaseClass

Attribute

SrcBaseClass

Identifier

R3FRMA_SrcBaseClass

JavaScript type

Integer

C type

R3INT

Description

the identifier of the library class of the source object. Systems using mapping objects can put the source class selector id to this attribute

Syntax


jsobj.SetSrcBaseClass(value);
value = jsobj.GetSrcBaseClass();


R3INT value = ...;
R3SetAttrs(r3obj, R3FRMA_SrcBaseClass, value, R3TAG_END);
R3INT value;
R3GetAttrs(r3obj, R3FRMA_SrcBaseClass, &value, R3TAG_END);

Source

Attribute

Source

Identifier

R3FRMA_Source

JavaScript type

Object

C type

R3OBJ**

Description

read-only address of the pointer to the linked mapped source object

Syntax


value = jsobj.GetSource();


R3OBJ** value;
R3GetAttrs(r3obj, R3FRMA_Source, &value, R3TAG_END);

ImgX

Attribute

ImgX

Identifier

R3FRMA_ImgX

JavaScript type

Number

C type

R3FLOAT

Description

write_only, some mappings may be interested in camera specs

Syntax


jsobj.SetImgX(value);


R3FLOAT value = ...;
R3SetAttrs(r3obj, R3FRMA_ImgX, value, R3TAG_END);

ImgY

Attribute

ImgY

Identifier

R3FRMA_ImgY

JavaScript type

Number

C type

R3FLOAT

Description

y coord of top-left corner of image being rendered

Syntax


jsobj.SetImgY(value);


R3FLOAT value = ...;
R3SetAttrs(r3obj, R3FRMA_ImgY, value, R3TAG_END);

ImgW

Attribute

ImgW

Identifier

R3FRMA_ImgW

JavaScript type

Number

C type

R3FLOAT

Description

width of image (measured in plane at unit distance from camera)

Syntax


jsobj.SetImgW(value);


R3FLOAT value = ...;
R3SetAttrs(r3obj, R3FRMA_ImgW, value, R3TAG_END);

ImgH

Attribute

ImgH

Identifier

R3FRMA_ImgH

JavaScript type

Number

C type

R3FLOAT

Description

height of image

Syntax


jsobj.SetImgH(value);


R3FLOAT value = ...;
R3SetAttrs(r3obj, R3FRMA_ImgH, value, R3TAG_END);

Hor

Attribute

Hor

Identifier

R3FRMA_Hor

Type

r3Vect

Description

camera orientation (position always in origin)

Syntax


jsobj.SetHor(value);


R3VECTOR value = ...;
R3SetAttrs(r3obj, R3FRMA_Hor, value, R3TAG_END);

Projection

Attribute

Projection

Identifier

R3FRMA_Projection

JavaScript type

Integer

C type

R3INT

Description

see types below

Syntax


jsobj.SetProjection(value);


R3INT value = ...;
R3SetAttrs(r3obj, R3FRMA_Projection, value, R3TAG_END);

Matrix

Attribute

Matrix

Identifier

R3FRMA_Matrix

Type

r3Matrix

Description

optional mat space coordinate transform

Syntax


jsobj.SetMatrix(value);


R3MATRIX value = ...;
R3SetAttrs(r3obj, R3FRMA_Matrix, &value, R3TAG_END);

FiniteDimensions

Attribute

FiniteDimensions

Identifier

R3FRMA_FiniteDimensions

JavaScript type

Integer

C type

R3INT

Description

see flags below

Syntax


jsobj.SetFiniteDimensions(value);


R3INT value = ...;
R3SetAttrs(r3obj, R3FRMA_FiniteDimensions, value, R3TAG_END);

Scope

Attribute

Scope

Identifier

R3FRMA_Scope

JavaScript type

Number

C type

R3FLOAT

Description

0..1

Syntax


jsobj.SetScope(value);


R3FLOAT value = ...;
R3SetAttrs(r3obj, R3FRMA_Scope, value, R3TAG_END);

ScopeBlend

Attribute

ScopeBlend

Identifier

R3FRMA_ScopeBlend

JavaScript type

Boolean

C type

R3BOOL

Description

enable blending by scope (default on)

Syntax


jsobj.SetScopeBlend(value);


R3BOOL value = ...;
R3SetAttrs(r3obj, R3FRMA_ScopeBlend, value, R3TAG_END);

WeakProperty

Attribute

WeakProperty

Identifier

R3FRMA_WeakProperty

JavaScript type

String

C type

char*

Description

char *channelname, for optimization purposes (read only). If not NULL this mapping should be ignored if the channel is already defined

Syntax


value = jsobj.GetWeakProperty();


char* value;
R3GetAttrs(r3obj, R3FRMA_WeakProperty, &value, R3TAG_END);

EvaluateAlways

Attribute

EvaluateAlways

Identifier

R3FRMA_EvaluateAlways

JavaScript type

Boolean

C type

R3BOOL

Description

if true mapping is evaluated also when the linked material is not found

Syntax


jsobj.SetEvaluateAlways(value);
value = jsobj.GetEvaluateAlways();


R3BOOL value = ...;
R3SetAttrs(r3obj, R3FRMA_EvaluateAlways, value, R3TAG_END);
R3BOOL value;
R3GetAttrs(r3obj, R3FRMA_EvaluateAlways, &value, R3TAG_END);

AutoLink

Attribute

AutoLink

Identifier

R3FRMA_AutoLink

JavaScript type

Boolean

C type

R3BOOL

Description

read only. By default TRUE so that frengine inserts mapping automatically to current geometry level objects. Sub classes may use custom linking principles.

Syntax


value = jsobj.GetAutoLink();


R3BOOL value;
R3GetAttrs(r3obj, R3FRMA_AutoLink, &value, R3TAG_END);

Codes for Projection tag

R3FRM_PERSPECTIVE
R3FRM_ORTHOGRAPHIC

R3FRMA_FiniteDimensions flags:

R3FRM_FINITE_X
R3FRM_FINITE_Y
R3FRM_FINITE_Z

This message is optionally given in p2 for EVALUATE method. Base class passes it to the child objects

Mapping base class provides useful csys prepare function