ResidualVM logo ResidualVM website - Forums - Contact us BuildBot - Doxygen - Wiki curved edge

renderentry.h

Go to the documentation of this file.
00001 /* ResidualVM - A 3D game interpreter
00002  *
00003  * ResidualVM is the legal property of its developers, whose names
00004  * are too numerous to list here. Please refer to the AUTHORS
00005  * file distributed with this source distribution.
00006  *
00007  * This program is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU General Public License
00009  * as published by the Free Software Foundation; either version 2
00010  * of the License, or (at your option) any later version.
00011  *
00012  * This program is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU General Public License
00018  * along with this program; if not, write to the Free Software
00019  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00020  *
00021  */
00022 
00023 #ifndef STARK_GFX_RENDER_ENTRY_H
00024 #define STARK_GFX_RENDER_ENTRY_H
00025 
00026 #include "common/array.h"
00027 #include "common/rect.h"
00028 #include "common/str.h"
00029 
00030 #include "math/ray.h"
00031 #include "math/vector3d.h"
00032 
00033 namespace Stark {
00034 
00035 class Visual;
00036 class VisualImageXMG;
00037 class VisualText;
00038 
00039 namespace Resources {
00040 class ItemVisual;
00041 }
00042 
00043 namespace Gfx {
00044 
00045 struct LightEntry {
00046     enum Type {
00047         kAmbient     = 0,
00048         kPoint       = 1,
00049         kDirectional = 2,
00050         kSpot        = 4
00051     };
00052 
00053     Type type;
00054     Math::Vector3d color;
00055     Math::Vector3d position;
00056     Math::Vector3d direction;
00057     Math::Angle innerConeAngle;
00058     Math::Angle outerConeAngle;
00059     float falloffNear;
00060     float falloffFar;
00061 };
00062 
00063 typedef Common::Array<LightEntry *> LightEntryArray;
00064 
00065 class RenderEntry {
00066 public:
00067     RenderEntry(Resources::ItemVisual *owner, const Common::String &name);
00068     virtual ~RenderEntry() {}
00069 
00070     void render(const LightEntryArray &lights = LightEntryArray());
00071 
00072     void setVisual(Visual *visual);
00073     void setPosition(const Common::Point &position);
00074     void setPosition3D(const Math::Vector3d &position, float direction);
00075     void setSortKey(float sortKey);
00076     void setClickable(bool clickable);
00077 
00079     Common::Point getPosition() const { return _position; }
00080 
00082     Resources::ItemVisual *getOwner() const { return _owner; }
00083 
00085     const Common::String &getName() const { return _name; }
00086 
00088     VisualImageXMG *getImage() const;
00089 
00091     VisualText *getText() const;
00092 
00101     bool containsPoint(const Common::Point &position, Common::Point &relativePosition, const Common::Rect &cursorRect) const;
00102 
00104     bool intersectRay(const Math::Ray &ray) const;
00105 
00107     static bool compare(const RenderEntry *x, const RenderEntry *y);
00108 
00113     Common::Rect getBoundingRect() const;
00114 
00115 protected:
00116     Common::String _name;
00117     Resources::ItemVisual *_owner;
00118 
00119     Visual *_visual;
00120     Common::Point _position;
00121     Math::Vector3d _position3D;
00122     float _direction3D;
00123     float _sortKey;
00124     bool _clickable;
00125 };
00126 
00127 typedef Common::Array<RenderEntry *> RenderEntryArray;
00128 
00129 } // End of namespace Gfx
00130 } // End of namespace Stark
00131 
00132 #endif // STARK_GFX_RENDER_ENTRY_H


Generated on Sat May 25 2019 05:00:51 for ResidualVM by doxygen 1.7.1
curved edge   curved edge