]> git.leopard-lacewing.eu Git - cgue_weave.git/commitdiff
fixed build MeshTree (but is very slow)
authorPeter Schaefer <schaeferpm@gmail.com>
Tue, 12 May 2015 22:19:19 +0000 (00:19 +0200)
committerPeter Schaefer <schaeferpm@gmail.com>
Tue, 12 May 2015 22:19:19 +0000 (00:19 +0200)
new SkyBox

27 files changed:
CGUE2015_Weave.sln
Weave/Game.cpp
Weave/Graphix/Model/IMesh.cpp
Weave/Graphix/Model/IMesh.h
Weave/Graphix/Model/Model.cpp
Weave/Graphix/Model/Model.h
Weave/Graphix/Model/SkyBox.cpp
Weave/Graphix/Model/SkyBox.h
Weave/Graphix/Texture.cpp
Weave/Scene/Scene.cpp
Weave/Scene/Sky.cpp
models/SkyBox.blend
models/SkyBox.blend1
models/SkyBox.dae
shader/basicTexture_VS.hlsl
shader/skybox_FS.hlsl [deleted file]
shader/skybox_VS.hlsl
shader/skybox_color_FS.hlsl [deleted file]
shader/skyplane_FS.hlsl [new file with mode: 0644]
shader/skyplane_VS.hlsl [new file with mode: 0644]
shader/skyplane_color_FS.hlsl [new file with mode: 0644]
textures/model_levelTest_2D.jpg [new file with mode: 0644]
textures/model_skybox_2D.jpg [new file with mode: 0644]
textures/model_skybox_2D.png [new file with mode: 0644]
textures/model_skybox_CUBE.png [deleted file]
textures/skybox_2D.jpg [new file with mode: 0644]
textures/skybox_CUBE.jpg [deleted file]

index abd53b7b0f7410ccca8dad81f8cefbccd088fbe0..8ce27c38fc1ce2f80c3ca86a3ae7a281110c2279 100644 (file)
@@ -13,9 +13,10 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "shader", "shader", "{75179E
                shader\basicTexture_VS.hlsl = shader\basicTexture_VS.hlsl
                shader\lightingTexture_FS.hlsl = shader\lightingTexture_FS.hlsl
                shader\perspective_VS.hlsl = shader\perspective_VS.hlsl
-               shader\skybox_color_FS.hlsl = shader\skybox_color_FS.hlsl
-               shader\skybox_FS.hlsl = shader\skybox_FS.hlsl
                shader\skybox_VS.hlsl = shader\skybox_VS.hlsl
+               shader\skyplane_color_FS.hlsl = shader\skyplane_color_FS.hlsl
+               shader\skyplane_FS.hlsl = shader\skyplane_FS.hlsl
+               shader\skyplane_VS.hlsl = shader\skyplane_VS.hlsl
        EndProjectSection
 EndProject
 Global
index f3bee9b39ff0239fd1580421232735891e6de914..4098fa067c8e67714b481dd100c19ef20cf43711 100644 (file)
@@ -48,7 +48,7 @@ Game::Game() : playing(true)
 
        // load LVL
 
-       SceneObject* tmp_world = new SceneObject(shader1, scale(vec3(2.5f,1.f,2.5f)), vec4(4.0f, 1.0f, 1.0f, 2.0f), "level_test.dae", "model_levelTest_2D.png");
+       SceneObject* tmp_world = new SceneObject(shader1, scale(vec3(2.5f,1.f,2.5f)), vec4(4.0f, 1.0f, 1.0f, 2.0f), "level_test.dae", "model_levelTest_2D.jpg");
 
        tmp_world->ignore = true;
        current_world->addObject(tmp_world);
@@ -69,6 +69,7 @@ Game::Game() : playing(true)
        //current_world->addObject(new SceneObject(shader1, translate(vec3(-3.f, .4f, 0.f))*scale(vec3(3.f)), "cow/cow.dae", "model_cow_2D.jpg"));
        current_world->addObject(new SceneObject(shader1, translate(vec3(-3.f, .4f, 0.f))*scale(vec3(.32f)), vec4(3.0f, 0.5f, 0.4f, 1.5f), "duck.dae", "model_duck_2D.png"));
        current_world->addObject(new SceneObject(shader1, translate(vec3(-5.f, .4f, 0.f))*scale(vec3(.32f)), vec4(3.0f, 3.f, 0.4f, 1.5f), "duck.dae", "model_duck_2D.png"));
