Home | Namespaces | Hierarchy | Alphabetical List | Class list | Files | Namespace Members | Class members | File members

GridSceneNode.hpp

Go to the documentation of this file.
00001 // Copyright (c) 2007-2008 Tomer Nosrati
00002 // This file is part of the "NUSoftware Game Engine".
00003 // For conditions of distribution and use, see copyright notice in nge.hpp
00004 
00005 #pragma once
00006 #ifndef __GRID_SCENE_NODE_H__
00007 #define __GRID_SCENE_NODE_H__
00008 
00009 #include "Irrlicht/irrlicht.h"
00010 
00011 using namespace irr;
00012 using namespace irr::core;
00013 using namespace irr::scene;
00014 using namespace irr::video;
00015 
00016 namespace nge
00017 {
00018         namespace game
00019         {
00020 
00022 
00027                 class GridSceneNode : public ISceneNode
00028                 {
00029                 public:
00031                         GridSceneNode(ISceneNode* parent, ISceneManager* smgr, s32 id = -1, 
00032                                 u32 Spacing = 8, u32 Size = 1024, SColor GridColor = SColor(255,128,128,128), 
00033                                 u32 AccentLineOffset = 8, SColor AccentGridColor = SColor(255,192,192,192), 
00034                                 bool AxisLineState = false) : ISceneNode(parent, smgr, id), 
00035                                 m_Spacing(Spacing), m_Size(Size), m_GridColor(GridColor), 
00036                                 m_AccentGridColor(AccentGridColor), m_AccentLineOffset(AccentLineOffset), 
00037                                 m_AxisLineState(AxisLineState), m_XLineColor(SColor(255,255,0,0)), 
00038                                 m_ZLineColor(SColor(255,0,0,255))
00039                         {
00040                                 // Set the material
00041                                 m_Material.Wireframe = false;
00042                                 m_Material.Lighting = false;
00043                                 m_Material.Thickness = 1;
00044                                 m_Material.FogEnable = false;
00045 
00046                                 /* We divide this here to save some calculations and speed up rendering time
00047                                 (Keep in mind that from now on, m_Size is actually half the total size.
00048                                 This means that we'll need to multiply the size by 2 whenever we give
00049                                 the size back to the user) */
00050                                 m_Size /= 2;
00051 
00052                                 // Create our box, it is the size of the grid exactly, plus 1 in the Y axis
00053                                 m_Box = aabbox3df(-f32(m_Size),-1.f,-f32(m_Size),f32(m_Size),1.f,f32(m_Size));
00054 
00055                                 // Set the default culling state to Frustum Box
00056                                 AutomaticCullingState = EAC_FRUSTUM_BOX;
00057                         }
00058 
00059                         virtual ESCENE_NODE_TYPE getType();
00060 
00062                         virtual GridSceneNode* clone(ISceneNode* newParent=0, ISceneManager* newSceneManager=0);
00063 
00065                         virtual void OnRegisterSceneNode();
00066 
00068                         virtual void render();
00069 
00071                         virtual const aabbox3d<f32>& getBoundingBox() const;
00072 
00074                         virtual u32 getMaterialCount() const;
00075 
00077                         virtual SMaterial& getMaterial(u32 num);
00078 
00080                         u32 getSpacing();
00081 
00083                         u32 getSize();
00084 
00086                         SColor getGridColor();
00087 
00089                         u32 getAccentlineOffset();
00090 
00092                         SColor getAccentLineColor();
00093 
00095                         bool areAxisLineActive();
00096 
00098                         SColor getAxisLineXColor();
00099 
00101                         SColor getAxisLineZColor();
00102 
00104                         void setSpacing(u32 newspacing);
00105 
00107                         void setSize(u32 newsize);
00108 
00110                         void setGridColor(SColor newcolor);
00111 
00113                         void setAccentlineOffset(u32 newoffset);
00114 
00116                         void setAccentlineColor(SColor newcolor);
00117 
00119                         void setAxisLineActive(bool active);
00120 
00122                         void setAxisLineXColor(SColor XLine);
00123 
00125                         void setAxisLineZColor(SColor ZLine);
00126 
00128                         void setMaterial(SMaterial& newMaterial);
00129 
00130                 private:
00131                         aabbox3df m_Box;
00132                         SMaterial m_Material;
00133                         u32 m_Spacing;
00134                         u32 m_Size;
00135                         SColor m_GridColor;
00136                         SColor m_AccentGridColor;
00137                         u32 m_AccentLineOffset;
00138                         bool m_AxisLineState;
00139                         SColor m_XLineColor;
00140                         SColor m_ZLineColor;
00141                 };
00142 
00143         } // namespace game
00144 } // namespace nge
00145 
00146 #endif // __GRID_SCENE_NODE_H__

The NUSoftware Game Engine
The NUSoftware Game Engine Documentation © 2007-2008 by Tomer Nosrati. Generated on Sat Apr 26 16:52:34 2008 by Doxygen (1.5.5)