mirror of
https://github.com/lubosz/overte.git
synced 2025-04-27 11:55:25 +02:00
Diffuse lighting.
This commit is contained in:
parent
4a7efa5ef9
commit
c003a55c37
2 changed files with 7 additions and 4 deletions
|
@ -12,11 +12,14 @@ uniform float pointScale;
|
|||
|
||||
void main(void) {
|
||||
|
||||
// pass along the vertex color
|
||||
gl_FrontColor = gl_Color;
|
||||
// standard diffuse lighting
|
||||
gl_FrontColor = vec4(gl_Color.rgb * (gl_LightModel.ambient.rgb + gl_LightSource[0].ambient.rgb +
|
||||
gl_LightSource[0].diffuse.rgb * max(0.0, dot(gl_NormalMatrix * gl_Normal, gl_LightSource[0].position.xyz))),
|
||||
gl_Color.a);
|
||||
|
||||
// extract the first four components of the vertex for position
|
||||
// extract the first three components of the vertex for position
|
||||
gl_Position = gl_ModelViewProjectionMatrix * vec4(gl_Vertex.xyz, 1.0);
|
||||
|
||||
// the final component is the size in world space
|
||||
gl_PointSize = pointScale * gl_Vertex.w / gl_Position.w;
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ AttributeRegistry AttributeRegistry::_instance;
|
|||
|
||||
AttributeRegistry::AttributeRegistry() :
|
||||
_colorAttribute(registerAttribute(new QRgbAttribute("color"))),
|
||||
_normalAttribute(registerAttribute(new QRgbAttribute("normal"))) {
|
||||
_normalAttribute(registerAttribute(new QRgbAttribute("normal", qRgb(0, 127, 0)))) {
|
||||
}
|
||||
|
||||
AttributePointer AttributeRegistry::registerAttribute(AttributePointer attribute) {
|
||||
|
|
Loading…
Reference in a new issue