]> git.leopard-lacewing.eu Git - cgue_weave.git/commitdiff
updated .gitignore
authorPeter Schaefer <schaeferpm@gmail.com>
Thu, 16 Apr 2015 08:44:38 +0000 (10:44 +0200)
committerPeter Schaefer <schaeferpm@gmail.com>
Thu, 16 Apr 2015 08:44:38 +0000 (10:44 +0200)
renamed ShaderVariables
started SkyBox (not Working)
added Box & SkyBox (Plane)
started new ModelMatrixType (matM)

25 files changed:
.gitignore
CGUE2015_Weave.sln
Weave/Game.cpp
Weave/Graphix/GLM.h
Weave/Graphix/Model.cpp
Weave/Graphix/Model.h
Weave/Graphix/ViewPort.cpp
Weave/Graphix/matM.cpp [new file with mode: 0644]
Weave/Graphix/matM.h [new file with mode: 0644]
Weave/Message.cpp
models/SkyBox.blend [new file with mode: 0644]
models/SkyBox.blend1 [new file with mode: 0644]
models/SkyBox.dae [new file with mode: 0644]
models/box/box.blend [new file with mode: 0644]
models/box/box.blend1 [new file with mode: 0644]
models/box/box.dae [new file with mode: 0644]
shader/basicTexture_FS.hlsl
shader/basicTexture_VS.hlsl
shader/basic_FS.hlsl
shader/basic_VS.hlsl
shader/lightingTexture_FS.hlsl
shader/perspective_VS.hlsl
shader/skybox_FS.hlsl [new file with mode: 0644]
shader/skybox_VS.hlsl [new file with mode: 0644]
textures/model_skybox.png [new file with mode: 0644]

index e4baabc0b6267efb8af17b1faaa95381dc37e65d..593d577bced494fd878ed7fe21faabbe684faa6a 100644 (file)
@@ -6,12 +6,12 @@
 *.opensdf
 build-*
 
