1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179
|
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef TETRAEDGE_TE_TE_3D_OBJECT2_H
#define TETRAEDGE_TE_TE_3D_OBJECT2_H
#include "common/array.h"
#include "tetraedge/te/te_color.h"
#include "tetraedge/te/te_i_3d_object2.h"
#include "tetraedge/te/te_matrix4x4.h"
#include "tetraedge/te/te_quaternion.h"
#include "tetraedge/te/te_object.h"
#include "tetraedge/te/te_signal.h"
#include "tetraedge/te/te_vector3f32.h"
namespace Tetraedge {
class Te3DObject2 : public TeI3DObject2, public TeObject {
public:
Te3DObject2();
virtual ~Te3DObject2();
// note, probably should be Te*I*3DObject2 args here
virtual void addChild(Te3DObject2 *newChild);
virtual void addChildBefore(Te3DObject2 *newChild, const Te3DObject2 *ref);
virtual Te3DObject2 *child(long offset);
long childCount() {
return _children.size();
}
long childIndex(Te3DObject2 *childToFind) const;
const Common::Array<Te3DObject2 *> &childList() const {
return _children;
}
bool childListChanged() const {
return _childListChanged;
}
const TeColor &color() const {
return _color;
}
bool colorInheritance() const {
return _colorInheritance;
}
static void deserialize(Common::ReadStream &stream, Te3DObject2 &dest);
static void serialize(Common::WriteStream &stream, Te3DObject2 &src);
virtual void draw() {}
const Common::String &name() const {
return _name;
}
virtual bool onParentWorldColorChanged();
bool onParentWorldTransformationMatrixChanged();
bool onWorldVisibleChangedSlot();
TeSignal0Param &onPositionChanged() {
return _onPositionChangedSignal;
}
TeSignal0Param &onSizeChanged() {
return _onSizeChangedSignal;
}
TeSignal0Param &onWorldColorChanged() {
return _onParentWorldColorChangedSignal;
}
TeSignal0Param &onWorldTransformationMatrixChanged() {
return _onParentWorldTransformationMatrixChangedSignal;
}
TeSignal0Param &onWorldVisibleChanged() {
return _onWorldVisibleChangedSlotSignal;
}
Te3DObject2 *parent() {
return _parent;
}
virtual TeVector3f32 position() {
return _position;
}
virtual void removeChild(Te3DObject2 *toRemove);
virtual void removeChildren();
void rotate(const TeQuaternion &rot);
const TeQuaternion &rotation() {
return _rotation;
}
const TeVector3f32 &scale() const {
return _scale;
}
virtual void setColor(const TeColor &col);
virtual void setColorInheritance(bool val) {
_colorInheritance = val;
}
virtual bool setName(const Common::String &newName) {
_name = newName;
return true;
}
virtual void setParent(Te3DObject2 *newparent); // note, probably should be Te*I*3DObject2 arg
virtual void setPosition(const TeVector3f32 &pos);
virtual void setRotation(const TeQuaternion &rot);
virtual void setScale(const TeVector3f32 &newScale);
virtual void setSize(const TeVector3f32 &newSize);
void setVisible(bool visible);
virtual void setZPosition(float zpos);
virtual TeVector3f32 size() {
return _size;
}
TeMatrix4x4 transformationMatrix();
virtual void translate(const TeVector3f32 &vec);
virtual void updateZ() {};
virtual bool visible() const {
return _visible;
}
TeColor worldColor();
virtual TeVector3f32 worldPosition();
TeQuaternion worldRotation();
TeVector3f32 worldScale();
virtual TeMatrix4x4 worldTransformationMatrix();
virtual bool worldVisible();
virtual float xSize() { return _size.x(); };
virtual float ySize() { return _size.y(); };
virtual float zSize() { return _size.z(); };
static bool loadAndCheckFourCC(Common::ReadStream &stream, const char *str);
static Common::String deserializeString(Common::ReadStream &stream);
static void deserializeVectorArray(Common::ReadStream &stream, Common::Array<TeVector3f32> &dest);
static void deserializeUintArray(Common::ReadStream &stream, Common::Array<uint> &dest);
protected:
TeVector3f32 _size;
TeVector3f32 _position;
TeQuaternion _rotation;
TeVector3f32 _scale;
private:
Common::Array<Te3DObject2 *> _children;
bool _childListChanged;
TeColor _color;
bool _colorInheritance;
Common::String _name;
Te3DObject2 *_parent;
bool _visible;
TeSignal0Param _childListChangedSignal;
TeSignal0Param _onWorldVisibleChangedSlotSignal;
TeSignal0Param _onPositionChangedSignal;
TeSignal0Param _onSizeChangedSignal;
TeSignal0Param _onParentWorldColorChangedSignal;
TeSignal0Param _onParentWorldTransformationMatrixChangedSignal;
TeICallback0ParamPtr _onWorldVisibleChangedParentCallback;
TeICallback0ParamPtr _onWorldTransformationMatrixChangedParentCallback;
TeICallback0ParamPtr _onWorldColorChangedParentCallback;
};
} // end namespace Tetraedge
#endif // TETRAEDGE_TE_TE_3D_OBJECT2_H
|