+       current_world->addObject(new SceneObject(shader1, translate(vec3(-5.f, 3.f, 0.f))*scale(vec3(.32f)), vec4(3.0f, 3.f, 0.4f, 1.5f), "SkyBox.dae", "model_SkyBox_2D.jpg"));
 
        current_world->addObject(new EventBox(translate(vec3(3.f, .4f, 0.f)),EB_LOSTZONE));
        current_world->addObject(new EventBox(translate(vec3(3.f, .4f, -15.f)), EB_WINZONE));
index a87d788efc82e1501350bdde37a72d3251f88695..5ea54e65c41ce8e78e7e2ea796dd50b7a7c5ec49 100644 (file)
@@ -1,9 +1,7 @@
 #include "IMesh.h"
 
 #include <GL/glew.h>
-#include <assimp/Importer.hpp>
-#include <assimp/scene.h>
-#include <assimp/postprocess.h>
+
 
 #include "../../GLM.h"
 
@@ -63,7 +61,7 @@ IMesh::IMesh(const aiMesh* _mesh, const mat4& _transformation) : modelMat(_trans
        root->getBBmm(min, max);
        updateBB(min, max);
 #else
-       updateBB(numvertices, vertex);
+       updateBB(numvertices, vertex,modelMat);
 #endif
 
        genBuffer(vertexBuffer, numvertices * 3 * sizeof(float), (void*)vertex);
@@ -102,73 +100,6 @@ void IMesh::useModelMat(const mat4& _model, Shader* _shader) const
 //
 //}
 
-
-bool IMesh::import(const string& _modelpath, uint& numvertices, uint& numfaces, float*& vertex, float*& uvs, float*& normals, uint*& index, uint _mindex) const
-{
-       Assimp::Importer importer;
-
-       const aiScene* scene = importer.ReadFile("../models/" + _modelpath, aiProcess_GenUVCoords | aiProcess_Triangulate | aiProcess_JoinIdenticalVertices | aiProcess_SortByPType);           //aiProcess_PreTransformVertices
-       if (!scene)
-       {
-               Message::error("The file " + _modelpath + " couldn't be read.\n" + importer.GetErrorString());
-               return false;
-       }
-
-       if (!scene->HasMeshes() || scene->mNumMeshes <= _mindex)
-       {
-               Message::error("The file " + _modelpath + " doesn't contain any nodes.");
-               return false;
-       }
-
-       return import(scene->mMeshes[_mindex], numvertices, numfaces, vertex, uvs, normals, index);
-}
-
-bool IMesh::import(const aiMesh* mesh, uint& numvertices, uint& numfaces, float*& vertex, float*& uvs, float*& normals, uint*& index) const
-{
-
-       numvertices = mesh->mNumVertices;
-       numfaces = mesh->mNumFaces;
-       vertex = new float[numvertices * 3];
-       uvs = new float[numvertices * 2];
-       index = new uint[numfaces * 3];
-       normals = new float[numvertices * 3];
-       //aiFace* faces = mesh->mFaces;
-
-
-       //load vertices from Mesh
-       for (uint i = 0; i < numvertices; i++)
-       {
-               vertex[3 * i] = mesh->mVertices[i].x;
-               vertex[3 * i + 1] = mesh->mVertices[i].y;
-               vertex[3 * i + 2] = mesh->mVertices[i].z;
-       }
-
-       //load UVs from Mesh
-       for (uint i = 0; i < numvertices; i++)
-       {
-               uvs[2 * i] = mesh->mTextureCoords[0][i].x;//[i]->x;
-               uvs[2 * i + 1] = mesh->mTextureCoords[0][i].y;//[i]->y;
-       }
-
-       //load indices from Mesh
-       for (uint i = 0; i < numfaces; i++)
-       {
-               index[3 * i] = mesh->mFaces[i].mIndices[0];
-               index[3 * i + 1] = mesh->mFaces[i].mIndices[1];
-               index[3 * i + 2] = mesh->mFaces[i].mIndices[2];
-       }
-
-       //load normals from Mesh
-       for (uint i = 0; i < numvertices; i++)
-       {
-               normals[3 * i] = mesh->mNormals[i].x;
-               normals[3 * i + 1] = mesh->mNormals[i].y;
-               normals[3 * i + 2] = mesh->mNormals[i].z;
-       }
-
-       return true;
-}
-
 Overlap IMesh::checkColS2O(const mat4& _mMat, const Model* _model, const mat4& _modelMat) const
 {
        //Outer BBox
@@ -245,6 +176,16 @@ Node* IMesh::buildMeshTree(const list<Node*>& _triList, vec3 center, vec3 size)
        //catch if list has only two elements => 2 LEAFS
        if (_triList.size() == 2)
                return new Node(center, size, _triList.front(), _triList.back());
+       if (_triList.size() == 3)
+       {
+               vec3 nC, nS;
+               list<Node*> tmpList = _triList;
+               Node* tmpNode = tmpList.front();
+               tmpList.pop_front();
+               getPSfromNodeList(nC, nS, tmpList);
+
+               return new Node(center, size, tmpNode, buildMeshTree(tmpList, nC, nS));
+       }
 
        //find longest dist
        vec3 sort = sortVec3(size);
index 6fb78e89a664fc1fbca1c280a39257a6e58776c2..4a3c6e1532bac98373d001b7f2ae503623f35fd6 100644 (file)
@@ -9,7 +9,6 @@
 
 class Shader;
 class Texture;
-struct aiMesh;
 
 class IMesh : public Model
 {
@@ -74,11 +73,6 @@ protected:
        float *vertex = nullptr, *normals = nullptr, *uvs = nullptr;
        uint *index = nullptr;
 
-       // Mesh Speichern?
-       bool import(const std::string& modelpath, uint& numvertices, uint& numfaces, float*& vertex, float*& uvs, float*& normals, uint*& index , uint mindex = 0) const;
-       bool import(const aiMesh* mesh, uint& numvertices, uint& numfaces, float*& vertex, float*& uvs, float*& normals, uint*& index) const;
-
-
        Node* root;
 
 
index f7bae804069700e43a5243210eb3fe3749e6e662..dec428334e4c7b913613875ed1247b076fbfb8d6 100644 (file)
@@ -8,6 +8,10 @@
 
 #include "../Graphix.h"
 
+#include <assimp/Importer.hpp>
+#include <assimp/scene.h>
+#include <assimp/postprocess.h>
+
 #include "BBox.h"
 #include "SkyBox.h"
 #include "IMetaMesh.h"
@@ -512,6 +516,74 @@ float Model::getPDistHit(const vec3& _P, const vec3& _direction) const
        return 1;
 }
 
+
+bool Model::import(const string& _modelpath, uint& numvertices, uint& numfaces, float*& vertex, float*& uvs, float*& normals, uint*& index, uint _mindex)
+{
+       Assimp::Importer importer;
+
+       const aiScene* scene = importer.ReadFile("../models/" + _modelpath, aiProcess_GenUVCoords | aiProcess_Triangulate | aiProcess_JoinIdenticalVertices | aiProcess_SortByPType);           //aiProcess_PreTransformVertices
+       if (!scene)
+       {
+               Message::error("The file " + _modelpath + " couldn't be read.\n" + importer.GetErrorString());
+               return false;
+       }
+
+       if (!scene->HasMeshes() || scene->mNumMeshes <= _mindex)
+       {
+               Message::error("The file " + _modelpath + " doesn't contain any nodes.");
+               return false;
+       }
+
+       return import(scene->mMeshes[_mindex], numvertices, numfaces, vertex, uvs, normals, index);
+}
+
+bool Model::import(const aiMesh* mesh, uint& numvertices, uint& numfaces, float*& vertex, float*& uvs, float*& normals, uint*& index)
+{
+
+       numvertices = mesh->mNumVertices;
+       numfaces = mesh->mNumFaces;
+       vertex = new float[numvertices * 3];
+       uvs = new float[numvertices * 2];
+       index = new uint[numfaces * 3];
+       normals = new float[numvertices * 3];
+       //aiFace* faces = mesh->mFaces;
+
+
+       //load vertices from Mesh
+       for (uint i = 0; i < numvertices; i++)
+       {
+               vertex[3 * i] = mesh->mVertices[i].x;
+               vertex[3 * i + 1] = mesh->mVertices[i].y;
+               vertex[3 * i + 2] = mesh->mVertices[i].z;
+       }
+
+       //load UVs from Mesh
+       for (uint i = 0; i < numvertices; i++)
+       {
+               uvs[2 * i] = mesh->mTextureCoords[0][i].x;//[i]->x;
+               uvs[2 * i + 1] = mesh->mTextureCoords[0][i].y;//[i]->y;
+       }
+
+       //load indices from Mesh
+       for (uint i = 0; i < numfaces; i++)
+       {
+               index[3 * i] = mesh->mFaces[i].mIndices[0];
+               index[3 * i + 1] = mesh->mFaces[i].mIndices[1];
+               index[3 * i + 2] = mesh->mFaces[i].mIndices[2];
+       }
+
+       //load normals from Mesh
+       for (uint i = 0; i < numvertices; i++)
+       {
+               normals[3 * i] = mesh->mNormals[i].x;
+               normals[3 * i + 1] = mesh->mNormals[i].y;
+               normals[3 * i + 2] = mesh->mNormals[i].z;
+       }
+
+       return true;
+}
+
+
 Model* Model::BoundingBox = nullptr;
 Model* Model::SkyBoxModel = nullptr;
 std::unordered_map<string, Model*> Model::IMetaModel;
index 106bf0e7e784242bd674ffdf5eaba7a53a7716ee..a45e2bb327e03399a39c26952f4e9b76b1cd6c2d 100644 (file)
@@ -9,6 +9,7 @@
 class Shader;
 class Texture;
 class Overlap;
+struct aiMesh;
 
 typedef unsigned int uint;
 
@@ -71,6 +72,11 @@ public:
                const vec3 normal;
 
        };
+
+       // Mesh Speichern?
+       static bool import(const std::string& modelpath, uint& numvertices, uint& numfaces, float*& vertex, float*& uvs, float*& normals, uint*& index, uint mindex = 0);
+       static bool import(const aiMesh* mesh, uint& numvertices, uint& numfaces, float*& vertex, float*& uvs, float*& normals, uint*& index);
+
 protected:
        Model();
        virtual ~Model();
index ab1a57d0198cd1cd9ac62308d95fdf4d5af44a9d..30d4ed5cffbb80cc302b397d6bc3c1fa309e3452 100644 (file)
@@ -3,6 +3,7 @@
 #include "GL/glew.h"
 #include "../Graphix.h"
 #include "../../GLM.h"
+#include "../Shader.h"
 
 
 SkyBox::SkyBox()
@@ -10,15 +11,20 @@ SkyBox::SkyBox()
        numvertices = 4;
        numfaces = 2;
 
-       float vertex[] { -1.f, - 1.f, 0.f, 1.f, - 1.f, 0.f, - 1.f, 1.f, 0.f, 1.f, 1.f, 0.f };
-       uint index[] { 1,3,2,0,1,2};
+       float *vertex = nullptr, *normals = nullptr, *uvs = nullptr;
+       uint *index = nullptr;
 
-       //import("skybox.dae", numvertices, numfaces, vertex, uvs, normals, index, 0);
+       //float vertex[] { -1.f, - 1.f, 0.f, 1.f, - 1.f, 0.f, - 1.f, 1.f, 0.f, 1.f, 1.f, 0.f };
+       //uint index[] { 1,3,2,0,1,2};
+
+       import("SkyBox.dae", numvertices, numfaces, vertex, uvs, normals, index, 0);
 
        genBuffer(vertexBuffer, numvertices * 3 * sizeof(float), (void*)vertex);
+       //genBuffer(normalBuffer, numvertices * 3 * sizeof(float), (void*)normals);
+       genBuffer(uvBuffer, numvertices * 2 * sizeof(float), (void*)uvs);
        genBuffer(indexBuffer, numfaces * 3 * sizeof(uint), (void*)index);
 
-//     delete vertex, index;
+       delete vertex, index, normals, uvs;
 }
 
 
