Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | Related Pages

Object.h

00001 /*************************************************************************** 00002 * This file is part of OpenCAL: Open Computer Animation Library * 00003 * I created OpenCAL as my master's thesis Computer Science (multimedia) * 00004 * at the tUL university in Diepenbeek, Belgium * 00005 * * 00006 * Copyright (C) 2003-2004 by Jeroen Dierckx * 00007 * jeroen.dierckx@student.luc.ac.be * 00008 * * 00009 ***************************************************************************/ 00010 00011 #ifndef OPENCAL_OBJECT_H 00012 #define OPENCAL_OBJECT_H 00013 00014 // Includes 00015 #include <OpenCAL/global.h> 00016 00017 #include <OpenCAL/Vector3.h> 00018 using OpenCAL::Utils::Vector3; 00019 #include <OpenCAL/Matrix44.h> 00020 using OpenCAL::Utils::Matrix44; 00021 00022 00023 namespace OpenCAL 00024 { 00025 // Forward declarations 00026 class System; 00027 00031 class OPENCAL_API Object 00032 { 00033 protected: 00034 // Member variables 00035 System *m_parent; 00036 bool m_initialized, m_draw; 00037 bool m_enabled; 00038 mutable Vector3 m_position; 00039 00040 public: 00041 // Destructor 00042 virtual ~Object(); 00043 00044 // Get functions 00045 const System *getParent() const { return m_parent; } 00046 System *getParent() { return m_parent; } 00047 00048 virtual const Vector3 &getPosition() const { return m_position; } 00049 virtual Vector3 *getPositionP() { return &m_position; } 00050 00051 // Set functions 00052 void setPosition(const Vector3 &position) { m_position = position; } 00053 00054 // Enable functions 00055 bool isEnabled() const { return m_enabled; } 00056 virtual void enable() { m_enabled = true; } 00057 virtual void disable() { m_enabled = false; } 00058 void toggle() { m_enabled = !m_enabled; } 00059 void setEnabled(bool enabled) { m_enabled = enabled; } 00060 00061 // Draw functions 00062 bool getDraw() const { return m_draw; } 00063 void setDraw(bool enabled = true) { m_draw = enabled; } 00064 void enableDraw() { m_draw = true; } 00065 void disableDraw() { m_draw = false; } 00066 void toggleDraw() { m_draw = !m_draw; } 00067 00068 // Movement functions 00069 void move(const Vector3 &direction, float distance); 00070 void moveTo(const Vector3 &position); 00071 00072 // Render functions 00073 virtual void render() = 0; 00074 virtual void renderPicking() { render(); } 00075 00076 // Other functions 00077 virtual Matrix44 getMatrix() const; 00078 virtual void getMatrix(Matrix44 *matrix) const; 00079 00080 virtual bool isInitialized() const { return m_initialized; } 00081 virtual void initialize(); 00082 /* 00083 #ifdef USE_OPENGL 00084 virtual void translateGL(); 00085 virtual void drawGL() = 0; 00086 #endif // USE_OPENGL 00087 */ 00088 00089 protected: 00090 // Constructors 00091 // protected, so no instance of this base class can be made 00092 Object(System *parent); 00093 00094 void assureInit(); 00095 }; 00096 }; 00097 00098 #endif // OPENCAL_OBJECT_H

Generated on Sun Aug 15 19:19:22 2004 for OpenCAL: Open Computer Animation Library by doxygen 1.3.8