Changeset 533
- Timestamp:
- 05/02/08 19:34:56 (8 months ago)
- Files:
-
- trunk/run/data/shaders/model.pixel.glsl (modified) (1 diff)
- trunk/run/data/shaders/model.vertex.glsl (modified) (2 diffs)
- trunk/run/data/shaders/shadowmap.glsl (modified) (1 diff)
- trunk/src/defend/com/Gateway.d (modified) (2 diffs)
- trunk/src/gen/rend/opengl/Texture.d (modified) (1 diff)
- trunk/src/windefend.cbp (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/run/data/shaders/model.pixel.glsl
r530 r533 14 14 vec4 light = texture2D(lightTexture, vec2(gl_TexCoord[1])); 15 15 16 gl_FragColor = vec4(tex.rgb * tex.a + color * (1 - tex.a), 1.0) * gl_Color * (light * 2); //* shadowMap(shadow, lightSpacePos);17 //gl_FragColor = vec4(tex.rgb * tex.a + color * (1 - tex.a), 1.0) * (light * 2) * shadowMap(shadow, lightSpacePos);16 //gl_FragColor = vec4(tex.rgb * tex.a + color * (1 - tex.a), 1.0) * gl_Color * (light * 2); //* shadowMap(shadow, lightSpacePos); 17 gl_FragColor = vec4(tex.rgb * tex.a + color * (1 - tex.a), 1.0) * (light * 2) * shadowMap(shadow, lightSpacePos); 18 18 //gl_FragColor = vec4(shadowMap(shadow, lightSpacePos)); 19 19 } trunk/run/data/shaders/model.vertex.glsl
r530 r533 19 19 20 20 // Lighting 21 vec3 position = vec3(gl_ModelViewMatrix * gl_Vertex);21 /*vec3 position = vec3(gl_ModelViewMatrix * gl_Vertex); 22 22 //vec3 light = vec3(normalize(vec3(gl_ModelViewMatrix * LIGHT_POSITION) - position)); 23 23 vec3 light = vec3(normalize(vec3(gl_LightSource[0].position) - position)); … … 25 25 vec3 ambient = vec3(gl_FrontMaterial.ambient) * vec3(LIGHT_AMBIENT); 26 26 vec3 diffuse = (max(dot(normal, light), 0.0) * LIGHT_DIFFUSE).rgb; 27 gl_FrontColor = vec4(diffuse + ambient, 1.0); 27 gl_FrontColor = vec4(diffuse + ambient, 1.0);*/ 28 28 29 29 trunk/run/data/shaders/shadowmap.glsl
r530 r533 4 4 float shadowMap(in sampler2D sampler, vec4 lightSpacePos) 5 5 { 6 //return 1.0f; 6 vec2 shadowMapCoord = 0.5f * lightSpacePos.xy / lightSpacePos.w + vec2(0.5f, 0.5f); 7 float shadowMapDistance = texture2D(sampler, shadowMapCoord).r; 8 float lightDistance = lightSpacePos.z / lightSpacePos.w; 7 9 8 vec2 shadowMapCoord = 0.5f * lightSpacePos.xy / lightSpacePos.w + vec2(0.5f, 0.5f); 9 float shadowMapDistance = texture2D(sampler, shadowMapCoord).r; 10 float lightDistance = lightSpacePos.z / lightSpacePos.w; 10 float bias = -0.001f; // avoid shadow aliasing by offseting the shadow a bit 11 11 12 //if(shadowMapCoord.x >= 0 && shadowMapCoord.x <= 1 && shadowMapCoord.y >= 0 && shadowMapCoord.y <= 1) 13 // return 0.0f;12 // perspective division yields coordinates in [-1 .. 1], whilst shadow map values are [0 .. 1] 13 lightDistance = .5f + bias + lightDistance * .5f; 14 14 15 //return lightDistance; 16 //return shadowMapDistance; 17 18 if(shadowMapCoord.x >= 0 && shadowMapCoord.x <= 1 && shadowMapCoord.y >= 0 && shadowMapCoord.y <= 1 && 19 lightDistance + 0.72f >= shadowMapDistance && shadowMapDistance != 1.0f) // point is in shadow 20 return 0.35f; 21 22 //if(shadowMapCoord.x >= 0 && shadowMapCoord.x <= 1 && shadowMapCoord.y >= 0 && shadowMapCoord.y <= 1) 23 // return shadowMapDistance - lightDistance; 24 25 return 1.0f; 15 if(shadowMapCoord.x >= 0 && shadowMapCoord.x <= 1 && shadowMapCoord.y >= 0 && shadowMapCoord.y <= 1 && 16 lightDistance >= shadowMapDistance && shadowMapDistance != 1.0f) // point is in shadow 17 return 0.35f; 18 19 return 1.0f; 26 20 } trunk/src/defend/com/Gateway.d
r435 r533 74 74 75 75 // Create an synchronized object 76 Signal!(player_id_t /* owner */, object_type_t /* type */,77 object_pos_t /* x */, object_pos_t /* y */) CreateObject;76 Signal!(player_id_t, object_type_t, 77 object_pos_t, object_pos_t) CreateObject; 78 78 79 79 // Chat message 80 Signal!(player_id_t /* from */, char[] /* text */, 81 bool /* team */) ChatMessage; 80 Signal!(player_id_t, char[], bool) ChatMessage; 82 81 83 82 // All players have connected and the game will start now … … 91 90 92 91 // A player has disconnected 93 Signal!(player_id_t /* id */) PlayerDisconnect;92 Signal!(player_id_t) PlayerDisconnect; 94 93 95 94 // The gateway has found out which ID it has 96 Signal!(player_id_t /* id */) GatewayID;95 Signal!(player_id_t) GatewayID; 97 96 98 97 // Emitted when the gateway shuts down 99 Signal!(bool /* fatal */) GatewayShutdown;98 Signal!(bool) GatewayShutdown; 100 99 101 100 // Start the next phase 102 Signal!(Phase /* phase */) StartPhase;101 Signal!(Phase) StartPhase; 103 102 } trunk/src/gen/rend/opengl/Texture.d
r530 r533 74 74 t = GL_DEPTH_COMPONENT24; 75 75 f = GL_DEPTH_COMPONENT; 76 77 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); 78 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); 76 79 } 77 80 trunk/src/windefend.cbp
r520 r533 77 77 </Build> 78 78 <Compiler> 79 <Add option="-defaultlib=tango-base-dmd.lib" />80 <Add option="-debuglib=tango-base-dmd.lib" />81 79 <Add option="-version=UseSDL" /> 82 80 <Add option="-version=DynDio" /> 83 <Add directory="libs\" />84 81 <Add directory="." /> 85 82 </Compiler> … … 183 180 <Unit filename="gen\net\tcp\Message.d" /> 184 181 <Unit filename="gen\net\tcp\Socket.d" /> 182 <Unit filename="gen\rend\Framebuffer.d" /> 185 183 <Unit filename="gen\rend\IndexBuffer.d" /> 186 184 <Unit filename="gen\rend\PrimitiveType.d" /> … … 191 189 <Unit filename="gen\rend\VertexFormat.d" /> 192 190 <Unit filename="gen\rend\Window.d" /> 191 <Unit filename="gen\rend\opengl\FBO.d" /> 193 192 <Unit filename="gen\rend\opengl\IndexBuffer.d" /> 194 193 <Unit filename="gen\rend\opengl\Renderer.d" />