@@ -28,18 +34,27 @@ SkyBox::~SkyBox()
 
 void SkyBox::drawModel(Shader* _shader, Texture* _texture, const mat4& _modelMat) const
 {
-       glDisable(GL_DEPTH_TEST);
+       //_shader->useShader();
+       //GLint OldCullFaceMode;
+       //glGetIntegerv(GL_CULL_FACE_MODE, &OldCullFaceMode);
+       GLint OldDepthFuncMode;
+       glGetIntegerv(GL_DEPTH_FUNC, &OldDepthFuncMode);
+       //glCullFace(GL_FRONT);
+       glDepthFunc(GL_LEQUAL);
+       //glDisable(GL_DEPTH_TEST);
        Model::drawModel(_shader, _texture, _modelMat);
-       glEnable(GL_DEPTH_TEST);
+       //glEnable(GL_DEPTH_TEST);
+       //glCullFace(OldCullFaceMode);
+       glDepthFunc(OldDepthFuncMode);
 }
 
-void SkyBox::useModelMat(const mat4& _model, Shader* _shader) const
-{
-}
+//void SkyBox::useModelMat(const mat4& _model, Shader* _shader) const
+//{
+//}
 
-void SkyBox::useTexture(Texture* _texture, Shader* _shader) const
-{
-}
+//void SkyBox::useTexture(Texture* _texture, Shader* _shader) const
+//{
+//}
 
 void SkyBox::drawBBox(const mat4& _modelMat, const vec4& _color) const
 {
index 0941718fe456cd5a8fd63a5737b96d4c4dce0e33..7faa03e00e1953f1bf224c4bb6c5370492d4ef05 100644 (file)
@@ -13,12 +13,11 @@ public:
        void drawModel(Shader* shader, Texture* texture, const mat4& modelMat) const override;
 
        //uncommend following lines to use default Loaders
-       void useModelMat(const mat4& model, Shader* shader) const override;
-       void useTexture(Texture* texture, Shader* shader) const override;
+       //void useModelMat(const mat4& model, Shader* shader) const override;
+       //void useTexture(Texture* texture, Shader* shader) const override;
 
        void drawBBox(const mat4& modelMat, const vec4& color = vec4(0.f)) const override;
 
        operator std::string() const override;
 
 };
