r3frmapp
real/raytr/r3frmapp.h
r3raytr
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).
r3Frhob
R3CLID_FRHOB
r3Frmapping
R3CLID_FRMAPPING - 164
LINKTOSOURCE, OPTIMIZEMAPPING, ENUMINPUTCHANNELS, ENUMOUTPUTCHANNELS, PHASEQUERY, ENUMMAPPEDOBJECTS, REGISTEROUTPUTCHANNEL, ANALYZESCOPE, EVALMAPCOORDS,
SourceName, Priority, SrcBaseClass, Source, ImgX, ImgY, ImgW, ImgH, Hor, Projection, Matrix, FiniteDimensions, Scope, ScopeBlend, WeakProperty, EvaluateAlways, AutoLink,
int R3RegisterFrMappingClass(R3APP *app);
R3FRMM_LINKTOSOURCE
LINKTOSOURCE
R3FRMM_LINKTOSOURCE
R3LIST, addres of the list header to be searched from
obj.LINKTOSOURCE(p3);
Searches given object list, compares source name and stores address of the matching object
R3FRMM_OPTIMIZEMAPPING
OPTIMIZEMAPPING
R3FRMM_OPTIMIZEMAPPING
obj.OPTIMIZEMAPPING();
Signals that sources & mappings are ready, optimizations for rendering can be executed
R3FRMM_ENUMINPUTCHANNELS
ENUMINPUTCHANNELS
R3FRMM_ENUMINPUTCHANNELS
R3OBJ*, callback object
R3INT, phase mask. Only channels in defined phases will be reported. A particular phase is * indicated by 1<<phaseindex. 0xFFFFFFFF includes all phases.
R3INT, callback method
obj.ENUMINPUTCHANNELS(p1, p2, p3);
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
ENUMOUTPUTCHANNELS
R3FRMM_ENUMOUTPUTCHANNELS
R3OBJ*, callback object
R3INT, phase mask. Only channels in defined phases will be reported. A particular phase is * indicated by 1<<phaseindex. 0xFFFFFFFF includes all phases.
R3INT, callback method
obj.ENUMOUTPUTCHANNELS(p1, p2, p3);
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
PHASEQUERY
R3FRMM_PHASEQUERY
obj.PHASEQUERY();
Asks which material evaluation phases are being used * Normally mapping sends query to the material/effect linked to it
R3FRMM_ENUMMAPPEDOBJECTS
ENUMMAPPEDOBJECTS
R3FRMM_ENUMMAPPEDOBJECTS
obj.ENUMMAPPEDOBJECTS();
enumerates material etc. objects linked to this mapping * by R3SendMsgA(cbobj, cbmth, mappedobject);
R3FRMM_REGISTEROUTPUTCHANNEL
REGISTEROUTPUTCHANNEL
R3FRMM_REGISTEROUTPUTCHANNEL
obj.REGISTEROUTPUTCHANNEL();
R3FRMM_ANALYZESCOPE
ANALYZESCOPE
R3FRMM_ANALYZESCOPE
obj.ANALYZESCOPE();
R3FRMM_EVALMAPCOORDS
EVALMAPCOORDS
R3FRMM_EVALMAPCOORDS
R3VECTOR, point to be projected
R3VECTOR, the result of mapping is stored here.
obj.EVALMAPCOORDS(p1, p3);
Evluate mapping coordinate projection
SourceName
SourceName
R3FRMA_SourceName
String
char*
name of mapped object
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
Priority
R3FRMA_Priority
Integer
R3INT
evaluation priority -100...+100 - overrules hierarchical order.
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
SrcBaseClass
R3FRMA_SrcBaseClass
Integer
R3INT
the identifier of the library class of the source object. Systems using mapping objects can put the source class selector id to this attribute
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
Source
R3FRMA_Source
Object
R3OBJ**
read-only address of the pointer to the linked mapped source object
value = jsobj.GetSource();
R3OBJ** value;
R3GetAttrs(r3obj, R3FRMA_Source, &value, R3TAG_END);
ImgX
ImgX
R3FRMA_ImgX
Number
R3FLOAT
write_only, some mappings may be interested in camera specs
jsobj.SetImgX(value);
R3FLOAT value = ...;
R3SetAttrs(r3obj, R3FRMA_ImgX, value, R3TAG_END);
ImgY
ImgY
R3FRMA_ImgY
Number
R3FLOAT
y coord of top-left corner of image being rendered
jsobj.SetImgY(value);
R3FLOAT value = ...;
R3SetAttrs(r3obj, R3FRMA_ImgY, value, R3TAG_END);
ImgW
ImgW
R3FRMA_ImgW
Number
R3FLOAT
width of image (measured in plane at unit distance from camera)
jsobj.SetImgW(value);
R3FLOAT value = ...;
R3SetAttrs(r3obj, R3FRMA_ImgW, value, R3TAG_END);
ImgH
ImgH
R3FRMA_ImgH
Number
R3FLOAT
height of image
jsobj.SetImgH(value);
R3FLOAT value = ...;
R3SetAttrs(r3obj, R3FRMA_ImgH, value, R3TAG_END);
Hor
Hor
R3FRMA_Hor
camera orientation (position always in origin)
jsobj.SetHor(value);
R3VECTOR value = ...;
R3SetAttrs(r3obj, R3FRMA_Hor, value, R3TAG_END);
Projection
Projection
R3FRMA_Projection
Integer
R3INT
see types below
jsobj.SetProjection(value);
R3INT value = ...;
R3SetAttrs(r3obj, R3FRMA_Projection, value, R3TAG_END);
Matrix
Matrix
R3FRMA_Matrix
optional mat space coordinate transform
jsobj.SetMatrix(value);
R3MATRIX value = ...;
R3SetAttrs(r3obj, R3FRMA_Matrix, &value, R3TAG_END);
FiniteDimensions
FiniteDimensions
R3FRMA_FiniteDimensions
Integer
R3INT
see flags below
jsobj.SetFiniteDimensions(value);
R3INT value = ...;
R3SetAttrs(r3obj, R3FRMA_FiniteDimensions, value, R3TAG_END);
Scope
Scope
R3FRMA_Scope
Number
R3FLOAT
0..1
jsobj.SetScope(value);
R3FLOAT value = ...;
R3SetAttrs(r3obj, R3FRMA_Scope, value, R3TAG_END);
ScopeBlend
ScopeBlend
R3FRMA_ScopeBlend
Boolean
R3BOOL
enable blending by scope (default on)
jsobj.SetScopeBlend(value);
R3BOOL value = ...;
R3SetAttrs(r3obj, R3FRMA_ScopeBlend, value, R3TAG_END);
WeakProperty
WeakProperty
R3FRMA_WeakProperty
String
char*
char *channelname, for optimization purposes (read only). If not NULL this mapping should be ignored if the channel is already defined
value = jsobj.GetWeakProperty();
char* value;
R3GetAttrs(r3obj, R3FRMA_WeakProperty, &value, R3TAG_END);
EvaluateAlways
EvaluateAlways
R3FRMA_EvaluateAlways
Boolean
R3BOOL
if true mapping is evaluated also when the linked material is not found
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
AutoLink
R3FRMA_AutoLink
Boolean
R3BOOL
read only. By default TRUE so that frengine inserts mapping automatically to current geometry level objects. Sub classes may use custom linking principles.
value = jsobj.GetAutoLink();
R3BOOL value;
R3GetAttrs(r3obj, R3FRMA_AutoLink, &value, R3TAG_END);
Codes for Projection tag
R3FRMA_FiniteDimensions flags:
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