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

stark/resources/layer.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_RESOURCES_LAYER_H
00024 #define STARK_RESOURCES_LAYER_H
00025 
00026 #include "common/array.h"
00027 #include "common/str.h"
00028 
00029 #include "engines/stark/gfx/renderentry.h"
00030 #include "engines/stark/resources/object.h"
00031 
00032 namespace Stark {
00033 
00034 namespace Formats {
00035 class XRCReadStream;
00036 }
00037 
00038 namespace Resources {
00039 
00040 class Item;
00041 
00047 class Layer : public Object {
00048 public:
00049     static const Type::ResourceType TYPE = Type::kLayer;
00050 
00051     enum SubType {
00052         kLayer2D = 1,
00053         kLayer3D = 2
00054     };
00055 
00057     static Object *construct(Object *parent, byte subType, uint16 index, const Common::String &name);
00058 
00059     Layer(Object *parent, byte subType, uint16 index, const Common::String &name);
00060     virtual ~Layer();
00061 
00062     // Resource API
00063     virtual void readData(Formats::XRCReadStream *stream) override;
00064     virtual void saveLoad(ResourceSerializer *serializer) override;
00065     virtual void saveLoadCurrent(ResourceSerializer *serializer) override;
00066 
00068     virtual Gfx::RenderEntryArray listRenderEntries() = 0;
00069 
00071     Gfx::LightEntryArray listLightEntries();
00072 
00074     void setScrollPosition(const Common::Point &position);
00075 
00077     Common::Point getScroll() const;
00078 
00080     void setScroll(const Common::Point &scroll);
00081 
00083     void enable(bool enabled);
00084 
00086     bool isEnabled() const;
00087 
00088 protected:
00089     void printData() override;
00090 
00091     Common::Point _scroll;
00092     float _scrollScale; // Used for the parallax effect
00093     bool _enabled;
00094 };
00095 
00101 class Layer2D : public Layer {
00102 public:
00103     Layer2D(Object *parent, byte subType, uint16 index, const Common::String &name);
00104     virtual ~Layer2D();
00105 
00106     // Resource API
00107     void readData(Formats::XRCReadStream *stream) override;
00108     void onEnterLocation() override;
00109     void onExitLocation() override;
00110 
00111     // Layer API
00112     Gfx::RenderEntryArray listRenderEntries() override;
00113 
00114 protected:
00115     void printData() override;
00116 
00117     Common::Array<uint32> _itemIndices;
00118     Common::Array<Item *> _items;
00119 };
00120 
00126 class Layer3D : public Layer {
00127 public:
00128     Layer3D(Object *parent, byte subType, uint16 index, const Common::String &name);
00129     virtual ~Layer3D();
00130 
00131     // Resource API
00132     void readData(Formats::XRCReadStream *stream) override;
00133     void onAllLoaded() override;
00134 
00135     // Layer API
00136     Gfx::RenderEntryArray listRenderEntries() override;
00137 
00139     Gfx::RenderEntry *getBackgroundRenderEntry();
00140 
00141 protected:
00142     void printData() override;
00143 
00144     uint32 _field_54;
00145     uint32 _maxShadowLength;
00146     float _nearClipPlane;
00147     float _farClipPlane;
00148 
00149     Item *_backgroundItem;
00150     Common::Array<Item *> _items;
00151 };
00152 
00153 } // End of namespace Resources
00154 } // End of namespace Stark
00155 
00156 #endif // STARK_RESOURCES_LAYER_H


Generated on Sat Feb 16 2019 05:00:55 for ResidualVM by doxygen 1.7.1
curved edge   curved edge