Subversion Repository Public Repository

Divide-Framework

This repository has no backups
This repository's network speed is throttled to 100KB/sec

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
-- Vertex

#include "vbInputData.vert"
#include "lightingDefaults.vert"

#if defined(ADD_FOLIAGE)
#include "foliage.vert"
#endif
void main(void){

    computeData();

#if defined(ADD_FOLIAGE) && defined(IS_TREE)
    computeFoliageMovementTree(dvd_Vertex);
#endif
    
    computeLightVectors();

    //Compute the final vert position
    gl_Position = dvd_ViewProjectionMatrix * VAR._vertexW;
}

-- Fragment

#include "BRDF.frag"

#if defined(COMPUTE_TBN)
    #include "bumpMapping.frag"
#endif

layout(location = 0) out vec4 _colorOut;
layout(location = 1) out vec3 _normalOut;

//subroutine vec4 MappingRoutineType();

//layout(location = 0) subroutine uniform MappingRoutineType MappingRoutine;

//subroutine(MappingRoutineType)
vec4 mappingFlat(){
    return getPixelColor(VAR._texCoord, VAR._normalWV);
}

#if defined(COMPUTE_TBN)
//subroutine(MappingRoutineType)
vec4 mappingNormal(){
    return mix(getPixelColor(VAR._texCoord, getTBNNormal(VAR._texCoord)),
               mappingFlat(),
               vec4(dvd_lodLevel > 1));
}

//subroutine(MappingRoutineType)
vec4 mappingRelief(){
    return mix(ReliefMapping(bumpMapLightID, VAR._texCoord),
               mappingFlat(),
               vec4(dvd_lodLevel > 1));
}

//subroutine(MappingRoutineType)
vec4 mappingParallax(){
    return mix(ParallaxMapping(bumpMapLightID, VAR._texCoord),
               mappingFlat(),
               vec4(dvd_lodLevel > 1));
}
#endif

void main (void){
    //_colorOut = ToSRGB(applyFog(MappingRoutine()));
#if defined(COMPUTE_TBN)
#    if defined(USE_PARALLAX_MAPPING)
    _colorOut = ToSRGB(applyFog(ParallaxMapping()));
#    elif defined(USE_RELIEF_MAPPING)
    _colorOut = ToSRGB(applyFog(ReliefMapping()));
#    else
    _colorOut = ToSRGB(applyFog(mappingNormal()));
#    endif
#else
    _colorOut = ToSRGB(applyFog(mappingFlat()));
#endif

    _normalOut = processedNormal;
}   

Commits for Divide-Framework/trunk/assets/shaders/GLSL/lighting.glsl

Diff revisions: vs.
Revision Author Commited Message
631 Diff Diff IonutCava picture IonutCava Sun 24 Jan, 2016 20:28:21 +0000

[IonutCava]
- Fix and optimize particle rendering system
- Temporarily disable Z_PRE_PASS system for testing
- Improve thread pool destruction system a bit
- Fix texture loading when used as fb attachment
- Forward+ renderer now takes the entire light buffer (no need to split up by light type)
- Start work on occlusion culling fixes:
— ToDo: Take into account batching system
— Fix gl_DrawIDARB usage

628 Diff Diff IonutCava picture IonutCava Wed 20 Jan, 2016 17:17:53 +0000

[IonutCava]
- Reworked GenericVertexData ring-buffering system and changed vertex attributes to the vertex format system
— Might be buggy
- Disabled bump-mapping for low-LoD level entities
- Removed a forgotten test line in BRDF shader that prevented lighting calculations to occur properly (an early return)
- Updated auto-reflection system for high shininess materials
- Converted a lot of ‘to_xyz’ calls to ‘to_const_xyz’ calls where appropriate to reduce runtime cost (‘to_const_xyz’ is evaluated at compile time)

621 Diff Diff IonutCava picture IonutCava Tue 12 Jan, 2016 16:39:50 +0000

[IonutCava]
- Terrain rendering updates
- Framebuffer optimizations

617 Diff Diff IonutCava picture IonutCava Tue 05 Jan, 2016 16:47:21 +0000

[IonutCava]
- Depth writing is now a rendering API level toggle instead of a renderstateblock option
- Z-Pre-pass fixes and improvements
- Moved normal render target to the display stage from the pre-pass stage
— Normals are only used in post-processing. This improves pre-pass performance

614 Diff Diff IonutCava picture IonutCava Mon 21 Dec, 2015 17:07:48 +0000

[IonutCava]
- Framebuffer attachment corrections
- SSAO corrections

586 Diff Diff IonutCava picture IonutCava Thu 26 Nov, 2015 17:11:27 +0000

[IonutCava]
- Point and Directional light updates

576 Diff Diff IonutCava picture IonutCava Fri 20 Nov, 2015 11:54:22 +0000

[IonutCava]
- C++ based Interface block generation for GLSL

566 Diff Diff IonutCava picture IonutCava Sat 14 Nov, 2015 18:34:27 +0000

[IonutCava]
- Cleanup GLSL UBO variables
- Cleanup mat4 class
- Fixed fog rendering
- Disable useless environment mipmap generation step

564 Diff Diff IonutCava picture IonutCava Thu 12 Nov, 2015 22:41:13 +0000

[IonutCava]
- Enable the depth buffer for the environment map render target
- Use multi-threaded culling if the number of visible items rendered in the previous frame is above a certain threshold
- Some profile-guided optimizations

358 IonutCava picture IonutCava Sun 01 Mar, 2015 22:44:38 +0000

[Ionut]
- Fixed some OpenGL initialization issues and function calls (no proper support for DSA yet)
- Cleanup up the Sound and Physics Wrappers
- Some readability improvements here and there