Viewobject (lx-viewobject.hpp)
Contents
- 1 ILxViewObject
- 1.1 (1) SDK: LXu_VIEWOBJECT, etc. defines
- 1.2 (2) SDK: LXiVIEWPASS_BBOX_FAST, etc. defines
- 1.3 (3) SDK: ViewObject::TestMode
- 1.4 (4) SDK: ViewObject::Flags
- 1.5 (5) SDK: LXfVIEWOBJECT_NOTHREADS, etc. defines
- 1.6 (6) SDK: ViewObject::Generate
- 1.7 (7) SDK: ViewObject::Count
- 1.8 (8) SDK: ViewObject::ByIndex
- 1.9 (9) SDK: ViewObject::ByView
- 1.10 (10) SDK: empty ViewObject User Class
- 1.11 (11) PY: empty ViewObject user class
- 2 Channel
ILxViewObject
The ILxViewObject is used to generate passes that are used for drawing. It is usually generated by a modifier attached to an item that wishes to draw. At draw time, the passes (also ILxViewObjects) are generated and passed to the drawing loop.
(1) SDK: LXu_VIEWOBJECT, etc. defines
#define LXu_VIEWOBJECT "81C986D1-A7BA-4278-B060-E784779F5C36" #define LXa_VIEWOBJECT "viewobject"
BBOX_FAST | This is the simplest draw type. This bounding box should be fast to generate and can be used until a slower bounding box is calculated. |
BBOX | This pass represents a bounding box. In most cases, this will be identical to BBOX_FAST, but in some cases may be slower to calculate. |
WIREFRAME | The wireframe pass is a line drawing of the surface wireframe. |
SURFACE | The surface pass is triangles with normals. |
TEXTURED | The textured pass is triangles, with normals and UV coordinates. |
(2) SDK: LXiVIEWPASS_BBOX_FAST, etc. defines
#define LXiVIEWPASS_BBOX_FAST 0 #define LXiVIEWPASS_BBOX 1 #define LXiVIEWPASS_WIREFRAME 2 #define LXiVIEWPASS_SURFACE 3 #define LXiVIEWPASS_TEXTURED 4 #define LXiVIEWPASS_COUNT 5
The TestMode function is used to test if a draw pass type is available. It is called with a single type, such as BBox or Surface. If the function returns LXe_TRUE, it has been generated and is available. If the function returns LXe_FALSE, the Generate function should be called to generate that data. The function can also return LXe_NOTREADY to specify that the ViewObject is working on generating the data in a thread, or LXe_NOTAVAILABLE if the requested data is not supported.
(3) SDK: ViewObject::TestMode
LXxMETHOD( LxResult, TestMode) ( LXtObjectID self, unsigned int type);
The Flags method allows the ViewObject to declare some properties that determine how it should be evaluated.
(4) SDK: ViewObject::Flags
LXxMETHOD( unsigned int, Flags) ( LXtObjectID self);
NOTHREADS | The ViewObject data will be generated in a single thread. |
PERVIEW | The ViewObject drawing varies per viewport, and seperate passes should be generated for each view. |
(5) SDK: LXfVIEWOBJECT_NOTHREADS, etc. defines
#define LXfVIEWOBJECT_NOTHREADS 0x01 #define LXfVIEWOBJECT_PERVIEW 0x02
If the TestMode function has declared that work needs to be done to generate the ViewObject data, the Generate function will be called. It is expected to generate new draw passes of the requested type. This function may be called from threads if that is supported.
(6) SDK: ViewObject::Generate
LXxMETHOD( void, Generate) ( LXtObjectID self, unsigned int type);
The Count method is expected to return the number of available draw passes of the requested type.
(7) SDK: ViewObject::Count
LXxMETHOD( unsigned int, Count) ( LXtObjectID self, unsigned int type);
The ByIndex method is expected to return draw passes by index of the requested type.
(8) SDK: ViewObject::ByIndex
LXxMETHOD( LxResult, ByIndex) ( LXtObjectID self, unsigned int type, unsigned int index, void **ppvObj);
If the ViewObject drawing varies per viewport, this function will be called. It is expected to return a copy of itself, configured to generate draw passes for the provided viewport.
(9) SDK: ViewObject::ByView
LXxMETHOD( LxResult, ByView) ( LXtObjectID self, LXtObjectID view, void **ppvObj);
(10) SDK: empty ViewObject User Class
Empty View Object Python user class.
(11) PY: empty ViewObject user class
pass
Channel
Items declare that they can provide a ViewObject with a package server tag giving the name of the channel that contains the ILxViewObject. Read in an evaluated context, this will be a ValueReference object channel holding the ILxViewObject.
(12) SDK: LXsPKG_VIEWOBJECT_CHANNEL define
#define LXsPKG_VIEWOBJECT_CHANNEL "viewObject.channel"