|
|
@@ -1,23 +1,23 @@
|
|
|
-#include <Bild.h>
|
|
|
-#include <Bildschirm.h>
|
|
|
+#include <Border.h>
|
|
|
+#include <Camera3D.h>
|
|
|
#include <Cube.h>
|
|
|
-#include <DateiSystem.h>
|
|
|
#include <DXBuffer.h>
|
|
|
-#include <Fenster.h>
|
|
|
+#include <FileSystem.h>
|
|
|
#include <GraphicsApi.h>
|
|
|
-#include <Kam3D.h>
|
|
|
-#include <M3Datei.h>
|
|
|
+#include <Image.h>
|
|
|
+#include <M3File.h>
|
|
|
#include <main.h>
|
|
|
#include <Mat4.h>
|
|
|
#include <Model3D.h>
|
|
|
#include <Model3DList.h>
|
|
|
#include <ObjFile.h>
|
|
|
-#include <Rahmen.h>
|
|
|
#include <RenderThread.h>
|
|
|
-#include <TextFeld.h>
|
|
|
-#include <Textur.h>
|
|
|
+#include <Screen.h>
|
|
|
+#include <TextField.h>
|
|
|
+#include <Texture.h>
|
|
|
#include <Vec3.h>
|
|
|
-#include <Welt3D.h>
|
|
|
+#include <Window.h>
|
|
|
+#include <World3D.h>
|
|
|
|
|
|
#define ambient 0.4f
|
|
|
#define diffus 0.3f
|
|
|
@@ -195,7 +195,7 @@ class Block : public Model3D
|
|
|
{
|
|
|
public:
|
|
|
// Konstruktor
|
|
|
- // size: Die Größe des Würfels
|
|
|
+ // size: Die Größe des Würfels
|
|
|
Block(GraphicsApi* zApi)
|
|
|
{
|
|
|
model = zApi->createModel("block");
|
|
|
@@ -215,77 +215,142 @@ public:
|
|
|
|
|
|
model->calculateNormals();
|
|
|
|
|
|
- textur = new Model3DTextur();
|
|
|
- Bild* b = new Bild();
|
|
|
- b->neuBild(10, 10, 0xFFFF5050);
|
|
|
- textur->setPolygonTextur(
|
|
|
- 0, zApi->createOrGetTextur("blockA", b)); // front
|
|
|
- b = new Bild();
|
|
|
- b->neuBild(10, 10, 0xFF5050FF);
|
|
|
- textur->setPolygonTextur(
|
|
|
- 1, zApi->createOrGetTextur("blockC", b)); // left
|
|
|
- b = new Bild();
|
|
|
- b->neuBild(10, 10, 0xFFA02020);
|
|
|
- textur->setPolygonTextur(
|
|
|
- 2, zApi->createOrGetTextur("blockB", b)); // back
|
|
|
- b = new Bild();
|
|
|
- b->neuBild(10, 10, 0xFF2020A0);
|
|
|
- textur->setPolygonTextur(
|
|
|
- 3, zApi->createOrGetTextur("blockD", b)); // right
|
|
|
- b = new Bild();
|
|
|
- b->neuBild(10, 10, 0xFF50FF50);
|
|
|
- textur->setPolygonTextur(
|
|
|
- 4, zApi->createOrGetTextur("blockE", b)); // top
|
|
|
- b = new Bild();
|
|
|
- b->neuBild(10, 10, 0xFF20A020);
|
|
|
- textur->setPolygonTextur(
|
|
|
- 5, zApi->createOrGetTextur("blockF", b)); // botom
|
|
|
+ texture = new Model3DTexture();
|
|
|
+ Image* img = new Image();
|
|
|
+ img->newImage(10, 10, 0xFFFF5050);
|
|
|
+ texture->setPolygonTexture(
|
|
|
+ 0, zApi->createOrGetTexture("blockA", img)); // front
|
|
|
+ img = new Image();
|
|
|
+ img->newImage(10, 10, 0xFF5050FF);
|
|
|
+ texture->setPolygonTexture(
|
|
|
+ 1, zApi->createOrGetTexture("blockC", img)); // left
|
|
|
+ img = new Image();
|
|
|
+ img->newImage(10, 10, 0xFFA02020);
|
|
|
+ texture->setPolygonTexture(
|
|
|
+ 2, zApi->createOrGetTexture("blockB", img)); // back
|
|
|
+ img = new Image();
|
|
|
+ img->newImage(10, 10, 0xFF2020A0);
|
|
|
+ texture->setPolygonTexture(
|
|
|
+ 3, zApi->createOrGetTexture("blockD", img)); // right
|
|
|
+ img = new Image();
|
|
|
+ img->newImage(10, 10, 0xFF50FF50);
|
|
|
+ texture->setPolygonTexture(
|
|
|
+ 4, zApi->createOrGetTexture("blockE", img)); // top
|
|
|
+ img = new Image();
|
|
|
+ img->newImage(10, 10, 0xFF20A020);
|
|
|
+ texture->setPolygonTexture(
|
|
|
+ 5, zApi->createOrGetTexture("blockF", img)); // botom
|
|
|
rend = 1;
|
|
|
}
|
|
|
};
|
|
|
|
|
|
-class ObjModel : public Model3D
|
|
|
+class ObjModelCombiner : public Model3D
|
|
|
{
|
|
|
private:
|
|
|
Text modelName;
|
|
|
+ bool opening = 1;
|
|
|
|
|
|
public:
|
|
|
- ObjModel(GraphicsApi* zApi, Text path, Text textur, Text modelName)
|
|
|
+ ObjModelCombiner(GraphicsApi* zApi, Text path, Text textur, Text modelName)
|
|
|
: Model3D()
|
|
|
{
|
|
|
- M3Datei d("m3/blocks.m3");
|
|
|
- Model3DData* data = 0;
|
|
|
- d.leseDaten();
|
|
|
- Text* p = path.getTeilText(
|
|
|
- 0, path.positionVon(".obj/", path.anzahlVon(".obj/") - 1) + 4);
|
|
|
- if (d.hatModel(modelName))
|
|
|
+ M3File file("m3/blocks.m3");
|
|
|
+ Model3DData* chest = 0;
|
|
|
+ Model3DData* cover = 0;
|
|
|
+ file.readData();
|
|
|
+ if (file.hasModel("chest"))
|
|
|
{
|
|
|
- data = d.ladeModel(modelName, zApi, *p);
|
|
|
+ chest = file.loadModel(modelName, zApi, "chest");
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- ObjFile file(p->getText());
|
|
|
- data = zApi->createModel(path);
|
|
|
- file.loadModel(path.getText() + p->getLength() + 1, data);
|
|
|
- }
|
|
|
- p->release();
|
|
|
- data->setAmbientFactor(ambient);
|
|
|
- data->setDiffusFactor(diffus);
|
|
|
- data->setSpecularFactor(specular);
|
|
|
- setModelDaten(data);
|
|
|
- p = textur.getTeilText(0,
|
|
|
- textur.positionVon(".ltdb/", textur.anzahlVon(".ltdb/") - 1) + 5);
|
|
|
- LTDBDatei dat;
|
|
|
- dat.setDatei(p);
|
|
|
- dat.leseDaten(0);
|
|
|
- Bild* t = dat.laden(0,
|
|
|
- textur.getTeilText(
|
|
|
- textur.positionVon(".ltdb/", textur.anzahlVon(".ltdb/") - 1)
|
|
|
- + 6));
|
|
|
- Model3DTextur* tex = new Model3DTextur();
|
|
|
- tex->setPolygonTextur(0, zApi->createOrGetTextur(textur, t));
|
|
|
- this->textur = tex;
|
|
|
- adjustCenter();
|
|
|
+ chest = zApi->createModel("chest");
|
|
|
+ cover = zApi->createModel("cover");
|
|
|
+ ObjFile file("obj/chest.obj");
|
|
|
+ file.loadModel("chest", chest);
|
|
|
+ ObjFile file2("obj/cover.obj");
|
|
|
+ file2.loadModel("cover", cover);
|
|
|
+ int chestVertexCount = chest->getVertexCount();
|
|
|
+ int vertexCount = chestVertexCount + cover->getVertexCount();
|
|
|
+ Vertex3D* vertecies = new Vertex3D[vertexCount];
|
|
|
+ memcpy(vertecies,
|
|
|
+ chest->zVertexBuffer(),
|
|
|
+ chest->getVertexCount() * sizeof(Vertex3D));
|
|
|
+ memcpy(vertecies + chest->getVertexCount(),
|
|
|
+ cover->zVertexBuffer(),
|
|
|
+ cover->getVertexCount() * sizeof(Vertex3D));
|
|
|
+ for (int i = 0; i < vertexCount; i++)
|
|
|
+ {
|
|
|
+ vertecies[i].pos /= 2.f;
|
|
|
+ float tmp = vertecies[i].pos.z;
|
|
|
+ vertecies[i].pos.z = vertecies[i].pos.y;
|
|
|
+ vertecies[i].pos.y = tmp;
|
|
|
+ vertecies[i].tPos.y = 1.f - vertecies[i].tPos.y;
|
|
|
+ vertecies[i].knochenId = 0;
|
|
|
+ }
|
|
|
+ for (int i = chest->getVertexCount(); i < vertexCount; i++)
|
|
|
+ {
|
|
|
+ vertecies[i].pos.z -= 0.45f;
|
|
|
+ vertecies[i].pos.x -= 0.5f;
|
|
|
+ vertecies[i].knochenId = 1;
|
|
|
+ }
|
|
|
+ chest->setVertecies(vertecies, vertexCount);
|
|
|
+ for (int i = 0; i < chest->getPolygonCount(); i++)
|
|
|
+ {
|
|
|
+ Polygon3D* pol = chest->getPolygon(i);
|
|
|
+ for (int j = 0; j < pol->indexAnz; j++)
|
|
|
+ {
|
|
|
+ if (j % 3 == 2)
|
|
|
+ {
|
|
|
+ int tmp = pol->indexList[j - 1];
|
|
|
+ pol->indexList[j - 1] = pol->indexList[j];
|
|
|
+ pol->indexList[j] = tmp;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ for (int i = 0; i < cover->getPolygonCount(); i++)
|
|
|
+ {
|
|
|
+ Polygon3D* pol = cover->getPolygon(i);
|
|
|
+ Polygon3D* res = new Polygon3D();
|
|
|
+ res->indexAnz = pol->indexAnz;
|
|
|
+ res->indexList = new int[pol->indexAnz];
|
|
|
+ for (int j = 0; j < pol->indexAnz; j++)
|
|
|
+ {
|
|
|
+ res->indexList[j] = pol->indexList[j] + chestVertexCount;
|
|
|
+ if (j % 3 == 2)
|
|
|
+ {
|
|
|
+ int tmp = res->indexList[j - 1];
|
|
|
+ res->indexList[j - 1] = res->indexList[j];
|
|
|
+ res->indexList[j] = tmp;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ chest->addPolygon(res);
|
|
|
+ }
|
|
|
+ Skeleton* skelett = new Skeleton();
|
|
|
+ int rootId = skelett->addBone(
|
|
|
+ Vec3<float>(0.f, 0.f, 0.f), Vec3<float>(0.f, 0.f, 0.f));
|
|
|
+ skelett->addBone(Vec3<float>(0.5f, 0.f, 0.45f),
|
|
|
+ Vec3<float>(0.f, 0.f, 0.f),
|
|
|
+ rootId);
|
|
|
+ chest->setSkeletonZ(skelett);
|
|
|
+ chest->updateGPUMemory();
|
|
|
+ cover->release();
|
|
|
+ }
|
|
|
+ chest->setAmbientFactor(ambient);
|
|
|
+ chest->setDiffusFactor(diffus);
|
|
|
+ chest->setSpecularFactor(specular);
|
|
|
+ setModelData(chest);
|
|
|
+ LTDBFile imgFile;
|
|
|
+ imgFile.setFile(new Text("tex/blocks.ltdb"));
|
|
|
+ imgFile.readData(0);
|
|
|
+ Image* t0 = imgFile.load(0, new Text("chest.png"));
|
|
|
+ Image* t1 = imgFile.load(0, new Text("chestcover.png"));
|
|
|
+ Model3DTexture* tex = new Model3DTexture();
|
|
|
+ tex->setPolygonTexture(0, zApi->createOrGetTexture("chest.png", t0));
|
|
|
+ tex->setPolygonTexture(
|
|
|
+ 1, zApi->createOrGetTexture("chestcover.png", t1));
|
|
|
+ this->texture = tex;
|
|
|
+ // adjustCenter();
|
|
|
rend = 1;
|
|
|
this->modelName = modelName;
|
|
|
}
|
|
|
@@ -294,7 +359,7 @@ public:
|
|
|
{
|
|
|
Vec3<float> maxPos = {-INFINITY, -INFINITY, -INFINITY};
|
|
|
Vec3<float> minPos = {INFINITY, INFINITY, INFINITY};
|
|
|
- for (int i = 0; i < model->getVertexAnzahl(); i++)
|
|
|
+ for (int i = 0; i < model->getVertexCount(); i++)
|
|
|
{
|
|
|
if (model->zVertexBuffer()[i].pos.x < minPos.x)
|
|
|
minPos.x = model->zVertexBuffer()[i].pos.x;
|
|
|
@@ -312,7 +377,7 @@ public:
|
|
|
Vec3<float> center = minPos + (maxPos - minPos) / 2;
|
|
|
if (center != Vec3<float>(0.f, 0.f, 0.f))
|
|
|
{
|
|
|
- for (int i = 0; i < model->getVertexAnzahl(); i++)
|
|
|
+ for (int i = 0; i < model->getVertexCount(); i++)
|
|
|
{
|
|
|
// !! update of vertex data is not supported by the framework
|
|
|
// and does not update some stored information on the model like
|
|
|
@@ -326,41 +391,60 @@ public:
|
|
|
|
|
|
bool tick(double time) override
|
|
|
{
|
|
|
- if (getTastenStand(VK_OEM_MINUS))
|
|
|
+ Bone* k = skelett->zBone(1);
|
|
|
+ if (opening)
|
|
|
+ {
|
|
|
+ k->setRotation(
|
|
|
+ k->getRotation() + Vec3<float>(0.0f, 0.3f * time, 0.f));
|
|
|
+ if (k->getRotation().y > PI / 2)
|
|
|
+ {
|
|
|
+ opening = !opening;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ k->setRotation(
|
|
|
+ k->getRotation() - Vec3<float>(0.0f, 0.3f * time, 0.f));
|
|
|
+ if (k->getRotation().y < 0)
|
|
|
+ {
|
|
|
+ opening = !opening;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (getKeyState(VK_OEM_MINUS))
|
|
|
{
|
|
|
setSize(size - (size - (size * 0.995)) * (time * 3));
|
|
|
}
|
|
|
- if (getTastenStand(VK_OEM_PLUS))
|
|
|
+ if (getKeyState(VK_OEM_PLUS))
|
|
|
{
|
|
|
setSize(size + (size * 1.005 - size) * (time * 3));
|
|
|
}
|
|
|
- if (getTastenStand(VK_NUMPAD1))
|
|
|
+ if (getKeyState(VK_NUMPAD1))
|
|
|
{
|
|
|
- setDrehungX(getDrehung().x + time * 0.1);
|
|
|
+ setRotationX(getRotation().x + time * 0.1);
|
|
|
}
|
|
|
- if (getTastenStand(VK_NUMPAD4))
|
|
|
+ if (getKeyState(VK_NUMPAD4))
|
|
|
{
|
|
|
- setDrehungX(getDrehung().x - time * 0.1);
|
|
|
+ setRotationX(getRotation().x - time * 0.1);
|
|
|
}
|
|
|
- if (getTastenStand(VK_NUMPAD2))
|
|
|
+ if (getKeyState(VK_NUMPAD2))
|
|
|
{
|
|
|
- setDrehungY(getDrehung().y + time * 0.1);
|
|
|
+ setRotationY(getRotation().y + time * 0.1);
|
|
|
}
|
|
|
- if (getTastenStand(VK_NUMPAD5))
|
|
|
+ if (getKeyState(VK_NUMPAD5))
|
|
|
{
|
|
|
- setDrehungY(getDrehung().y - time * 0.1);
|
|
|
+ setRotationY(getRotation().y - time * 0.1);
|
|
|
}
|
|
|
- if (getTastenStand(VK_NUMPAD3))
|
|
|
+ if (getKeyState(VK_NUMPAD3))
|
|
|
{
|
|
|
- setDrehungZ(getDrehung().z + time * 0.1);
|
|
|
+ setRotationZ(getRotation().z + time * 0.1);
|
|
|
}
|
|
|
- if (getTastenStand(VK_NUMPAD6))
|
|
|
+ if (getKeyState(VK_NUMPAD6))
|
|
|
{
|
|
|
- setDrehungZ(getDrehung().z - time * 0.1);
|
|
|
+ setRotationZ(getRotation().z - time * 0.1);
|
|
|
}
|
|
|
- if (getTastenStand(T_Enter))
|
|
|
+ if (getKeyState(T_Enter))
|
|
|
{
|
|
|
- if (size != 1.f || getDrehung() != Vec3<float>(0.f, 0.f, 0.f))
|
|
|
+ if (size != 1.f || getRotation() != Vec3<float>(0.f, 0.f, 0.f))
|
|
|
{
|
|
|
// aply scale and rotation on model verticies
|
|
|
Mat4<float> matrix = Mat4<float>::identity()
|
|
|
@@ -368,7 +452,7 @@ public:
|
|
|
* Mat4<float>::rotationX(angle.x)
|
|
|
* Mat4<float>::rotationY(angle.y)
|
|
|
* Mat4<float>::scaling(size);
|
|
|
- for (int i = 0; i < model->getVertexAnzahl(); i++)
|
|
|
+ for (int i = 0; i < model->getVertexCount(); i++)
|
|
|
{
|
|
|
// !! update of vertex data is not supported by the
|
|
|
// framework and does not update some stored information on
|
|
|
@@ -382,17 +466,17 @@ public:
|
|
|
model->zDXVertexBuffer()->setChanged();
|
|
|
model->updateGPUMemory();
|
|
|
size = 1.f;
|
|
|
- setDrehung(0.f, 0.f, 0.f);
|
|
|
+ setRotation(0.f, 0.f, 0.f);
|
|
|
adjustCenter();
|
|
|
}
|
|
|
}
|
|
|
- if (getTastenStand(T_Ende))
|
|
|
+ if (getKeyState(T_Ende))
|
|
|
{
|
|
|
// save model
|
|
|
- M3Datei dat("m3/blocks.m3");
|
|
|
- dat.leseDaten();
|
|
|
- dat.removeModel(modelName);
|
|
|
- if (dat.saveModel(model, modelName))
|
|
|
+ M3File file("m3/blocks.m3");
|
|
|
+ file.readData();
|
|
|
+ file.removeModel(modelName);
|
|
|
+ if (file.saveModel(model, modelName))
|
|
|
{
|
|
|
std::cout << "erfolgreich gespeichert\n";
|
|
|
}
|
|
|
@@ -405,11 +489,242 @@ public:
|
|
|
}
|
|
|
};
|
|
|
|
|
|
-// Aktion beim schließen des Fensters
|
|
|
-void schließen(void* p, void* f)
|
|
|
+class ObjModel : public Model3D
|
|
|
+{
|
|
|
+private:
|
|
|
+ Text modelName;
|
|
|
+ Text m3File;
|
|
|
+ bool opening = 1;
|
|
|
+
|
|
|
+public:
|
|
|
+ ObjModel(
|
|
|
+ GraphicsApi* zApi, Text path, Text textur, Text modelName, Text m3File)
|
|
|
+ : Model3D(),
|
|
|
+ m3File(m3File)
|
|
|
+ {
|
|
|
+ M3File file(m3File);
|
|
|
+ Model3DData* model = 0;
|
|
|
+ file.readData();
|
|
|
+ bool adjustCenterNeeded = false;
|
|
|
+ if (file.hasModel(modelName))
|
|
|
+ {
|
|
|
+ model = file.loadModel(modelName, zApi, modelName);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ model = zApi->createModel(modelName);
|
|
|
+ ObjFile file(path);
|
|
|
+ file.loadModel(modelName, model);
|
|
|
+ int vertexCount = model->getVertexCount();
|
|
|
+ Vertex3D* v = (Vertex3D*)model->zVertexBuffer();
|
|
|
+ for (int i = 0; i < vertexCount; i++)
|
|
|
+ {
|
|
|
+ v[i].tPos.y = 1.f - v[i].tPos.y;
|
|
|
+ }
|
|
|
+ adjustCenterNeeded = true;
|
|
|
+ }
|
|
|
+ model->setAmbientFactor(ambient);
|
|
|
+ model->setDiffusFactor(diffus);
|
|
|
+ model->setSpecularFactor(specular);
|
|
|
+ setModelData(model);
|
|
|
+ LTDBFile imgFile;
|
|
|
+ Text* p = textur.getTeilText(
|
|
|
+ 0, textur.positionOf("/", textur.countOf("/") - 1));
|
|
|
+ int pLen = p->getLength();
|
|
|
+ imgFile.setFile(p);
|
|
|
+ imgFile.readData(0);
|
|
|
+ Image* t = imgFile.load(0, textur.getTeilText(pLen + 1));
|
|
|
+ Model3DTexture* tex = new Model3DTexture();
|
|
|
+ tex->setPolygonTexture(0, zApi->createOrGetTexture(textur, t));
|
|
|
+ this->texture = tex;
|
|
|
+ if (adjustCenterNeeded)
|
|
|
+ {
|
|
|
+ adjustCenter();
|
|
|
+ }
|
|
|
+ rend = 1;
|
|
|
+ this->modelName = modelName;
|
|
|
+ }
|
|
|
+
|
|
|
+ void adjustCenter()
|
|
|
+ {
|
|
|
+ Vec3<float> maxPos = {-INFINITY, -INFINITY, -INFINITY};
|
|
|
+ Vec3<float> minPos = {INFINITY, INFINITY, INFINITY};
|
|
|
+ for (int i = 0; i < model->getVertexCount(); i++)
|
|
|
+ {
|
|
|
+ if (model->zVertexBuffer()[i].pos.x < minPos.x)
|
|
|
+ minPos.x = model->zVertexBuffer()[i].pos.x;
|
|
|
+ if (model->zVertexBuffer()[i].pos.y < minPos.y)
|
|
|
+ minPos.y = model->zVertexBuffer()[i].pos.y;
|
|
|
+ if (model->zVertexBuffer()[i].pos.z < minPos.z)
|
|
|
+ minPos.z = model->zVertexBuffer()[i].pos.z;
|
|
|
+ if (model->zVertexBuffer()[i].pos.x > maxPos.x)
|
|
|
+ maxPos.x = model->zVertexBuffer()[i].pos.x;
|
|
|
+ if (model->zVertexBuffer()[i].pos.y > maxPos.y)
|
|
|
+ maxPos.y = model->zVertexBuffer()[i].pos.y;
|
|
|
+ if (model->zVertexBuffer()[i].pos.z > maxPos.z)
|
|
|
+ maxPos.z = model->zVertexBuffer()[i].pos.z;
|
|
|
+ }
|
|
|
+ Vec3<float> center = minPos + (maxPos - minPos) / 2;
|
|
|
+ if (center != Vec3<float>(0.f, 0.f, 0.f))
|
|
|
+ {
|
|
|
+ for (int i = 0; i < model->getVertexCount(); i++)
|
|
|
+ {
|
|
|
+ // !! update of vertex data is not supported by the framework
|
|
|
+ // and does not update some stored information on the model like
|
|
|
+ // bounding box and radius
|
|
|
+ ((Vertex3D*)model->zVertexBuffer())[i].pos -= center;
|
|
|
+ }
|
|
|
+ model->zDXVertexBuffer()->setChanged();
|
|
|
+ model->updateGPUMemory();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ bool tick(double time) override
|
|
|
+ {
|
|
|
+ if (getKeyState(VK_NUMPAD7) || getKeyState(VK_NUMPAD8)
|
|
|
+ || getKeyState(VK_NUMPAD9))
|
|
|
+ {
|
|
|
+ if (getKeyState(VK_OEM_MINUS))
|
|
|
+ {
|
|
|
+ if (getKeyState(VK_NUMPAD7))
|
|
|
+ {
|
|
|
+ setPosition(pos - Vec3<float>(1.f, 0.f, 0.f) * 0.0001);
|
|
|
+ }
|
|
|
+ if (getKeyState(VK_NUMPAD8))
|
|
|
+ {
|
|
|
+ setPosition(pos - Vec3<float>(0.f, 1.f, 0.f) * 0.0001);
|
|
|
+ }
|
|
|
+ if (getKeyState(VK_NUMPAD9))
|
|
|
+ {
|
|
|
+ setPosition(pos - Vec3<float>(0.f, 0.f, 1.f) * 0.0001);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (getKeyState(VK_OEM_PLUS))
|
|
|
+ {
|
|
|
+ if (getKeyState(VK_NUMPAD7))
|
|
|
+ {
|
|
|
+ setPosition(pos + Vec3<float>(1.f, 0.f, 0.f) * 0.0001);
|
|
|
+ }
|
|
|
+ if (getKeyState(VK_NUMPAD8))
|
|
|
+ {
|
|
|
+ setPosition(pos + Vec3<float>(0.f, 1.f, 0.f) * 0.0001);
|
|
|
+ }
|
|
|
+ if (getKeyState(VK_NUMPAD9))
|
|
|
+ {
|
|
|
+ setPosition(pos + Vec3<float>(0.f, 0.f, 1.f) * 0.0001);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ if (getKeyState(VK_OEM_MINUS))
|
|
|
+ {
|
|
|
+ setSize(size - (size - (size * 0.995)) * (time * 3));
|
|
|
+ }
|
|
|
+ if (getKeyState(VK_OEM_PLUS))
|
|
|
+ {
|
|
|
+ setSize(size + (size * 1.005 - size) * (time * 3));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (getKeyState(VK_NUMPAD1))
|
|
|
+ {
|
|
|
+ setRotationX(getRotation().x + time * 0.1);
|
|
|
+ }
|
|
|
+ if (getKeyState(VK_NUMPAD4))
|
|
|
+ {
|
|
|
+ setRotationX(getRotation().x - time * 0.1);
|
|
|
+ }
|
|
|
+ if (getKeyState(VK_NUMPAD2))
|
|
|
+ {
|
|
|
+ setRotationY(getRotation().y + time * 0.1);
|
|
|
+ }
|
|
|
+ if (getKeyState(VK_NUMPAD5))
|
|
|
+ {
|
|
|
+ setRotationY(getRotation().y - time * 0.1);
|
|
|
+ }
|
|
|
+ if (getKeyState(VK_NUMPAD3))
|
|
|
+ {
|
|
|
+ setRotationZ(getRotation().z + time * 0.1);
|
|
|
+ }
|
|
|
+ if (getKeyState(VK_NUMPAD6))
|
|
|
+ {
|
|
|
+ setRotationZ(getRotation().z - time * 0.1);
|
|
|
+ }
|
|
|
+ if (getKeyState(T_Enter))
|
|
|
+ {
|
|
|
+ if (size != 1.f || getRotation() != Vec3<float>(0.f, 0.f, 0.f))
|
|
|
+ {
|
|
|
+ // aply scale and rotation on model verticies
|
|
|
+ Mat4<float> matrix = Mat4<float>::identity()
|
|
|
+ * Mat4<float>::rotationZ(angle.z)
|
|
|
+ * Mat4<float>::rotationX(angle.x)
|
|
|
+ * Mat4<float>::rotationY(angle.y)
|
|
|
+ * Mat4<float>::scaling(size);
|
|
|
+ for (int i = 0; i < model->getVertexCount(); i++)
|
|
|
+ {
|
|
|
+ // !! update of vertex data is not supported by the
|
|
|
+ // framework and does not update some stored information on
|
|
|
+ // the model like bounding box and radius
|
|
|
+ ((Vertex3D*)model->zVertexBuffer())[i].pos
|
|
|
+ = matrix * model->zVertexBuffer()[i].pos;
|
|
|
+ ((Vertex3D*)model->zVertexBuffer())[i].normal
|
|
|
+ = (matrix * model->zVertexBuffer()[i].normal)
|
|
|
+ .normalize();
|
|
|
+ }
|
|
|
+ model->zDXVertexBuffer()->setChanged();
|
|
|
+ model->updateGPUMemory();
|
|
|
+ size = 1.f;
|
|
|
+ setRotation(0.f, 0.f, 0.f);
|
|
|
+ adjustCenter();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (getKeyState(T_BackSpace))
|
|
|
+ {
|
|
|
+ if (getPos() != Vec3<float>(0.f, 0.f, 0.f))
|
|
|
+ {
|
|
|
+ // aply scale and rotation on model verticies
|
|
|
+ Mat4<float> matrix
|
|
|
+ = Mat4<float>::identity() * Mat4<float>::translation(pos);
|
|
|
+ for (int i = 0; i < model->getVertexCount(); i++)
|
|
|
+ {
|
|
|
+ // !! update of vertex data is not supported by the
|
|
|
+ // framework and does not update some stored information on
|
|
|
+ // the model like bounding box and radius
|
|
|
+ ((Vertex3D*)model->zVertexBuffer())[i].pos
|
|
|
+ = matrix * model->zVertexBuffer()[i].pos;
|
|
|
+ ((Vertex3D*)model->zVertexBuffer())[i].normal
|
|
|
+ = (matrix * model->zVertexBuffer()[i].normal)
|
|
|
+ .normalize();
|
|
|
+ }
|
|
|
+ model->zDXVertexBuffer()->setChanged();
|
|
|
+ model->updateGPUMemory();
|
|
|
+ setPosition(Vec3<float>(0.f, 0.f, 0.f));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (getKeyState(T_Ende))
|
|
|
+ {
|
|
|
+ // save model
|
|
|
+ M3File file(m3File);
|
|
|
+ file.readData();
|
|
|
+ file.removeModel(modelName);
|
|
|
+ if (file.saveModel(model, modelName))
|
|
|
+ {
|
|
|
+ std::cout << "erfolgreich gespeichert\n";
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ std::cout << "fehler beim speichern\n";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return Model3D::tick(time);
|
|
|
+ }
|
|
|
+};
|
|
|
+
|
|
|
+// Aktion beim schließen des Fensters
|
|
|
+void schließen(void* p, void* f)
|
|
|
{
|
|
|
// Stoppe Nachrichten Loop
|
|
|
- StopNachrichtenSchleife(((WFenster*)f)->getFensterHandle());
|
|
|
+ StopMessageLoop(((NativeWindow*)f)->getWindowHandle());
|
|
|
}
|
|
|
|
|
|
int __stdcall Framework::Start(Startparam p)
|
|
|
@@ -418,184 +733,191 @@ int __stdcall Framework::Start(Startparam p)
|
|
|
WNDCLASS wc = F_Normal(p.hinst);
|
|
|
wc.lpszClassName = "3D Creator";
|
|
|
|
|
|
- WFenster* f = new WFenster();
|
|
|
- f->erstellen(WS_OVERLAPPEDWINDOW, wc);
|
|
|
- f->setVSchließAktion(schließen);
|
|
|
- f->setAnzeigeModus(SW_SHOWNORMAL);
|
|
|
- f->setSize(1300, 820);
|
|
|
- f->setPosition(Punkt(100, 100));
|
|
|
+ NativeWindow* window = new NativeWindow();
|
|
|
+ window->create(WS_OVERLAPPEDWINDOW, wc);
|
|
|
+ window->setPreCloseAction(schließen);
|
|
|
+ window->setDisplayMode(SW_SHOWNORMAL);
|
|
|
+ window->setSize(1300, 820);
|
|
|
+ window->setPosition(Point(100, 100));
|
|
|
|
|
|
// 3D Umgebung erstellen
|
|
|
- Bildschirm3D* b
|
|
|
- = new Bildschirm3D(dynamic_cast<WFenster*>(f->getThis()), DIRECTX11);
|
|
|
- f->setBildschirm(dynamic_cast<Bildschirm*>(b->getThis()));
|
|
|
- b->setFillFarbe(0);
|
|
|
- b->setTestRend(0);
|
|
|
-
|
|
|
- Welt3D* welt = new Welt3D();
|
|
|
-
|
|
|
- ObjModel* mdl = new ObjModel(b->zGraphicsApi(),
|
|
|
- "obj/sebling.obj/Cube",
|
|
|
- "tex/blocks.ltdb/torch.png",
|
|
|
- "torch");
|
|
|
+ Screen3D* screen = new Screen3D(
|
|
|
+ dynamic_cast<NativeWindow*>(window->getThis()), DIRECTX11);
|
|
|
+ window->setScreen(dynamic_cast<Screen*>(screen->getThis()));
|
|
|
+ screen->setFillColor(0);
|
|
|
+ screen->setTestRend(0);
|
|
|
+
|
|
|
+ World3D* world = new World3D();
|
|
|
+
|
|
|
+ ObjModel* mdl = new ObjModel(screen->zGraphicsApi(),
|
|
|
+ "obj/vines.obj",
|
|
|
+ "tex/plants.ltdb/vines.png",
|
|
|
+ "vines",
|
|
|
+ "m3/plants.m3");
|
|
|
mdl->setPosition(0, 0, 0);
|
|
|
- welt->addZeichnung(mdl);
|
|
|
- Block* blk = new Block(b->zGraphicsApi());
|
|
|
+ world->addDrawable(mdl);
|
|
|
+ Block* blk = new Block(screen->zGraphicsApi());
|
|
|
blk->setPosition(0, 0, -1);
|
|
|
- welt->addZeichnung(blk);
|
|
|
+ world->addDrawable(blk);
|
|
|
|
|
|
- welt->addDiffuseLight(
|
|
|
+ world->addDiffuseLight(
|
|
|
{Vec3<float>(-0.5f, -0.5f, -0.5f), Vec3<float>(1.f, 1.f, 1.f)});
|
|
|
|
|
|
- Kam3D* kamA = new Kam3D(); // look at front
|
|
|
- kamA->setBildschirmPosition(10, 10);
|
|
|
- kamA->setBildschirmSize(385, 385);
|
|
|
- kamA->setPosition(Vec3<float>(0, -10, 0));
|
|
|
- kamA->setRotation({-(float)PI / 2.f, -(float)PI, 0});
|
|
|
- kamA->setWelt(dynamic_cast<Welt3D*>(welt->getThis()));
|
|
|
- b->addKamera(kamA);
|
|
|
-
|
|
|
- Kam3D* kamB = new Kam3D(); // look at left
|
|
|
- kamB->setMovementSpeed(1);
|
|
|
- kamB->setBildschirmPosition(10, 405);
|
|
|
- kamB->setBildschirmSize(385, 385);
|
|
|
- kamB->setPosition(Vec3<float>(10, 0, 0));
|
|
|
- kamB->setRotation({-PI / 2, (float)PI, (float)PI / 2.f});
|
|
|
- kamB->setWelt(dynamic_cast<Welt3D*>(welt->getThis()));
|
|
|
- b->addKamera(kamB);
|
|
|
-
|
|
|
- Kam3D* kamC = new Kam3D();
|
|
|
- kamC->setBildschirmPosition(405, 10);
|
|
|
- kamC->setBildschirmSize(385, 385);
|
|
|
- kamC->setPosition(Vec3<float>(0, 0, 10));
|
|
|
- kamC->setRotation({-(float)PI, 0, 0});
|
|
|
- kamC->setWelt(dynamic_cast<Welt3D*>(welt->getThis()));
|
|
|
- b->addKamera(kamC);
|
|
|
-
|
|
|
- Kam3D* kamD = new Kam3D();
|
|
|
- kamD->setStyle(
|
|
|
- Kam3D::Style::Movable | Kam3D::Style::Rotatable | Kam3D::Style::Tick);
|
|
|
- kamD->setBildschirmPosition(405, 405);
|
|
|
- kamD->setBildschirmSize(385, 385);
|
|
|
- kamD->setPosition(Vec3<float>(0, -10, 0));
|
|
|
- kamD->setRotation({-(float)PI / 2.f, -(float)PI, 0});
|
|
|
- kamD->setWelt(dynamic_cast<Welt3D*>(welt->getThis()));
|
|
|
- b->addKamera(kamD);
|
|
|
-
|
|
|
- LTDSDatei dat;
|
|
|
- dat.setPfad(new Text("normal.ltds"));
|
|
|
- dat.leseDaten();
|
|
|
- Schrift* schrift = dat.ladeSchrift();
|
|
|
- TextFeld* kamPos = new TextFeld();
|
|
|
- kamPos->setSchriftZ(schrift);
|
|
|
- kamPos->setPosition(810, 10);
|
|
|
- kamPos->setSize(200, 200);
|
|
|
- kamPos->setText("Kamera Position");
|
|
|
- kamPos->setStyle(TextFeld::Style::Text);
|
|
|
- b->addMember(kamPos);
|
|
|
-
|
|
|
- LRahmen* kamAR = new LRahmen();
|
|
|
- kamAR->setPosition(10, 10);
|
|
|
- kamAR->setFarbe(0xFFFFFFFF);
|
|
|
- kamAR->setRamenBreite(1);
|
|
|
- kamAR->setSize(385, 385);
|
|
|
- b->addMember(kamAR);
|
|
|
- LRahmen* kamBR = new LRahmen();
|
|
|
- kamBR->setPosition(404, 10);
|
|
|
- kamBR->setFarbe(0xFFFFFFFF);
|
|
|
- kamBR->setRamenBreite(1);
|
|
|
- kamBR->setSize(385, 385);
|
|
|
- b->addMember(kamBR);
|
|
|
- LRahmen* kamCR = new LRahmen();
|
|
|
- kamCR->setPosition(10, 405);
|
|
|
- kamCR->setFarbe(0xFFFFFFFF);
|
|
|
- kamCR->setRamenBreite(1);
|
|
|
- kamCR->setSize(385, 385);
|
|
|
- b->addMember(kamCR);
|
|
|
- LRahmen* kamDR = new LRahmen();
|
|
|
- kamDR->setPosition(405, 405);
|
|
|
- kamDR->setFarbe(0xFFFFFFFF);
|
|
|
- kamDR->setRamenBreite(1);
|
|
|
- kamDR->setSize(385, 385);
|
|
|
- b->addMember(kamDR);
|
|
|
+ Cam3D* camA = new Cam3D(); // look at front
|
|
|
+ camA->setScreenPosition(10, 10);
|
|
|
+ camA->setScreenSize(385, 385);
|
|
|
+ camA->setPosition(Vec3<float>(0, -10, 0));
|
|
|
+ camA->setRotation({-(float)PI / 2.f, -(float)PI, 0});
|
|
|
+ camA->setWorld(dynamic_cast<World3D*>(world->getThis()));
|
|
|
+ screen->addKamera(camA);
|
|
|
+
|
|
|
+ Cam3D* camB = new Cam3D(); // look at left
|
|
|
+ camB->setMovementSpeed(1);
|
|
|
+ camB->setScreenPosition(10, 405);
|
|
|
+ camB->setScreenSize(385, 385);
|
|
|
+ camB->setPosition(Vec3<float>(10, 0, 0));
|
|
|
+ camB->setRotation({-PI / 2, (float)PI, (float)PI / 2.f});
|
|
|
+ camB->setWorld(dynamic_cast<World3D*>(world->getThis()));
|
|
|
+ screen->addKamera(camB);
|
|
|
+
|
|
|
+ Cam3D* camC = new Cam3D();
|
|
|
+ camC->setScreenPosition(405, 10);
|
|
|
+ camC->setScreenSize(385, 385);
|
|
|
+ camC->setPosition(Vec3<float>(0, 0, 10));
|
|
|
+ camC->setRotation({-(float)PI, 0, 0});
|
|
|
+ camC->setWorld(dynamic_cast<World3D*>(world->getThis()));
|
|
|
+ screen->addKamera(camC);
|
|
|
+
|
|
|
+ Cam3D* camD = new Cam3D();
|
|
|
+ camD->setStyle(
|
|
|
+ Cam3D::Style::Movable | Cam3D::Style::Rotatable | Cam3D::Style::Tick);
|
|
|
+ camD->setScreenPosition(405, 405);
|
|
|
+ camD->setScreenSize(385, 385);
|
|
|
+ camD->setPosition(Vec3<float>(0, -10, 0));
|
|
|
+ camD->setRotation({-(float)PI / 2.f, -(float)PI, 0});
|
|
|
+ camD->setWorld(dynamic_cast<World3D*>(world->getThis()));
|
|
|
+ screen->addKamera(camD);
|
|
|
+
|
|
|
+ LTDSFile fontFile;
|
|
|
+ fontFile.setPfad(new Text("normal.ltds"));
|
|
|
+ fontFile.readData();
|
|
|
+ Font* font = fontFile.loadFont();
|
|
|
+ TextField* camPos = new TextField();
|
|
|
+ camPos->setFontZ(font);
|
|
|
+ camPos->setPosition(810, 10);
|
|
|
+ camPos->setSize(200, 200);
|
|
|
+ camPos->setText("Kamera Position");
|
|
|
+ camPos->setStyle(TextField::Style::Text);
|
|
|
+ screen->addMember(camPos);
|
|
|
+
|
|
|
+ LBorder* camAR = new LBorder();
|
|
|
+ camAR->setPosition(10, 10);
|
|
|
+ camAR->setColor(0xFFFFFFFF);
|
|
|
+ camAR->setBorderWidth(1);
|
|
|
+ camAR->setSize(385, 385);
|
|
|
+ screen->addMember(camAR);
|
|
|
+ LBorder* camBR = new LBorder();
|
|
|
+ camBR->setPosition(404, 10);
|
|
|
+ camBR->setColor(0xFFFFFFFF);
|
|
|
+ camBR->setBorderWidth(1);
|
|
|
+ camBR->setSize(385, 385);
|
|
|
+ screen->addMember(camBR);
|
|
|
+ LBorder* camCR = new LBorder();
|
|
|
+ camCR->setPosition(10, 405);
|
|
|
+ camCR->setColor(0xFFFFFFFF);
|
|
|
+ camCR->setBorderWidth(1);
|
|
|
+ camCR->setSize(385, 385);
|
|
|
+ screen->addMember(camCR);
|
|
|
+ LBorder* camDR = new LBorder();
|
|
|
+ camDR->setPosition(405, 405);
|
|
|
+ camDR->setColor(0xFFFFFFFF);
|
|
|
+ camDR->setBorderWidth(1);
|
|
|
+ camDR->setSize(385, 385);
|
|
|
+ screen->addMember(camDR);
|
|
|
|
|
|
// Render Loop starten
|
|
|
RenderTh* r = new RenderTh();
|
|
|
r->setMaxFps(10000);
|
|
|
- r->setBildschirm(dynamic_cast<Bildschirm*>(b->getThis()));
|
|
|
- r->setTickFunktion([b, kamD, kamA, kamB, kamC, kamPos](
|
|
|
+ r->setScreen(dynamic_cast<Screen*>(screen->getThis()));
|
|
|
+ r->setTickFunktion([screen, camD, camA, camB, camC, camPos](
|
|
|
void*, void*, double t) {
|
|
|
- if (Framework::getTastenStand('1'))
|
|
|
- {
|
|
|
- kamA->setStyle(Kam3D::Style::Movable | Kam3D::Style::Rotatable
|
|
|
- | Kam3D::Style::Tick);
|
|
|
- kamB->removeStyle(Kam3D::Style::Movable | Kam3D::Style::Rotatable
|
|
|
- | Kam3D::Style::Tick);
|
|
|
- kamC->removeStyle(Kam3D::Style::Movable | Kam3D::Style::Rotatable
|
|
|
- | Kam3D::Style::Tick);
|
|
|
- kamD->removeStyle(Kam3D::Style::Movable | Kam3D::Style::Rotatable
|
|
|
- | Kam3D::Style::Tick);
|
|
|
- }
|
|
|
- if (Framework::getTastenStand('2'))
|
|
|
- {
|
|
|
- kamA->removeStyle(Kam3D::Style::Movable | Kam3D::Style::Rotatable
|
|
|
- | Kam3D::Style::Tick);
|
|
|
- kamB->setStyle(Kam3D::Style::Movable | Kam3D::Style::Rotatable
|
|
|
- | Kam3D::Style::Tick);
|
|
|
- kamC->removeStyle(Kam3D::Style::Movable | Kam3D::Style::Rotatable
|
|
|
- | Kam3D::Style::Tick);
|
|
|
- kamD->removeStyle(Kam3D::Style::Movable | Kam3D::Style::Rotatable
|
|
|
- | Kam3D::Style::Tick);
|
|
|
- }
|
|
|
- if (Framework::getTastenStand('3'))
|
|
|
- {
|
|
|
- kamA->removeStyle(Kam3D::Style::Movable | Kam3D::Style::Rotatable
|
|
|
- | Kam3D::Style::Tick);
|
|
|
- kamB->removeStyle(Kam3D::Style::Movable | Kam3D::Style::Rotatable
|
|
|
- | Kam3D::Style::Tick);
|
|
|
- kamC->setStyle(Kam3D::Style::Movable | Kam3D::Style::Rotatable
|
|
|
- | Kam3D::Style::Tick);
|
|
|
- kamD->removeStyle(Kam3D::Style::Movable | Kam3D::Style::Rotatable
|
|
|
- | Kam3D::Style::Tick);
|
|
|
- }
|
|
|
- if (Framework::getTastenStand('4'))
|
|
|
- {
|
|
|
- kamA->removeStyle(Kam3D::Style::Movable | Kam3D::Style::Rotatable
|
|
|
- | Kam3D::Style::Tick);
|
|
|
- kamB->removeStyle(Kam3D::Style::Movable | Kam3D::Style::Rotatable
|
|
|
- | Kam3D::Style::Tick);
|
|
|
- kamC->removeStyle(Kam3D::Style::Movable | Kam3D::Style::Rotatable
|
|
|
- | Kam3D::Style::Tick);
|
|
|
- kamD->setStyle(Kam3D::Style::Movable | Kam3D::Style::Rotatable
|
|
|
- | Kam3D::Style::Tick);
|
|
|
- }
|
|
|
- Text txt = Text("A: ") + kamA->getWorldPosition().x + ", "
|
|
|
- + kamA->getWorldPosition().y + ", "
|
|
|
- + kamA->getWorldPosition().z + "\n";
|
|
|
- txt += Text("B: ") + kamB->getWorldPosition().x + ", "
|
|
|
- + kamB->getWorldPosition().y + ", " + kamB->getWorldPosition().z
|
|
|
+ if (Framework::getKeyState('1'))
|
|
|
+ {
|
|
|
+ camA->setStyle(Cam3D::Style::Movable | Cam3D::Style::Rotatable
|
|
|
+ | Cam3D::Style::Tick);
|
|
|
+ camB->removeStyle(Cam3D::Style::Movable | Cam3D::Style::Rotatable
|
|
|
+ | Cam3D::Style::Tick);
|
|
|
+ camC->removeStyle(Cam3D::Style::Movable | Cam3D::Style::Rotatable
|
|
|
+ | Cam3D::Style::Tick);
|
|
|
+ camD->removeStyle(Cam3D::Style::Movable | Cam3D::Style::Rotatable
|
|
|
+ | Cam3D::Style::Tick);
|
|
|
+ }
|
|
|
+ if (Framework::getKeyState('2'))
|
|
|
+ {
|
|
|
+ camA->removeStyle(Cam3D::Style::Movable | Cam3D::Style::Rotatable
|
|
|
+ | Cam3D::Style::Tick);
|
|
|
+ camB->setStyle(Cam3D::Style::Movable | Cam3D::Style::Rotatable
|
|
|
+ | Cam3D::Style::Tick);
|
|
|
+ camC->removeStyle(Cam3D::Style::Movable | Cam3D::Style::Rotatable
|
|
|
+ | Cam3D::Style::Tick);
|
|
|
+ camD->removeStyle(Cam3D::Style::Movable | Cam3D::Style::Rotatable
|
|
|
+ | Cam3D::Style::Tick);
|
|
|
+ }
|
|
|
+ if (Framework::getKeyState('3'))
|
|
|
+ {
|
|
|
+ camA->removeStyle(Cam3D::Style::Movable | Cam3D::Style::Rotatable
|
|
|
+ | Cam3D::Style::Tick);
|
|
|
+ camB->removeStyle(Cam3D::Style::Movable | Cam3D::Style::Rotatable
|
|
|
+ | Cam3D::Style::Tick);
|
|
|
+ camC->setStyle(Cam3D::Style::Movable | Cam3D::Style::Rotatable
|
|
|
+ | Cam3D::Style::Tick);
|
|
|
+ camD->removeStyle(Cam3D::Style::Movable | Cam3D::Style::Rotatable
|
|
|
+ | Cam3D::Style::Tick);
|
|
|
+ }
|
|
|
+ if (Framework::getKeyState('4'))
|
|
|
+ {
|
|
|
+ camA->removeStyle(Cam3D::Style::Movable | Cam3D::Style::Rotatable
|
|
|
+ | Cam3D::Style::Tick);
|
|
|
+ camB->removeStyle(Cam3D::Style::Movable | Cam3D::Style::Rotatable
|
|
|
+ | Cam3D::Style::Tick);
|
|
|
+ camC->removeStyle(Cam3D::Style::Movable | Cam3D::Style::Rotatable
|
|
|
+ | Cam3D::Style::Tick);
|
|
|
+ camD->setStyle(Cam3D::Style::Movable | Cam3D::Style::Rotatable
|
|
|
+ | Cam3D::Style::Tick);
|
|
|
+ }
|
|
|
+ Text txt = Text("A: ") + camA->getWorldPosition().x + ", "
|
|
|
+ + camA->getWorldPosition().y + ", "
|
|
|
+ + camA->getWorldPosition().z + "\n";
|
|
|
+ txt += Text("B: ") + camB->getWorldPosition().x + ", "
|
|
|
+ + camB->getWorldPosition().y + ", " + camB->getWorldPosition().z
|
|
|
+ "\n";
|
|
|
- txt += Text("C: ") + kamC->getWorldPosition().x + ", "
|
|
|
- + kamC->getWorldPosition().y + ", " + kamC->getWorldPosition().z
|
|
|
+ txt += Text("C: ") + camC->getWorldPosition().x + ", "
|
|
|
+ + camC->getWorldPosition().y + ", " + camC->getWorldPosition().z
|
|
|
+ "\n";
|
|
|
- txt += Text("D: ") + kamD->getWorldPosition().x + ", "
|
|
|
- + kamD->getWorldPosition().y + ", " + kamD->getWorldPosition().z
|
|
|
+ txt += Text("D: ") + camD->getWorldPosition().x + ", "
|
|
|
+ + camD->getWorldPosition().y + ", " + camD->getWorldPosition().z
|
|
|
+ "\n";
|
|
|
- kamPos->setText(txt);
|
|
|
+ txt.append() << "top: hellgrün\n"
|
|
|
+ << "bottom: dunkelgrün\n"
|
|
|
+ << "front: helrot\n"
|
|
|
+ << "back: dunkelrot\n"
|
|
|
+ << "left: hellblau\n"
|
|
|
+ << "right: dunkelblau";
|
|
|
+ camPos->setText(txt);
|
|
|
});
|
|
|
r->beginn();
|
|
|
|
|
|
// Nachrichten Loop starten und warten
|
|
|
- StartNachrichtenSchleife();
|
|
|
+ StartMessageLoop();
|
|
|
|
|
|
// Speicher Freigeben
|
|
|
- r->beenden();
|
|
|
+ r->terminate();
|
|
|
r->release();
|
|
|
- b->release();
|
|
|
- f->setBildschirm(0);
|
|
|
- f->zerstören();
|
|
|
- f->release();
|
|
|
- welt->release();
|
|
|
+ screen->release();
|
|
|
+ window->setScreen(0);
|
|
|
+ window->destroy();
|
|
|
+ window->release();
|
|
|
+ world->release();
|
|
|
|
|
|
return 0;
|
|
|
}
|