00001 #ifndef RC_NODE_H
00002 #define RC_NODE_H
00003
00004
00005 typedef enum {
00006
00007 NODE_CAMERA = 0,
00008 NODE_GROUP,
00009 NODE_LIGHT,
00010 NODE_WORLD,
00011 NODE_GEOMETRY,
00012
00013 NODE_TYPE_LAST
00014
00015 } NodeType_t;
00016
00017 static char *NodeName[] = {
00018 "Camera",
00019 "Group",
00020 "Light",
00021 "World",
00022 "Geometry",
00023 ""
00024 };
00025
00026
00027
00028 class Node {
00029 friend class SceneGraph;
00030 friend class Transformable;
00031 friend class State;
00032 friend class Light;
00033 friend class Geometry;
00034
00035
00036
00037 protected:
00038 Node(
00039 const char *nname,
00040 NodeType_t ntype
00041 );
00042
00047 virtual ~Node();
00048
00049 public:
00051 void renderAll();
00052
00054 void setName(
00055 char *nname
00056 );
00057
00059 u32 getChildrenCount() const;
00060
00065 void attachChild(
00066 Node *node
00067 );
00068
00070 void detachChild(
00071 Node *node
00072 );
00073
00075 void detachFromParent();
00076
00081 Node *getChild(
00082 u32 index
00083 );
00084
00089 Node *getChild(
00090 char *search_name,
00091 u32 max_depth
00092 );
00093
00095 Node *getNextSibling();
00096
00098 Node *getParent();
00099
00105 void setActive(
00106 bool active
00107 );
00108
00114 void setVisible(
00115 bool visible
00116 );
00117
00119 char *getName();
00120
00122 NodeType_t getNodeType() const;
00123
00130 Node *duplicate(
00131 char *new_name,
00132 bool recursively
00133
00134
00135 );
00136
00137 bool isTransformable();
00138
00139
00140
00141
00142
00143 virtual void logInfo();
00144
00145 protected:
00146
00147
00148 virtual void drawSelf() { }
00149
00150 virtual Node *duplicateSelf();
00151
00152 virtual void detached() { }
00153
00154 static char *getNewNodeName(
00155 char *buf,
00156 char *base,
00157 NodeType_t type
00158 );
00159
00160 void logNodeInfo();
00161
00162
00163
00164
00165 protected:
00166 char *name;
00167 NodeType_t type;
00168
00169 Node *parent;
00170 Node *firstChild;
00171 Node *next;
00172 u16 nChildren;
00173
00174 bool is_transformable;
00175
00176 bool broken;
00177
00178 public:
00179 bool isActive;
00180 bool isVisible;
00181
00182 Auxiliary auxiliary;
00183
00184 };
00185
00186
00187
00188
00189 #endif