*.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
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
//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");
//import("level_test.dae", tmp_Scene, shader1);
+ //tmp_Scene->addObject(new SceneObject(shaderSky, glm::mat4(1.0f), "SkyBox.dae", "model_skybox.png"));
+
}
float VektorAbs(const vec3& vek);
+
+//#include "matM.h"
{
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
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);
__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();
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){
--- /dev/null
+#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);
+}
--- /dev/null
+#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;
+};
+
{
cerr << currentDateTime() << " E " << _msg << endl;
system("pause");
- exit(-1);
+// exit(-1);
}
void Message::warning(string _msg)
--- /dev/null
+<?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
--- /dev/null
+<?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
//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
//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()
{
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
//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
//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
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);
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);
}
//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
--- /dev/null
+//Fragment Shader
+#version 330
+uniform samplerCube uColorTexture;
+
+smooth in vec3 eyeDirection;
+out vec4 FragmentColor;
+
+void main(){
+ FragmentColor = texture(uColorTexture, eyeDirection);
+}
--- /dev/null
+//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