Initial
This commit is contained in:
161
proto/source/TOBJECT.HPP
Normal file
161
proto/source/TOBJECT.HPP
Normal file
@@ -0,0 +1,161 @@
|
||||
#ifndef _PROTO_TESTOBJECT_HPP_
|
||||
#define _PROTO_TESTOBJECT_HPP_
|
||||
#ifndef _COMMON_SMARTPOINTER_HPP_
|
||||
#include <common/pointer.hpp>
|
||||
#endif
|
||||
#ifndef _COMMON_BITMAP_HPP_
|
||||
#include <common/bitmap.hpp>
|
||||
#endif
|
||||
#ifndef _ENGINE_VECTOR3D_HPP_
|
||||
#include <engine/vector3d.hpp>
|
||||
#endif
|
||||
#ifndef _ENGINE_TEXTURE_HPP_
|
||||
#include <engine/texture.hpp>
|
||||
#endif
|
||||
#ifndef _PROTO_PUREOBJECT_HPP_
|
||||
#include <proto/pureobj.hpp>
|
||||
#endif
|
||||
|
||||
class TestObject : public PureObject
|
||||
{
|
||||
public:
|
||||
TestObject(void);
|
||||
TestObject(const Vector3D &vector3D,UINT id=0);
|
||||
virtual ~TestObject();
|
||||
Point3D &operator[](unsigned short index);
|
||||
void setVector(const Vector3D &vector3D);
|
||||
const Vector3D &getVector(void)const;
|
||||
const Vector3D &getInitVector(void)const;
|
||||
void setTexture(SmartPointer<Bitmap> &textureBitmap,bool ownIt=false);
|
||||
const SmartPointer<Bitmap> &getTexture(void)const;
|
||||
virtual void rotate(const PureAngle &pureAngle,RotationMatrix::Orientation orientation);
|
||||
virtual void translate(const Point &uvPoint,TranslationMatrix::Orientation orientation);
|
||||
virtual void map(SmartPointer<DIB3D> &displayBitmap);
|
||||
virtual void normalize(void);
|
||||
virtual bool isInView(SmartPointer<DIB3D> &displayBitmap);
|
||||
private:
|
||||
TestObject(const TestObject &someTestObject);
|
||||
TestObject &operator=(const TestObject &someTestObject);
|
||||
|
||||
SmartPointer<Bitmap> mTextureBitmap;
|
||||
Vector3D mVector3D;
|
||||
Vector3D mInitVector3D;
|
||||
};
|
||||
|
||||
inline
|
||||
TestObject::TestObject(void)
|
||||
{
|
||||
}
|
||||
|
||||
inline
|
||||
TestObject::TestObject(const Vector3D &vector3D,UINT id)
|
||||
: PureObject(id), mVector3D(vector3D), mInitVector3D(vector3D)
|
||||
{
|
||||
}
|
||||
|
||||
inline
|
||||
TestObject::TestObject(const TestObject &someTestObject)
|
||||
{ // private implementation
|
||||
*this=someTestObject;
|
||||
}
|
||||
|
||||
inline
|
||||
TestObject::~TestObject()
|
||||
{
|
||||
}
|
||||
|
||||
inline
|
||||
Point3D &TestObject::operator[](unsigned short index)
|
||||
{
|
||||
return mVector3D[index];
|
||||
}
|
||||
|
||||
inline
|
||||
TestObject &TestObject::operator=(const TestObject &someTestObject)
|
||||
{
|
||||
mVector3D=someTestObject.mVector3D;
|
||||
mTextureBitmap=someTestObject.mTextureBitmap;
|
||||
setState(someTestObject.getState());
|
||||
setID(someTestObject.getID());
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline
|
||||
void TestObject::setVector(const Vector3D &vector3D)
|
||||
{
|
||||
mVector3D=vector3D;
|
||||
}
|
||||
|
||||
inline
|
||||
const Vector3D &TestObject::getVector(void)const
|
||||
{
|
||||
return mVector3D;
|
||||
}
|
||||
|
||||
inline
|
||||
const Vector3D &TestObject::getInitVector(void)const
|
||||
{
|
||||
return mInitVector3D;
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
void TestObject::setTexture(SmartPointer<Bitmap> &textureBitmap,bool ownIt)
|
||||
{
|
||||
mTextureBitmap=textureBitmap;
|
||||
if(ownIt)mTextureBitmap.disposition(PointerDisposition::Delete);
|
||||
}
|
||||
|
||||
inline
|
||||
const SmartPointer<Bitmap> &TestObject::getTexture(void)const
|
||||
{
|
||||
return mTextureBitmap;
|
||||
}
|
||||
// virtuals
|
||||
|
||||
inline
|
||||
void TestObject::map(SmartPointer<DIB3D> &displayBitmap)
|
||||
{
|
||||
Texture textureMapper(mVector3D,*mTextureBitmap,*displayBitmap);
|
||||
textureMapper.mapTexture();
|
||||
// displayBitmap->line(displayBitmap->cameraPoint(),Point3D(0,0,0),128);
|
||||
}
|
||||
|
||||
inline
|
||||
void TestObject::rotate(const PureAngle &pureAngle,RotationMatrix::Orientation orientation)
|
||||
{
|
||||
#if 0
|
||||
RotationMatrix rotationMatrix;
|
||||
rotationMatrix.orientation(orientation);
|
||||
rotationMatrix.angle(pureAngle);
|
||||
rotationMatrix.evaluate(mVector3D[0]);
|
||||
rotationMatrix.evaluate(mVector3D[1]);
|
||||
rotationMatrix.evaluate(mVector3D[2]);
|
||||
rotationMatrix.evaluate(mVector3D[3]);
|
||||
#endif
|
||||
}
|
||||
|
||||
inline
|
||||
void TestObject::translate(const Point &uvPoint,TranslationMatrix::Orientation orientation)
|
||||
{
|
||||
TranslationMatrix translationMatrix;
|
||||
translationMatrix.orientation(orientation);
|
||||
translationMatrix.uvPoint(uvPoint);
|
||||
translationMatrix.evaluate(mVector3D[0]);
|
||||
translationMatrix.evaluate(mVector3D[1]);
|
||||
translationMatrix.evaluate(mVector3D[2]);
|
||||
translationMatrix.evaluate(mVector3D[3]);
|
||||
}
|
||||
|
||||
inline
|
||||
void TestObject::normalize(void)
|
||||
{
|
||||
mVector3D.normalize();
|
||||
}
|
||||
|
||||
inline
|
||||
bool TestObject::isInView(SmartPointer<DIB3D> &displayBitmap)
|
||||
{
|
||||
return displayBitmap->isInView(mVector3D);
|
||||
}
|
||||
#endif
|
||||
Reference in New Issue
Block a user