-bin/*.exe
-bin/*.pdb
+*.exe
+*.pdb
+*.ilk
+*.bsc
+
 Submission*
 
-Debug/*.ilk
-Debug/*.exe
-Debug/*.pdb
 RES
 *.[Cc]ache
\ No newline at end of file
index e9d1777eeb8de9dfe6f721f7b9e8cff658aab9a4..e49e506008ec21e15c0502ae120cf98ae4e9c264 100644 (file)
@@ -13,6 +13,8 @@ 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_FS.hlsl = shader\skybox_FS.hlsl
+               shader\skybox_VS.hlsl = shader\skybox_VS.hlsl
        EndProjectSection
 EndProject
 Global
index 31eab2fc6c1597a9935fd23f4a24a2bf1c99b40d..8269c8682279938e797d0dc14605a64f8c58b3bf 100644 (file)
@@ -44,6 +44,7 @@ Game::Game() : playing(true)
 
        //Allg Shader
        Shader* shader1 = new Shader("basicTexture_VS.hlsl", "lightingTexture_FS.hlsl");
+       Shader* shaderSky = new Shader("skybox_VS.hlsl", "skybox_FS.hlsl");
 
        //Player
        SceneObject* tmp_playerObject = new SceneObject(shader1, translate(vec3(1.f, 0.f, 1.f)), "Player.dae", "model_player.png");
@@ -91,6 +92,8 @@ Game::Game() : playing(true)
 
        //import("level_test.dae", tmp_Scene, shader1);
 
+       //tmp_Scene->addObject(new SceneObject(shaderSky, glm::mat4(1.0f), "SkyBox.dae", "model_skybox.png"));
+
 }
 
 
index 4cf11864be538eb18b52214f73c951f21254ae5d..4c95c5e1daf424a3f480a911ec141b4fda69e589 100644 (file)
@@ -34,3 +34,5 @@ using glm::sign;
 
 
 float VektorAbs(const vec3& vek);
+
+//#include "matM.h"
index aa1998b44b5db23a6e5bb912520d145ffb702944..b237e91e1a8e01de8108b2f8aca2998c405f3de7 100644 (file)
@@ -127,13 +127,13 @@ void Model::useTexture(Texture* _texture, Shader* _shader) const
        {
                int unit = 0;
                _texture->bind(unit);
-               glUniform1i(_shader->getUniformLocation("ColorTexture"), unit);
+               glUniform1i(_shader->getUniformLocation("uColorTexture"), unit);
        }
 }
 
 void Model::useMMatrix(const mat4& _model, Shader* _shader) const
 {
-       glUniformMatrix4fv(_shader->getUniformLocation("model"), 1, GL_FALSE, value_ptr(_model));
+       glUniformMatrix4fv(_shader->getUniformLocation("uModel"), 1, GL_FALSE, value_ptr(_model));
 }
 
 void Model::drawModel(Shader* _shader, Texture* _texture, const mat4& _model) const
@@ -157,9 +157,9 @@ unsigned int Model::bindShader(Shader* _shader)
        glGenVertexArrays(1, &vao);
        glBindVertexArray(vao);
 
-       bindBuffer(vertexBuffer, _shader->getAttribLocation("position"));
-       bindBuffer(uvBuffer, _shader->getAttribLocation("uv"), 2);
-       bindBuffer(normalBuffer, _shader->getAttribLocation("normal"));
+       bindBuffer(vertexBuffer, _shader->getAttribLocation("aPosition"));
+       bindBuffer(uvBuffer, _shader->getAttribLocation("aUV"), 2);
+       bindBuffer(normalBuffer, _shader->getAttribLocation("aNormal"));
 
        glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, indexBuffer);
 
index cdf6c91d351c6d3d6882e7d90a1da1e0d53d9aa9..778becb4f3d93be5c4562f25ddc27565d64e67e9 100644 (file)
@@ -21,6 +21,7 @@ public:
        __declspec(deprecated)
        Model(const string& modelpath, unsigned int index=0);
        Model(const aiMesh* mesh);
+       __declspec(deprecated)
        Model(unsigned int numvertices, unsigned int numfaces, float *vertex, float *uvs, float *normals, unsigned int *index);
 
        virtual ~Model();
index d37eb4357cfdfdc414fa1f356020dd9525f3ea4f..418c1d8f0e227d515b3ef9298a488dc609eaaefa 100644 (file)
@@ -35,14 +35,14 @@ void ViewPort::useViewPort() const
 
 void ViewPort::bindView(Shader* shader) const{
        shader->useShader();
-       glUniformMatrix4fv(shader->getUniformLocation("projection"), 1, false, value_ptr(projection));
-       glUniformMatrix4fv(shader->getUniformLocation("view"), 1, false, value_ptr(view));
+       glUniformMatrix4fv(shader->getUniformLocation("uProjection"), 1, false, value_ptr(projection));
+       glUniformMatrix4fv(shader->getUniformLocation("uView"), 1, false, value_ptr(view));
 }
 
 void ViewPort::bindView(Shader* shader, vec3 pos) const{
        shader->useShader();
-       glUniformMatrix4fv(shader->getUniformLocation("projection"), 1, false, value_ptr(projection));
-       glUniformMatrix4fv(shader->getUniformLocation("view"), 1, false, value_ptr(translate(view,-pos)));
+       glUniformMatrix4fv(shader->getUniformLocation("uProjection"), 1, false, value_ptr(projection));
+       glUniformMatrix4fv(shader->getUniformLocation("uView"), 1, false, value_ptr(translate(view,-pos)));
 }
 
 void ViewPort::rotateView(float angle_x, float angle_y){
diff --git a/Weave/Graphix/matM.cpp b/Weave/Graphix/matM.cpp
new file mode 100644 (file)
index 0000000..85e4f07
--- /dev/null
@@ -0,0 +1,60 @@
+#include "matM.h"
+
+#include "GLM.h"
+
+
+matM::matM()
+{
+}
+
+
+matM::~matM()
+{
+}
+
+void matM::transform()
+{
+}
+
+void matM::rotate()
+{
+}
+
+void matM::rotateC()
+{
+}
+
+void matM::skale()
+{
+}
+
+void matM::skaleC()
+{
+}
+
+
+void matM::setPosition()
+{
+}
+
+
+mat4 matM::getMat4() const
+{
+       return mat4(1.f);
+}
+
+matM::operator mat4() const
+{
+       return mat4(1.f);
+}
+
+
+vec3 matM::getPosition() const
+{
+       return vec3(0.f);
+}
+
+matM::operator vec3() const
+{
+       return vec3(0.f);
+}
diff --git a/Weave/Graphix/matM.h b/Weave/Graphix/matM.h
new file mode 100644 (file)
index 0000000..fbfbb0d
--- /dev/null
@@ -0,0 +1,31 @@
+#pragma once
+
+#include "glm\glm.hpp"
+
+using glm::mat4;
+using glm::vec3;
+
+class matM
+{
+public:
+       matM();
+       ~matM();
+
+       void transform();
+       void rotate();
+       void rotateC();
+       void skale();
+       void skaleC();
+
+       void setPosition();
+
+       mat4 getMat4() const;
+       operator mat4() const;
+
+       vec3 getPosition() const;
+       operator vec3() const;
+
+private:
+       mat4 matrix;
+};
+
index 82af28ee67ce6f25b5c388ee03842aee37aeafe1..1d1d0204ad928e10e30a5d26e30919f01bb7ebdb 100644 (file)
@@ -19,7 +19,7 @@ void Message::error(string _msg)
 {
        cerr << currentDateTime() << " E " << _msg << endl;
        system("pause");
-       exit(-1);
+//     exit(-1);
 }
 
 void Message::warning(string _msg)
diff --git a/models/SkyBox.blend b/models/SkyBox.blend
new file mode 100644 (file)
index 0000000..c549e10
Binary files /dev/null and b/models/SkyBox.blend differ
diff --git a/models/SkyBox.blend1 b/models/SkyBox.blend1
new file mode 100644 (file)
index 0000000..55de0ed
Binary files /dev/null and b/models/SkyBox.blend1 differ
diff --git a/models/SkyBox.dae b/models/SkyBox.dae
new file mode 100644 (file)
index 0000000..a98e098
--- /dev/null
@@ -0,0 +1,71 @@
+<?xml version="1.0" encoding="utf-8"?>
+<COLLADA xmlns="http://www.collada.org/2005/11/COLLADASchema" version="1.4.1">
+  <asset>
+    <contributor>
+      <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-16T10:05:45</created>
+    <modified>2015-04-16T10:05:45</modified>
+    <unit name="meter" meter="1"/>
+    <up_axis>Z_UP</up_axis>
+  </asset>
+  <library_images/>
+  <library_geometries>
+    <geometry id="Plane-mesh" name="Plane">
+      <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>
+          <technique_common>
+            <accessor source="#Plane-mesh-positions-array" count="4" 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>
+          <technique_common>
+            <accessor source="#Plane-mesh-normals-array" count="2" 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>
+          <technique_common>
+            <accessor source="#Plane-mesh-map-0-array" count="6" 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>
+        <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>
+      </mesh>
+    </geometry>
+  </library_geometries>
+  <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 2 0 0 0 0 2 0 0 0 0 1</matrix>
+        <instance_geometry url="#Plane-mesh"/>
+      </node>
+    </visual_scene>
+  </library_visual_scenes>
+  <scene>
+    <instance_visual_scene url="#Scene"/>
+  </scene>
+</COLLADA>
\ No newline at end of file
diff --git a/models/box/box.blend b/models/box/box.blend
new file mode 100644 (file)
index 0000000..783ffa4
Binary files /dev/null and b/models/box/box.blend differ
diff --git a/models/box/box.blend1 b/models/box/box.blend1
new file mode 100644 (file)
index 0000000..83b4df4
Binary files /dev/null and b/models/box/box.blend1 differ
diff --git a/models/box/box.dae b/models/box/box.dae
new file mode 100644 (file)
index 0000000..5dd63d4
--- /dev/null
@@ -0,0 +1,212 @@
+<?xml version="1.0" encoding="utf-8"?>
+<COLLADA xmlns="http://www.collada.org/2005/11/COLLADASchema" version="1.4.1">
+  <asset>
+    <contributor>
+      <author>Blender User</author>
+      <authoring_tool>Blender 2.66.1 r55078</authoring_tool>
+    </contributor>
+    <created>2014-05-04T16:54:05</created>
+    <modified>2014-05-04T16:54:05</modified>
+    <unit name="meter" meter="1"/>
+    <up_axis>Z_UP</up_axis>
+  </asset>
+  <library_cameras>
+    <camera id="Camera-camera" name="Camera">
+      <optics>
+        <technique_common>
+          <perspective>
+            <xfov sid="xfov">49.13434</xfov>
+            <aspect_ratio>1.777778</aspect_ratio>
+            <znear sid="znear">0.1</znear>
+            <zfar sid="zfar">100</zfar>
+          </perspective>
+        </technique_common>
+      </optics>
+    </camera>
+  </library_cameras>
+  <library_lights>
+    <light id="Lamp-light" name="Lamp">
+      <technique_common>
+        <point>
+          <color sid="color">1 1 1</color>
+          <constant_attenuation>1</constant_attenuation>
+          <linear_attenuation>0</linear_attenuation>
+          <quadratic_attenuation>0.00111109</quadratic_attenuation>
+        </point>
+      </technique_common>
+      <extra>
+        <technique profile="blender">
+          <adapt_thresh>0.000999987</adapt_thresh>
+          <area_shape>1</area_shape>
+          <area_size>0.1</area_size>
+          <area_sizey>0.1</area_sizey>
+          <area_sizez>1</area_sizez>
+          <atm_distance_factor>1</atm_distance_factor>
+          <atm_extinction_factor>1</atm_extinction_factor>
+          <atm_turbidity>2</atm_turbidity>
+          <att1>0</att1>
+          <att2>1</att2>
+          <backscattered_light>1</backscattered_light>
+          <bias>1</bias>
+          <blue>1</blue>
+          <buffers>1</buffers>
+          <bufflag>0</bufflag>
+          <bufsize>2880</bufsize>
+          <buftype>2</buftype>
+          <clipend>30.002</clipend>
+          <clipsta>1.000799</clipsta>
+          <compressthresh>0.04999995</compressthresh>
+          <dist sid="blender_dist">29.99998</dist>
+          <energy sid="blender_energy">1</energy>
+          <falloff_type>2</falloff_type>
+          <filtertype>0</filtertype>
+          <flag>0</flag>
+          <gamma sid="blender_gamma">1</gamma>
+          <green>1</green>
+          <halo_intensity sid="blnder_halo_intensity">1</halo_intensity>
+          <horizon_brightness>1</horizon_brightness>
+          <mode>8192</mode>
+          <ray_samp>1</ray_samp>
+          <ray_samp_method>1</ray_samp_method>
+          <ray_samp_type>0</ray_samp_type>
+          <ray_sampy>1</ray_sampy>
+          <ray_sampz>1</ray_sampz>
+          <red>1</red>
+          <samp>3</samp>
+          <shadhalostep>0</shadhalostep>
+          <shadow_b sid="blender_shadow_b">0</shadow_b>
+          <shadow_g sid="blender_shadow_g">0</shadow_g>
+          <shadow_r sid="blender_shadow_r">0</shadow_r>
+          <shadspotsize>45</shadspotsize>
+          <sky_colorspace>0</sky_colorspace>
+          <sky_exposure>1</sky_exposure>
+          <skyblendfac>1</skyblendfac>
+          <skyblendtype>1</skyblendtype>
+          <soft>3</soft>
+          <spotblend>0.15</spotblend>
+          <spotsize>75</spotsize>
+          <spread>1</spread>
+          <sun_brightness>1</sun_brightness>
+          <sun_effect_type>0</sun_effect_type>
+          <sun_intensity>1</sun_intensity>
+          <sun_size>1</sun_size>
+          <type>0</type>
+        </technique>
+      </extra>
+    </light>
+  </library_lights>
+  <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>
+        <extra>
+          <technique profile="GOOGLEEARTH">
+            <double_sided>1</double_sided>
+          </technique>
+        </extra>
+      </profile_COMMON>
+      <extra><technique profile="MAX3D"><double_sided>1</double_sided></technique></extra>
+    </effect>
+  </library_effects>
+  <library_materials>
+    <material id="Material-material" name="Material">
+      <instance_effect url="#Material-effect"/>
+    </material>
+  </library_materials>
+  <library_geometries>
+    <geometry id="Cube-mesh" name="Cube">
+      <mesh>
+        <source id="Cube-mesh-positions">
+          <float_array id="Cube-mesh-positions-array" count="24">1 1 -1 1 -1 -1 -1 -0.9999998 -1 -0.9999997 1 -1 1 0.9999995 1 0.9999994 -1.000001 1 -1 -0.9999997 1 -1 1 1</float_array>
+          <technique_common>
+            <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="Cube-mesh-normals">
+          <float_array id="Cube-mesh-normals-array" count="18">0 0 -1 0 0 1 1 -2.83122e-7 0 -2.83122e-7 -1 0 -1 2.23517e-7 -1.3411e-7 2.38419e-7 1 2.08616e-7</float_array>
+          <technique_common>
+            <accessor source="#Cube-mesh-normals-array" count="6" stride="3">
+              <param name="X" type="float"/>
+              <param name="Y" type="float"/>
+              <param name="Z" type="float"/>
+            </accessor>
+          </technique_common>
+        </source>
+        <source id="Cube-mesh-map-0">
+          <float_array id="Cube-mesh-map-0-array" count="48">0 0 0 -1 -1 -0.9999999 -0.9999998 2.38419e-7 2.38419e-7 0.9999998 -1 1 -1 1.78814e-7 -3.57628e-7 -2.98023e-7 0 0 -2.38419e-7 1 -1 1 -1 0 0 0 -3.57628e-7 1 -1 1 -1 0 0 0 1.78814e-7 1 1 1 1 0 2.38419e-7 0 0 -1 -0.9999998 -1 -1 0</float_array>
+          <technique_common>
+            <accessor source="#Cube-mesh-map-0-array" count="24" stride="2">
+              <param name="S" type="float"/>
+              <param name="T" type="float"/>
+            </accessor>
+          </technique_common>
+        </source>
+        <vertices id="Cube-mesh-vertices">
+          <input semantic="POSITION" source="#Cube-mesh-positions"/>
+        </vertices>
+        <polylist material="Material-material" count="6">
+          <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>4 4 4 4 4 4 </vcount>
+          <p>0 0 0 1 0 1 2 0 2 3 0 3 4 1 4 7 1 5 6 1 6 5 1 7 0 2 8 4 2 9 5 2 10 1 2 11 1 3 12 5 3 13 6 3 14 2 3 15 2 4 16 6 4 17 7 4 18 3 4 19 4 5 20 0 5 21 3 5 22 7 5 23</p>
+        </polylist>
+      </mesh>
+      <extra><technique profile="MAYA"><double_sided>1</double_sided></technique></extra>
+    </geometry>
+  </library_geometries>
+  <library_controllers/>
+  <library_visual_scenes>
+    <visual_scene id="Scene" name="Scene">
+      <node id="Camera" name="Camera" type="NODE">
+        <matrix sid="transform">0.6858805 -0.3173701 0.6548619 7.481132 0.7276338 0.3124686 -0.6106656 -6.50764 -0.01081678 0.8953432 0.4452454 5.343665 0 0 0 1</matrix>
+        <instance_camera url="#Camera-camera"/>
+      </node>
+      <node id="Lamp" name="Lamp" type="NODE">
+        <matrix sid="transform">-0.2908646 -0.7711008 0.5663932 4.076245 0.9551712 -0.1998834 0.2183912 1.005454 -0.05518906 0.6045247 0.7946723 5.903862 0 0 0 1</matrix>
+        <instance_light url="#Lamp-light"/>
+      </node>
+      <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">
+                <bind_vertex_input semantic="UVMap" input_semantic="TEXCOORD" input_set="0"/>
+              </instance_material>
+            </technique_common>
+          </bind_material>
+        </instance_geometry>
+      </node>
+    </visual_scene>
+  </library_visual_scenes>
+  <scene>
+    <instance_visual_scene url="#Scene"/>
+  </scene>
+</COLLADA>
\ No newline at end of file
index daaefbc7c3e7808e74b62ba448bcf260b4f81a68..1d8048d96ca8160b6cc5cd96a7188ceb7dc28e42 100644 (file)
@@ -3,12 +3,11 @@
 //in worldNormal;
 in vec2 fUVs;
 
-out vec4 color;
+out vec4 FragmentColor;
 
-uniform sampler2D ColorTexture;
+uniform sampler2D uColorTexture;
  
 void main()
 {
-       vec3 uvColor = texture(ColorTexture, fUVs).rgb;
-       color = vec4(uvColor, 0.7);
+       FragmentColor = vec4(texture(uColorTexture, fUVs).rgb, 0.7);
 }
\ No newline at end of file
index 3b2d055de95783637954ea14d1bed4b4c8f1aced..bd3bd421fd2a3bff5c96c532120c350e47ed39b6 100644 (file)
@@ -1,19 +1,18 @@
 //Vertex Shader
 #version 330
 
-in vec3 normal, position;
-//in vec3 lightposition
-in vec2 uv;
+in vec3 aNormal, aPosition;
+//in vec3 lightPosition
+in vec2 aUV;
 
 out vec3 worldNormal, worldLightPoint1;
 out vec2 fUVs;
-out float visNormal, SpecularCosPoint1, SpecularCosDirection1;
+out float SpecularCosPoint1, SpecularCosDirection1;
 
-uniform mat4 projection, view, model;
-uniform int inv = 1;
+uniform mat4 uProjection, uView, uModel;
 
-uniform int bloom = 1;
-uniform int transp = 1;
+uniform int uEnableBloom = 1;
+uniform int uEnableTransp = 1;
 
 void main()
 {
@@ -25,18 +24,16 @@ void main()
        vec3 DirectionalLightDirection1 = normalize(vec3(-2.0f, -2.0f, -2.0f));
 
 
-       fUVs = uv;
-       vec4 world_position = model * vec4(position, 1);
-       worldLightPoint1 = PointLightPosition1 - world_position.xyz;
+       fUVs = aUV;
+       vec4 world_Position = uModel * vec4(aPosition, 1);
+       worldLightPoint1 = PointLightPosition1 - world_Position.xyz;
 
-       gl_Position = projection * view * world_position;
-       worldNormal = (model * inv * vec4(normal, 0.0f)).xyz;
-//     visNormal = (view * vec4(worldNormal, 0.0f)).z;
+       gl_Position = uProjection * uView * world_Position;
+       worldNormal = (uModel * vec4(aNormal, 0.0f)).xyz;
 
+       SpecularCosPoint1 = clamp(dot(vec3(0.0f, 0.0f, -1.0f), normalize((uProjection * uView * vec4(reflect(-PointLightPosition1, worldNormal), 0.0f)).xyz)), 0, 1);
+       SpecularCosDirection1 = clamp(dot(vec3(0.0f, 0.0f, -1.0f), normalize((uProjection * uView * vec4(reflect(-DirectionalLightDirection1, worldNormal), 0.0f)).xyz)), 0, 1);
 
-       SpecularCosPoint1 = clamp(dot(vec3(0.0f, 0.0f, -1.0f), normalize((projection * view * vec4(reflect(-PointLightPosition1, worldNormal), 0.0f)).xyz)), 0, 1);
-       SpecularCosDirection1 = clamp(dot(vec3(0.0f, 0.0f, -1.0f), normalize((projection * view * vec4(reflect(-DirectionalLightDirection1, worldNormal), 0.0f)).xyz)), 0, 1);
 
-
-       //worldNormal = vec3(SpecularCos, SpecularCos, SpecularCos);
+       //worldnormal = vec3(SpecularCos, SpecularCos, SpecularCos);
 }
\ No newline at end of file
index fd96435367fcd000542a1bb2eb2e8ebe997a461d..d17d2137f3e49df3a7060e453181fe3788a33187 100644 (file)
@@ -1,7 +1,7 @@
 //Fragment Shader
 #version 330
-out vec4 color;
+out vec4 FragmentColor;
  
 void main(){
-    color = vec4(0,0.3,0,0.6);
+       FragmentColor = vec4(0, 0.3, 0, 0.6);
 }
\ No newline at end of file
index 15e757ec203541b352e56f244a08516d84ea8dd6..2d4c11c8489b95b52fc17edd658f8bc3a35c53a5 100644 (file)
@@ -1,12 +1,11 @@
 //Vertex Shader
 #version 330
 
-in vec3 position;
-uniform mat4 projection;
-uniform mat4 model;
-uniform mat4 view;
+in vec3 aPosition;
+uniform mat4 uProjection;
+uniform mat4 uModel;
+uniform mat4 uView;
 
 void main(){
-       //gl_Position = projection * model * vec4(position, 1);
-       gl_Position = projection * view * model * vec4(position, 1);
+       gl_Position = uProjection * uView * uModel * vec4(aPosition, 1);
 }
\ No newline at end of file
index e36e62799375f0fb279ef71cc7832278b637ccf2..24faf9347e2b4377891d8293652187e7aee6cd76 100644 (file)
@@ -4,21 +4,16 @@ in vec3 worldNormal, worldLightPoint1;
 in vec2 fUVs;
 in float visNormal, SpecularCosPoint1, SpecularCosDirection1;
 
-out vec4 color;
+out vec4 FragmentColor;
 
-uniform sampler2D ColorTexture;
+uniform sampler2D uColorTexture;
  
 void main()
 {
-       //if (visNormal < -0.2)
-       //{
-       //      discard;
-       //}
+
        float specularConst = 3.0f;
        vec3 normal = normalize(worldNormal);
-       vec4 uvColor = texture(ColorTexture, fUVs);
-
-
+       vec4 uvColor = texture(uColorTexture, fUVs);
 
 
        vec3 PointLightDirection1 = normalize(worldLightPoint1);
@@ -35,22 +30,19 @@ void main()
 
        float squaredist1 = worldLightPoint1.x * worldLightPoint1.x + worldLightPoint1.y * worldLightPoint1.y + worldLightPoint1.z * worldLightPoint1.z;
 
-
-
        //if (uvColor.a < 0.3)
        //      discard;
 
-       
 
-       color = vec4(uvColor.rgb * (AmbientLightColor
+       FragmentColor = vec4(uvColor.rgb * (AmbientLightColor
                + PointLightColor1  * (cosThetaPoint1 + pow(SpecularCosPoint1, specularConst)) / squaredist1
                + DirectionalLightColor1  * (cosThetaDirection1 + pow(SpecularCosDirection1, specularConst))
                ), uvColor.a);
 
 
-       //color = vec4(worldNormal, 1.0f);
-       //color = vec4(length(DirectionalLightDirection1) - 1.0f, length(DirectionalLightDirection1) - 1.0f, length(DirectionalLightDirection1) - 1.0f, 1.0f);
+       //FragmentColor = vec4(worldNormal, 1.0f);
+       //FragmentColor = vec4(length(DirectionalLightDirection1) - 1.0f, length(DirectionalLightDirection1) - 1.0f, length(DirectionalLightDirection1) - 1.0f, 1.0f);
 
-       //vec3 uvColor = texture(ColorTexture, fUVs).rgb;
-       //color = vec4(uvColor, 1.0);
+       //vec3 uvColor = texture(uColorTexture, fUVs).rgb;
+       //FragmentColor = vec4(uvColor, 1.0);
 }
index 032eeef2a61e76b0c042d201e8376b788d9938cf..52dfb82fc4a0283f5a13842d4e948270595b5735 100644 (file)
@@ -1,12 +1,12 @@
 //Vertex Shader
 #version 330
 
-in vec3 position;
-uniform mat4 projection;
-uniform mat4 view;
-uniform mat4 model;
+in vec3 aPosition;
+uniform mat4 uProjection;
+uniform mat4 uView;
+uniform mat4 uModel;
 
 void main(){
-       gl_Position = projection * view * model * vec4(position, 1);
-       //gl_Position = projection * view * model * vec4(vertexPosition, 1);
+       gl_Position = uProjection * uView * uModel * vec4(aPosition, 1);
+       //gl_Position = uProjection * uView * uModel * vec4(vertexPosition, 1);
 }
\ No newline at end of file
diff --git a/shader/skybox_FS.hlsl b/shader/skybox_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/skybox_VS.hlsl b/shader/skybox_VS.hlsl
new file mode 100644 (file)
index 0000000..9c2cf3c
--- /dev/null
@@ -0,0 +1,18 @@
+//Vertex Shader
+#version 330
+
+in vec3 position;
+uniform mat4 projection;
+uniform mat4 model;
+uniform mat4 view;
+
+smooth out vec3 eyeDirection;
+
+void main() {
+       mat4 invProjection = inverse(projection);
+       mat3 invModelview = mat3(1);// transpose(mat3(model));
+       vec3 unprojected = (invProjection * vec4(position, 1)).xyz;
+       eyeDirection = invModelview * unprojected;
+
+       gl_Position = vec4(position,1);
+}
\ No newline at end of file
diff --git a/textures/model_skybox.png b/textures/model_skybox.png
new file mode 100644 (file)
index 0000000..beb0696
Binary files /dev/null and b/textures/model_skybox.png differ