123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351 |
- #pragma once
- #include "Vec2.h"
- #include "Array.h"
- #include "Mat4.h"
- #include "Zeichnung3D.h"
- struct ID3D11Buffer;
- namespace Framework
- {
- struct Polygon2D;
- class Textur;
- class Model2DData;
- class DXBuffer;
- class Render3D;
- class Model3DTextur;
- class Model3DList;
- class Animation3D;
- class Welt3D;
- class DXBuffer;
-
- class Knochen
- {
- private:
- Vec3< float > pos;
- Vec3< float > winkel;
- Knochen* geschwister;
- Knochen* kinder;
- int id;
- public:
-
- DLLEXPORT Knochen(int id);
-
- DLLEXPORT ~Knochen();
-
-
- DLLEXPORT void setPosition(Vec3< float >& pos);
-
-
- DLLEXPORT void setDrehung(Vec3< float >& winkel);
-
-
- void addGeschwisterKnochen(Knochen* k);
-
-
-
- DLLEXPORT void addKind(int id, Knochen* k);
-
-
-
-
-
- DLLEXPORT void kalkulateMatrix(Mat4< float >& elternMat, Mat4< float >* matBuffer, float scaleFactor, Mat4< float >& kamMat);
-
- DLLEXPORT Knochen* zGeschwister() const;
-
- DLLEXPORT Knochen* zKind() const;
-
- DLLEXPORT Knochen* kopiereKnochen() const;
-
- DLLEXPORT int getId() const;
-
- DLLEXPORT Vec3< float > getDrehung() const;
-
- DLLEXPORT Vec3< float > getPosition() const;
-
- float getRadius() const;
- friend Animation3D;
- };
-
- class Skelett : public virtual ReferenceCounter
- {
- private:
- Knochen* k;
- int nextId;
- public:
-
- DLLEXPORT Skelett();
-
- DLLEXPORT ~Skelett();
-
-
- DLLEXPORT int getNextKnochenId();
-
-
- DLLEXPORT void setNextKnochenId(int id);
-
-
-
- DLLEXPORT void addKnochen(Knochen* k, int elternId = -1);
-
-
-
-
-
-
- DLLEXPORT int kalkulateMatrix(Mat4< float >& modelMatrix, Mat4< float >* matBuffer, float scaleFactor, Mat4< float >& kamMatrix);
-
- DLLEXPORT float getRadius() const;
-
- DLLEXPORT Knochen* zKnochen() const;
-
- DLLEXPORT Skelett* kopiereSkelett() const;
-
- DLLEXPORT int zNextKnochenId() const;
- friend Animation3D;
- };
-
- struct Vertex3D
- {
- Vec3< float > pos;
- Vec2< float > tPos;
- Vec3< float > normal;
- int knochenId;
- };
-
- struct Polygon3D
- {
- int* indexList;
- int indexAnz;
-
- DLLEXPORT Polygon3D();
-
- DLLEXPORT ~Polygon3D();
- };
-
-
- class Model3DData : public virtual ReferenceCounter
- {
- private:
- Skelett* skelett;
- Vertex3D* vertexList;
- int vertexCount;
- Array< Polygon3D* >* polygons;
- float ambientFactor;
- float diffusFactor;
- float specularFactor;
- float radius;
- int* indexBuffer;
- int indexCount;
- DXBuffer* dxIndexBuffer;
- DXBuffer* dxVertexBuffer;
- int id;
- public:
-
- DLLEXPORT Model3DData(DXBuffer* dxVertexBuffer, DXBuffer* dxIndexBuffer, int id);
-
- DLLEXPORT ~Model3DData();
-
- DLLEXPORT void updateGPUMemory();
-
- DLLEXPORT void clearModel();
-
- DLLEXPORT void calculateNormals();
-
- DLLEXPORT void buildIndexBuffer();
-
-
- DLLEXPORT void setSkelettZ(Skelett* s);
-
-
-
- DLLEXPORT void setVertecies(Vertex3D* vertexList, int anz);
-
-
- DLLEXPORT void addPolygon(Polygon3D* polygon);
-
-
- DLLEXPORT void setAmbientFactor(float f);
-
-
- DLLEXPORT void setDiffusFactor(float f);
-
-
- DLLEXPORT void setSpecularFactor(float f);
-
-
-
- DLLEXPORT void copyModel2D(Model2DData* model, float z);
-
-
- DLLEXPORT void removePolygon(int index);
-
-
-
-
-
-
- int kalkulateMatrix(Mat4< float >& modelMatrix, Mat4< float >* matBuffer, float scaleFactor, Mat4< float >& kamMatrix) const;
-
- DLLEXPORT int getPolygonAnzahl() const;
-
-
- DLLEXPORT Polygon3D* getPolygon(int index) const;
-
- DLLEXPORT Iterator< Polygon3D* > getPolygons() const;
-
- DLLEXPORT float getRadius() const;
-
- DLLEXPORT int getId() const;
-
- DLLEXPORT float getAmbientFactor() const;
-
- DLLEXPORT float getDiffusFactor() const;
-
- DLLEXPORT float getSpecularFactor() const;
-
- DLLEXPORT Skelett* copySkelett() const;
-
- DLLEXPORT int getVertexAnzahl() const;
-
- DLLEXPORT const Vertex3D* zVertexBuffer() const;
-
- DLLEXPORT const int* getIndexBuffer() const;
-
- DLLEXPORT int getIndexCount() const;
-
- DLLEXPORT DXBuffer* zDXIndexBuffer() const;
-
- DLLEXPORT DXBuffer* zDXVertexBuffer() const;
- };
-
- class Model3DTextur : public virtual ReferenceCounter
- {
- private:
- Textur** textures;
- int textureCount;
- public:
-
- DLLEXPORT Model3DTextur();
-
- DLLEXPORT ~Model3DTextur();
-
-
-
- DLLEXPORT void setPolygonTextur(int pI, Textur* txt);
-
-
- DLLEXPORT Textur* zPolygonTextur(int i) const;
- };
-
- class Model3D : public Zeichnung3D
- {
- protected:
- struct AnimationData
- {
- Animation3D* a;
- double speed;
- double offset;
- AnimationData* getThis();
- AnimationData* release();
- };
- Skelett* skelett;
- Model3DData* model;
- Model3DTextur* textur;
- RCArray< AnimationData >* animations;
- float ambientFactor;
- float diffusFactor;
- float specularFactor;
- public:
-
- DLLEXPORT Model3D();
-
- DLLEXPORT virtual ~Model3D();
-
-
- DLLEXPORT void addAnimation(Animation3D* a, double speed = 1);
-
-
- DLLEXPORT void removeAnimation(Animation3D* zA);
-
-
- DLLEXPORT void setModelDaten(Model3DData* data);
-
-
- DLLEXPORT void setModelTextur(Model3DTextur* txt);
-
-
- DLLEXPORT void setAmbientFactor(float f);
-
-
- DLLEXPORT void setDiffusFactor(float f);
-
-
- DLLEXPORT void setSpecularFactor(float f);
-
-
-
-
- DLLEXPORT int errechneMatrizen(Mat4< float >& viewProj, Mat4< float >* matBuffer) override;
-
-
-
- DLLEXPORT virtual bool tick(double tickval) override;
-
- DLLEXPORT Model3DTextur* getTextur();
-
- DLLEXPORT Model3DTextur* zTextur();
-
- DLLEXPORT Model3DData* getModelData();
-
- DLLEXPORT Model3DData* zModelData();
-
-
-
-
-
-
- DLLEXPORT virtual float traceRay(Vec3< float >& point, Vec3< float >& dir, float maxSqDist, int& pId) const;
-
-
-
-
-
- DLLEXPORT virtual int traceRay(Vec3< float >& point, Vec3< float >& dir, int pId, Welt3D* zWelt) const;
-
- DLLEXPORT int getDatenId() const;
-
- DLLEXPORT float getAmbientFactor() const;
-
- DLLEXPORT float getDiffusFactor() const;
-
- DLLEXPORT float getSpecularFactor() const;
-
- DLLEXPORT int getVertexAnzahl() const;
-
- DLLEXPORT const Vertex3D* zVertexBuffer() const;
-
- DLLEXPORT virtual bool needRenderPolygon(int index);
- DLLEXPORT virtual Textur* zEffectTextur();
- DLLEXPORT virtual float getEffectPercentage();
- };
- }
|