-
index 2793649e312b35368df5421df7da9a57aa5b3c19..bec14b7a8bb505e1313d1efbef6f28e161a5ec34 100644 (file)
@@ -11,7 +11,6 @@ using std::string;
 using std::unordered_map;
 
 
-
 Texture::Texture(const string& _path, const vec4& _material) : path(_path), handle(-1), TEXTURE_TYPE(-1), material(_material)
 {
        //Message::info("Error from before?");
index 3f6ef29226aab284703d5666f7b1de6b028b6d0e..62fb940a4c50047b8fc5c5032d2701cb25d5d2fb 100644 (file)
@@ -150,12 +150,11 @@ void Scene::draw() const
                viewPort.bindView(*i, lookat->getPosition() + vec3(0.0f, 1.0f, 0.0f));
        }
 
-       SkyBox.draw();
-
        for (auto i = SceneObjects.cbegin(); i != SceneObjects.cend(); ++i)
        {
                (*i)->draw();
        }
+       SkyBox.draw();
 }
 
 void Scene::addObject(SceneObject* _add)
index b27ceba1fe28247bac7ec52b015b9ba1b149353b..e089c40d3943db87921f3f04be32cf90b65e3a8b 100644 (file)
@@ -6,8 +6,9 @@
 #include "../GLM.h"
 
 
