| 97 | | |
| 98 | | |
| 99 | | === !VisitorExpansion.txt === |
| 100 | | |
| 101 | | The visitor expansion file provides a way to link in visitor |
| 102 | | definitions on for the scene graph. |
| 103 | | |
| 104 | | If your library defines a new node type you simple specify the |
| 105 | | namespace path to the node in this file. |
| 106 | | |
| 107 | | {{{ |
| 108 | | Scene/MyNode |
| 109 | | }}} |
| 110 | | |
| 111 | | The build system will now generate stub code for the |
| 112 | | ISceneNodeVisitor and sub classes can therefor define traversal |
| 113 | | operation on the new node. |
| 114 | | |
| 115 | | The generated files are {{{src/Scene/ISceneNodeVisitor.h}}} and |
| 116 | | {{{src/Scene/ISceneNodeVisitor.cpp}}} and they are generated by |
| 117 | | [browser:src/Scene/ISceneNodeVisitor.h.tpl] and |
| 118 | | [browser:src/Scene/ISceneNodeVisitor.cpp.tpl] respectively. |
| 119 | | |
| 120 | | Notice that if you make a change to ''!VisitorExpansion.txt'' you |
| 121 | | need to rebuild the source with cmake. ({{{./make.sh rebuild}}}). |
| | 142 | === Creating new scene nodes === |
| | 143 | |
| | 144 | The {{{OE_ADD_SCENE_NODES}}} macro provides a way to add scene nodes |
| | 145 | to the existing core scene graph. ''All uses of this macro '''must''' |
| | 146 | occur in your extensions {{{Setup.cmake}}} file!'' |
| | 147 | |
| | 148 | If your library defines a new node type you simple specify the |
| | 149 | namespace path to the node in this macro. If you have {{{MyNode1}}} |
| | 150 | and {{{MyNode2}}} and your extension is called |
| | 151 | {{{Extensions_MyExtension}}} you would write the following in |
| | 152 | {{{Setup.cmake}}}. |
| | 153 | |
| | 154 | {{{ |
| | 155 | OE_ADD_SCENE_NODES(Extensions_MyExtension |
| | 156 | Scene/MyNode1 |
| | 157 | Scene/MyNode2 |
| | 158 | ) |
| | 159 | }}} |
| | 160 | |
| | 161 | The build system will now generate stub code for various node |
| | 162 | operations, such as {{{Clone}}}, {{{GetClassName}}} and so on, |
| | 163 | along with stubs for the |
| | 164 | ISceneNodeVisitor, allowing sub classes to define traversal |
| | 165 | operations on the new node. |
| | 166 | |
| | 167 | The generated files are {{{src/Scene/SceneNodes.h}}} and |
| | 168 | {{{src/Scene/SceneNodes.def}}} and they are generated by |
| | 169 | {{{src/Scene/SceneNodes.h.tpl}}} and |
| | 170 | {{{src/Scene/SceneNodes.def.tpl}}} respectively. |