123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274 |
- #ifndef Model2D_H
- #define Model2D_H
- #include <functional>
- #include "Array.h"
- #include "DreieckListe.h"
- #include "Punkt.h"
- #include "Vec3.h"
- #include "Welt2D.h"
- #include "Zeichnung.h"
- namespace Framework
- {
- class Textur2D;
-
-
- struct Polygon2D
- {
- bool transparent;
- Text* name;
- Array<Vertex>* vertex;
- Array<Vertex>* tKordinaten;
- Vertex* schwerpunkt;
- };
-
- class Model2DData : public virtual ReferenceCounter
- {
- private:
- RCArray<Array<Punkt>> outList;
-
-
-
- bool istPunktInnen(Vertex p, int polygonId = -1) const;
-
-
-
- bool istLinieInnen(Vertex a, Vertex b, int polygonId = -1) const;
- public:
- Array<Polygon2D>* polygons;
- RCArray<RCArray<DreieckListe<Vertex>>>* vListen;
- Punkt minP, maxP;
-
- __declspec(dllexport) Model2DData();
-
- __declspec(dllexport) ~Model2DData();
-
-
-
- __declspec(dllexport) bool erstelleModell(Array<Polygon2D>* polygons);
-
- __declspec(dllexport) void removeModell();
-
-
-
-
-
-
-
-
-
- __declspec(dllexport) bool calcHitPoint(Vertex pos,
- Vertex dir,
- const char* polygonName,
- Vertex& hitpoint,
- Vertex& moveSpeed,
- float& rotSpeed) const;
-
-
-
-
-
-
-
-
-
-
- __declspec(dllexport) bool split(Vertex pos,
- Vertex dir,
- char* polygonName,
- Polygon2D& partA,
- Polygon2D& partB,
- Punkt& posA,
- Punkt& posB,
- std::function<double()> random) const;
-
-
- __declspec(dllexport) float getMasse() const;
- };
- class Model2DObject : public Object2D
- {
- private:
- Model2DData* rData;
- RCArray<Textur2D>* textur;
- public:
-
- __declspec(dllexport) Model2DObject();
-
- __declspec(dllexport) virtual ~Model2DObject();
-
-
- __declspec(dllexport) void setModel(Model2DData* mdl);
-
-
- __declspec(dllexport) void setTextur(Textur2D* t);
-
-
-
-
- __declspec(dllexport) void setTextur(
- Textur2D* t, const char* polygonName);
- __declspec(dllexport) void impuls(
- Vertex start, Vertex speed, float strength = 1.f) override;
-
-
- __declspec(dllexport) void render(
- Mat3<float>& kamMat, Bild& zRObj, const char* kamName) override;
-
-
-
-
- __declspec(dllexport) bool istPunktInnen(
- Vertex p, bool ignoreTransparent = 0) const override;
-
-
-
-
-
- __declspec(dllexport) bool istLinieInnen(
- Vertex a, Vertex b, bool ignoreTransparent = 0) const override;
-
-
-
-
-
-
-
-
- __declspec(dllexport) virtual bool istModelInnen(const Object2D* zObj,
- Vertex* sp = 0,
- bool end = 0,
- bool ignoreTransparent = 0) const;
- __declspec(dllexport) Rect2<float> getBoundingBox() const override;
-
-
-
-
-
-
- __declspec(dllexport) bool calcHitPoint(
- Vertex pos, Vertex dir, Vertex& hitpoint) const override;
- __declspec(dllexport) float getLuftWiederstand() const override;
-
-
- __declspec(dllexport) float getMasse() const override;
-
- __declspec(dllexport) Textur2D* getTextur() const;
-
-
- __declspec(dllexport) Textur2D* getTextur(
- const char* polygonName) const;
-
-
- __declspec(dllexport) Textur2D* zTextur() const;
-
-
- __declspec(dllexport) Textur2D* zTextur(const char* polygonName) const;
-
- __declspec(dllexport) Model2DData* getModel() const;
-
- __declspec(dllexport) Model2DData* zModel() const;
- };
-
- class Model2D : public Zeichnung
- {
- public:
- class Style : public Zeichnung::Style
- {
- public:
- static const __int64 Textur
- = 0x8;
-
- static const __int64 Rahmen
- = 0x10;
-
- static const __int64 Alpha
- = 0x40;
-
- static const __int64 Mesh
- = 0x20;
-
- };
- private:
- Model2DData* rData;
- float drehung;
- float size;
- int farbe;
- RCArray<Textur2D>* textur;
- public:
-
- __declspec(dllexport) Model2D();
-
- __declspec(dllexport) virtual ~Model2D();
-
-
- __declspec(dllexport) void setModel(Model2DData* mdl);
-
-
- __declspec(dllexport) void setDrehung(float drehung);
-
-
- __declspec(dllexport) void addDrehung(float drehung);
-
-
- __declspec(dllexport) void setSize(float size);
-
-
- __declspec(dllexport) void addSize(float size);
-
-
- __declspec(dllexport) void setTextur(Textur2D* t);
-
-
-
-
- __declspec(dllexport) void setTextur(
- Textur2D* t, const char* polygonName);
-
-
- __declspec(dllexport) void setFarbe(int f);
-
-
- __declspec(dllexport) bool tick(double tickVal) override;
-
-
- __declspec(dllexport) void render(Bild& zRObj) override;
-
- __declspec(dllexport) float getDrehung() const;
-
- __declspec(dllexport) float getSize() const;
-
-
- __declspec(dllexport) bool istPunktInnen(int x, int y) const override;
-
-
- __declspec(dllexport) bool istPunktInnen(Vertex p) const;
-
-
-
- __declspec(dllexport) bool istLinieInnen(Vertex a, Vertex b) const;
-
-
-
-
-
- __declspec(dllexport) bool istModelInnen(
- const Model2D* zMdl, bool end = 0) const;
-
- __declspec(dllexport) Model2DData* getModel() const;
-
- __declspec(dllexport) Model2DData* zModel() const;
- };
- }
- #endif
|