-Sky::Sky() : SceneObject(new Shader("skybox_VS.hlsl","skybox_color_FS.hlsl"), mat4(1.f), vec4(1.f), Model::getSkyBoxModel(), "")
-{      
+Sky::Sky() : SceneObject(new Shader("skybox_VS.hlsl","basicTexture_FS.hlsl"), scale(vec3(20.f)), vec4(1.f), Model::getSkyBoxModel(), "model_skybox_2D.jpg")
+{
+       modelMat[3][3] = 0;
 }
 
 
index 3a63f80f5aae006492131e082828afe7984ebd40..f20ec9794425bc9c959f2b2921743f7353a3394b 100644 (file)
Binary files a/models/SkyBox.blend and b/models/SkyBox.blend differ
index c549e10b468a235d87b21a3bda2db72e33947bfb..d3948a4017122757957ea0b44ba9bc82bd91f934 100644 (file)
Binary files a/models/SkyBox.blend1 and b/models/SkyBox.blend1 differ
index 6b679296578dfdda7cbb6990404a7270ebcf6273..95fc6f04eb32e6739340189fc3301890e3d3adda 100644 (file)
@@ -5,53 +5,86 @@
       <author>Blender User</author>
       <authoring_tool>Blender 2.73.0 commit date:2015-01-20, commit time:18:16, hash:bbf09d9</authoring_tool>
     </contributor>
-    <created>2015-04-21T11:48:56</created>
-    <modified>2015-04-21T11:48:56</modified>
+    <created>2015-05-12T23:50:25</created>
+    <modified>2015-05-12T23:50:25</modified>
     <unit name="meter" meter="1"/>
     <up_axis>Z_UP</up_axis>
   </asset>
   <library_images/>
+  <library_effects>
+    <effect id="Material-effect">
+      <profile_COMMON>
+        <technique sid="common">
+          <phong>
+            <emission>
+              <color sid="emission">0 0 0 1</color>
+            </emission>
+            <ambient>
+              <color sid="ambient">0 0 0 1</color>
+            </ambient>
+            <diffuse>
+              <color sid="diffuse">0.64 0.64 0.64 1</color>
+            </diffuse>
+            <specular>
+              <color sid="specular">0.5 0.5 0.5 1</color>
+            </specular>
+            <shininess>
+              <float sid="shininess">50</float>
+            </shininess>
+            <index_of_refraction>
+              <float sid="index_of_refraction">1</float>
+            </index_of_refraction>
+          </phong>
+        </technique>
+      </profile_COMMON>
+    </effect>
+  </library_effects>
+  <library_materials>
+    <material id="Material-material" name="Material">
+      <instance_effect url="#Material-effect"/>
+    </material>
+  </library_materials>
   <library_geometries>
-    <geometry id="Plane-mesh" name="Plane">
+    <geometry id="Cube-mesh" name="Cube">
       <mesh>
-        <source id="Plane-mesh-positions">
-          <float_array id="Plane-mesh-positions-array" count="12">-1 -1 0 1 -1 0 -1 1 0 1 1 0</float_array>
+        <source id="Cube-mesh-positions">
+          <float_array id="Cube-mesh-positions-array" count="24">-1 -1.000001 -0.9999997 -1 -0.9999994 1 -1 1.000001 0.9999992 -1 0.9999993 -1.000001 1 -1.000001 -0.9999989 0.9999999 -0.9999988 1.000001 1 1.000001 0.9999992 1 0.9999998 -1</float_array>
           <technique_common>
-            <accessor source="#Plane-mesh-positions-array" count="4" stride="3">
+            <accessor source="#Cube-mesh-positions-array" count="8" stride="3">
               <param name="X" type="float"/>
               <param name="Y" type="float"/>
               <param name="Z" type="float"/>
             </accessor>
           </technique_common>
         </source>
-        <source id="Plane-mesh-normals">
-          <float_array id="Plane-mesh-normals-array" count="6">0 0 1 0 0 1</float_array>
+        <source id="Cube-mesh-normals">
+          <float_array id="Cube-mesh-normals-array" count="36">1 0 0 -1 0 0 -2.98023e-7 1 -1.13249e-6 0 -1.01328e-6 -1 2.38418e-7 -1 7.7486e-7 -2.38419e-7 6.55651e-7 1 1 0 0 -1 0 -1.19209e-7 2.38419e-7 1 -5.96046e-7 3.57628e-7 -6.55651e-7 -1 1.19209e-7 -1 6.55651e-7 -3.57628e-7 7.7486e-7 1</float_array>
           <technique_common>
-            <accessor source="#Plane-mesh-normals-array" count="2" stride="3">
+            <accessor source="#Cube-mesh-normals-array" count="12" stride="3">
               <param name="X" type="float"/>
               <param name="Y" type="float"/>
               <param name="Z" type="float"/>
             </accessor>
           </technique_common>
         </source>
-        <source id="Plane-mesh-map-0">
-          <float_array id="Plane-mesh-map-0-array" count="12">0.9999001 9.998e-5 0.9999001 0.9999001 9.998e-5 0.9999001 1.0004e-4 9.998e-5 0.9999001 9.998e-5 9.998e-5 0.9999001</float_array>
+        <source id="Cube-mesh-map-0">
+          <float_array id="Cube-mesh-map-0-array" count="72">0.496875 0.668125 0.246875 0.668125 0.246875 0.338125 0.996875 0.3381249 0.996875 0.668125 0.746875 0.668125 0.246875 0.338125 0.2468749 0.008125007 0.4968749 0.008125007 0.246875 0.668125 -0.003124952 0.6681251 -0.003124952 0.3381251 0.246875 0.668125 0.496875 0.668125 0.4968751 0.998125 0.746875 0.668125 0.496875 0.668125 0.496875 0.338125 0.496875 0.338125 0.496875 0.668125 0.246875 0.338125 0.746875 0.338125 0.996875 0.3381249 0.746875 0.668125 0.496875 0.338125 0.246875 0.338125 0.4968749 0.008125007 0.246875 0.338125 0.246875 0.668125 -0.003124952 0.3381251 0.2468751 0.9981251 0.246875 0.668125 0.4968751 0.998125 0.746875 0.338125 0.746875 0.668125 0.496875 0.338125</float_array>
           <technique_common>
-            <accessor source="#Plane-mesh-map-0-array" count="6" stride="2">
+            <accessor source="#Cube-mesh-map-0-array" count="36" stride="2">
               <param name="S" type="float"/>
               <param name="T" type="float"/>
             </accessor>
           </technique_common>
         </source>
-        <vertices id="Plane-mesh-vertices">
-          <input semantic="POSITION" source="#Plane-mesh-positions"/>
+        <vertices id="Cube-mesh-vertices">
+          <input semantic="POSITION" source="#Cube-mesh-positions"/>
         </vertices>
-        <polylist count="2">
-          <input semantic="VERTEX" source="#Plane-mesh-vertices" offset="0"/>
-          <input semantic="NORMAL" source="#Plane-mesh-normals" offset="1"/>
-          <input semantic="TEXCOORD" source="#Plane-mesh-map-0" offset="2" set="0"/>
-          <vcount>3 3 </vcount>
-          <p>1 0 0 3 0 1 2 0 2 0 1 3 1 1 4 2 1 5</p>
+        <polylist material="Material-material" count="12">
+          <input semantic="VERTEX" source="#Cube-mesh-vertices" offset="0"/>
+          <input semantic="NORMAL" source="#Cube-mesh-normals" offset="1"/>
+          <input semantic="TEXCOORD" source="#Cube-mesh-map-0" offset="2" set="0"/>
+          <vcount>3 3 3 3 3 3 3 3 3 3 3 3 </vcount>
+          <p>3 0 0 2 0 1 1 0 2 5 1 3 6 1 4 7 1 5 1 2 6 5 2 7 4 2 8 2 3 9 6 3 10 5 3 11 2 4 12 3 4 13 7 4 14 7 5 15 3 5 16 0 5 17 0 6 18 3 6 19 1 6 20 4 7 21 5 7 22 7 7 23 0 8 24 1 8 25 4 8 26 1 9 27 2 9 28 5 9 29 6 10 30 2 10 31 7 10 32 4 11 33 7 11 34 0 11 35</p>
         </polylist>
       </mesh>
     </geometry>
   <library_controllers/>
   <library_visual_scenes>
     <visual_scene id="Scene" name="Scene">
-      <node id="Plane" name="Plane" type="NODE">
-        <matrix sid="transform">2 0 0 0 0 -8.74228e-8 -2 0 0 2 -8.74228e-8 0 0 0 0 1</matrix>
-        <instance_geometry url="#Plane-mesh"/>
+      <node id="Cube" name="Cube" type="NODE">
+        <matrix sid="transform">1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1</matrix>
+        <instance_geometry url="#Cube-mesh">
+          <bind_material>
+            <technique_common>
+              <instance_material symbol="Material-material" target="#Material-material"/>
+            </technique_common>
+          </bind_material>
+        </instance_geometry>
       </node>
     </visual_scene>
   </library_visual_scenes>
index 78881cc4413f21cdbc8c577c69cee514023870b0..f017f1fba417f86ccf778eea055ae0222fee305c 100644 (file)
@@ -10,7 +10,7 @@ out vec2 fUVs;
 out vec3  PointLightPosition1, DirectionalLightDirection1;
 
 //uniform vec3 PointLightPosition1, DirectionalLightDirection1;
-uniform mat4 uProjection, uView, uModel;
+uniform mat4 uProjection, uView, uModel=mat4(1.f);
 
 uniform int uEnableBloom = 1;
 uniform int uEnableTransp = 1;
diff --git a/shader/skybox_FS.hlsl b/shader/skybox_FS.hlsl
deleted file mode 100644 (file)
index 1e1c0cc..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-//Fragment Shader
-#version 330
-uniform samplerCube uColorTexture;
-
-smooth in vec3 eyeDirection;
-out vec4 FragmentColor;
-void main(){
-       FragmentColor = texture(uColorTexture, eyeDirection);
-}
index 2b85546587cdbbf6ecbc062c38095d3cb7139921..f30317dc3828eda196893310697b19f15677e07e 100644 (file)
@@ -1,21 +1,16 @@
 //Vertex Shader
 #version 330
 
-in vec3 aPosition;
+in vec3 aNormal, aPosition;
+in vec2 aUV;
 
-uniform mat4 uInvProjection;
-uniform mat4 uModel;
-uniform mat4 uView;
+out vec2 fUVs;
 
-smooth out vec3 eyeDirection;
+uniform mat4 uProjection, uView, uModel=mat4(1.f);
 
-void main() {
-//     mat4 invProjection = inverse(uProjection);
-       mat3 invModelview = transpose(mat3(uView));
-       vec3 unprojected = (uInvProjection * vec4(aPosition, 1)).xyz;
-       eyeDirection = invModelview * unprojected;
-       //eyeDirection = unprojected;
-       //eyeDirection = aPosition;
+void main()
+{
 
-       gl_Position = vec4(aPosition,1);
+       fUVs = aUV;
+       gl_Position = (uProjection * uView * uModel * vec4(aPosition, 1.f)).xyww;
 }
\ No newline at end of file
diff --git a/shader/skybox_color_FS.hlsl b/shader/skybox_color_FS.hlsl
deleted file mode 100644 (file)
index 1724745..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-//Fragment Shader
-#version 330
-
-smooth in vec3 eyeDirection;
-out vec4 FragmentColor;
-void main(){
-       FragmentColor = vec4((eyeDirection+vec3(2.f))/4, 0.5);
-}
diff --git a/shader/skyplane_FS.hlsl b/shader/skyplane_FS.hlsl
new file mode 100644 (file)
index 0000000..1e1c0cc
--- /dev/null
@@ -0,0 +1,10 @@
+//Fragment Shader
+#version 330
+uniform samplerCube uColorTexture;
+
+smooth in vec3 eyeDirection;
+out vec4 FragmentColor;
+void main(){
+       FragmentColor = texture(uColorTexture, eyeDirection);
+}
diff --git a/shader/skyplane_VS.hlsl b/shader/skyplane_VS.hlsl
new file mode 100644 (file)
index 0000000..2b85546
--- /dev/null
@@ -0,0 +1,21 @@
+//Vertex Shader
+#version 330
+
+in vec3 aPosition;
+
+uniform mat4 uInvProjection;
+uniform mat4 uModel;
+uniform mat4 uView;
+
+smooth out vec3 eyeDirection;
+
+void main() {
+//     mat4 invProjection = inverse(uProjection);
+       mat3 invModelview = transpose(mat3(uView));
+       vec3 unprojected = (uInvProjection * vec4(aPosition, 1)).xyz;
+       eyeDirection = invModelview * unprojected;
+       //eyeDirection = unprojected;
+       //eyeDirection = aPosition;
+
+       gl_Position = vec4(aPosition,1);
+}
\ No newline at end of file
diff --git a/shader/skyplane_color_FS.hlsl b/shader/skyplane_color_FS.hlsl
new file mode 100644 (file)
index 0000000..1724745
--- /dev/null
@@ -0,0 +1,9 @@
+//Fragment Shader
+#version 330
+
+smooth in vec3 eyeDirection;
+out vec4 FragmentColor;
+void main(){
+       FragmentColor = vec4((eyeDirection+vec3(2.f))/4, 0.5);
+}
diff --git a/textures/model_levelTest_2D.jpg b/textures/model_levelTest_2D.jpg
new file mode 100644 (file)
index 0000000..07c2123
Binary files /dev/null and b/textures/model_levelTest_2D.jpg differ
diff --git a/textures/model_skybox_2D.jpg b/textures/model_skybox_2D.jpg
new file mode 100644 (file)
index 0000000..695846a
Binary files /dev/null and b/textures/model_skybox_2D.jpg differ
diff --git a/textures/model_skybox_2D.png b/textures/model_skybox_2D.png
new file mode 100644 (file)
index 0000000..d70e4cb
Binary files /dev/null and b/textures/model_skybox_2D.png differ
diff --git a/textures/model_skybox_CUBE.png b/textures/model_skybox_CUBE.png
deleted file mode 100644 (file)
index beb0696..0000000
Binary files a/textures/model_skybox_CUBE.png and /dev/null differ
diff --git a/textures/skybox_2D.jpg b/textures/skybox_2D.jpg
new file mode 100644 (file)
index 0000000..dfbc845
Binary files /dev/null and b/textures/skybox_2D.jpg differ
diff --git a/textures/skybox_CUBE.jpg b/textures/skybox_CUBE.jpg
deleted file mode 100644 (file)
index dfbc845..0000000
Binary files a/textures/skybox_CUBE.jpg and /dev/null differ