Changeset 2148
- Timestamp:
- Dec 18, 2012, 10:59:23 PM (10 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/easymesh/easymesh.cpp
r2145 r2148 69 69 m_gpu.modelview = m_gpu.shader->GetUniformLocation("in_ModelView"); 70 70 m_gpu.view = m_gpu.shader->GetUniformLocation("in_View"); 71 m_gpu.invview = m_gpu.shader->GetUniformLocation("in_Inv_View"); 71 72 m_gpu.proj = m_gpu.shader->GetUniformLocation("in_Proj"); 72 73 m_gpu.normalmat = m_gpu.shader->GetUniformLocation("in_NormalMat"); … … 120 121 m_gpu.shader->SetUniform(m_gpu.modelview, modelview); 121 122 m_gpu.shader->SetUniform(m_gpu.view, Scene::GetDefault()->GetViewMatrix()); 123 m_gpu.shader->SetUniform(m_gpu.invview, inverse(Scene::GetDefault()->GetViewMatrix())); 122 124 m_gpu.shader->SetUniform(m_gpu.proj, Scene::GetDefault()->GetProjMatrix()); 123 125 m_gpu.shader->SetUniform(m_gpu.normalmat, normalmat); -
trunk/src/easymesh/easymesh.h
r2145 r2148 102 102 Shader *shader; 103 103 ShaderAttrib coord, norm, color; 104 ShaderUniform modelview, view, proj, normalmat, damage;104 ShaderUniform modelview, view, invview, proj, normalmat, damage; 105 105 VertexDeclaration *vdecl; 106 106 VertexBuffer *vbo; -
trunk/src/easymesh/shiny.lolfx
r2146 r2148 37 37 uniform float in_Damage; 38 38 uniform mat4 in_View; 39 uniform mat4 in_Inv_View; 39 40 40 41 varying vec4 pass_Vertex; /* View space */ … … 42 43 varying vec4 pass_Color; 43 44 44 // FIXME: the light direction should be passed in the code 45 // FIXME: all the light parameters should be passed in the code 46 //Dir Light 45 47 vec3 in_LightDir = vec3(-0.3, -0.3, -0.7); 46 vec4 in_Light2_Pos = vec4(0.0, 10.0, 0.0, 1.0); 48 49 //Point Light 50 vec4 in_Light2_Pos = vec4(20.0, 10.0, 0.0, 1.0); 47 51 float in_Light2_Radius = 20.0; 48 52 vec3 in_Light2_diffuse = vec3(0.4, 0.4, 1.0); 53 54 //Cube Light 55 vec4 in_Light3_Pos = vec4(-10.0, 10.0, 5.0, 1.0); 56 vec3 in_Light3_Size_Inner = vec3(1.0, 1.0, 1.0); 57 vec3 in_Light3_Size_Outer = vec3(10.0, 10.0, 10.0); 58 vec3 in_Light3_diffuse = vec3(0.4, 1.0, 0.4); 49 59 50 60 void main(void) … … 67 77 vec3 r = vec3(0.0, 0.0, 0.0); 68 78 float sdotn = 0.0; 79 float light_radius_mod = 0.0; 69 80 70 81 //Light calculation for directional light … … 78 89 specular += specular_color * specular_reflect 79 90 * pow(max(dot(r, v), 0.0), specular_power); 80 91 //---------- 81 92 82 93 //Light calculation for point light 83 94 vec3 tmpLightDir = (in_View * in_Light2_Pos).xyz - pass_Vertex.xyz; 84 floatlight_radius_mod = max(0.0, 1.0 - (length(tmpLightDir) / in_Light2_Radius));95 light_radius_mod = max(0.0, 1.0 - (length(tmpLightDir) / in_Light2_Radius)); 85 96 s = normalize(tmpLightDir); 86 97 v = normalize(-pass_Vertex.xyz); … … 92 103 specular += specular_color * min(specular_reflect, light_radius_mod) 93 104 * pow(max(dot(r, v), 0.0), specular_power); 105 //---------- 94 106 107 //Light calculation for cube light 108 vec3 Local_Vertex = (in_Inv_View * pass_Vertex).xyz - (in_Light3_Pos).xyz; 109 vec3 Proj_Vertex = clamp(Local_Vertex.xyz, -in_Light3_Size_Inner, in_Light3_Size_Inner); 110 vec3 new_LightDir = Local_Vertex - Proj_Vertex; 111 112 vec3 light_radius = max(vec3(0.0,0.0,0.0), vec3(1.0,1.0,1.0) - abs(new_LightDir / in_Light3_Size_Outer)); 113 light_radius_mod = min(light_radius.x, min(light_radius.y, light_radius.z)); 114 115 if (length(new_LightDir) == 0.0) 116 sdotn = 1.0; 117 else 118 { 119 new_LightDir = (in_View * vec4(Proj_Vertex + in_Light3_Pos.xyz,1.0)).xyz - pass_Vertex.xyz; 120 sdotn = max(dot(normalize(new_LightDir), pass_TNormal), 0.0); 121 } 122 diffuse += in_Light3_diffuse * min(sdotn, light_radius_mod); 123 //---------- 95 124 96 125 vec3 light = ambient + diffuse + specular; -
trunk/test/Physics/Src/BulletCharacterController.cpp
r1888 r2148 176 176 } 177 177 178 //The PreStep is done in order to recover from any HasPenetration.178 //The PreStep is done in order to recover from any HasPenetration. 179 179 void BulletKinematicCharacterController::PreStep(btCollisionWorld* CollisionWorld) 180 180 {
Note: See TracChangeset
for help on using the changeset viewer.