1 //------------------------------------------------------------------------------
2 // File : SkyRenderable.hpp
3 //------------------------------------------------------------------------------
4 // SkyWorks : Copyright 2002 Mark J. Harris and
5 // The University of North Carolina at Chapel Hill
6 //------------------------------------------------------------------------------
7 // Permission to use, copy, modify, distribute and sell this software and its
8 // documentation for any purpose is hereby granted without fee, provided that
9 // the above copyright notice appear in all copies and that both that copyright
10 // notice and this permission notice appear in supporting documentation.
11 // Binaries may be compiled with this software without any royalties or
14 // The author(s) and The University of North Carolina at Chapel Hill make no
15 // representations about the suitability of this software for any purpose.
16 // It is provided "as is" without express or
18 //------------------------------------------------------------------------------
19 // File : SkyRenderable.hpp
20 //------------------------------------------------------------------------------
21 // Sky : Copyright 2002 Mark J. Harris and Andrew Zaferakis
22 //------------------------------------------------------------------------------
24 * @file SkyRenderable.hpp
26 * Abstract base class definition for SkyRenderable, a renderable object class.
28 #ifndef __SKYRENDERABLE_HPP__
29 #define __SKYRENDERABLE_HPP__
31 #pragma warning( disable : 4786)
35 #include "SkyUtil.hpp"
37 // forward to reduce unnecessary dependencies
39 class SkyRenderableInstance;
42 //------------------------------------------------------------------------------
44 * @class SkyRenderable
45 * @brief An base class for renderable objects.
47 * Each SkyRenderable object should know how to Display itself, however some
48 * objects may not have a bounding volume that is useful (skybox, etc.)
56 virtual ~SkyRenderable() { }
58 //------------------------------------------------------------------------------
61 //------------------------------------------------------------------------------
63 * @fn SetName(const std::string &name)
64 * @brief Set a name for this renderable.
66 void SetName(const std::string &name) { _name = name; }
68 //------------------------------------------------------------------------------
71 //------------------------------------------------------------------------------
74 * @brief Get the name of this renderable.
76 const std::string& GetName() const { return _name; }
78 //------------------------------------------------------------------------------
81 //------------------------------------------------------------------------------
83 * @fn Update(const Camera &cam, SkyRenderableInstance *pInstance)
84 * @brief Update the state of the renderable.
86 * This method is optional, as some renderables will need periodic updates
87 * (i.e. for animation) and others will not.
89 virtual SKYRESULT Update(const Camera &cam, SkyRenderableInstance *pInstance = NULL)
90 { return SKYRESULT_OK; }
92 //------------------------------------------------------------------------------
95 //------------------------------------------------------------------------------
97 * @fn Display(const Camera &cam, SkyRenderableInstance *pInstance)
98 * @brief Display the object.
100 virtual SKYRESULT Display(const Camera &cam, SkyRenderableInstance *pInstance = NULL) = 0;
102 //------------------------------------------------------------------------------
103 // Function : CopyBoundingVolume
105 //------------------------------------------------------------------------------
107 * @fn CopyBoundingVolume() const
108 * @brief Create a copy of the object's bounding volume, useful for collision, VFC, etc.
110 virtual SkyMinMaxBox* CopyBoundingVolume() const = 0;// { return 0; }
113 std::string _name; // the name of this renderable.
116 #endif //__SKYRENDERABLE_HPP__