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
#ifndef _LIGHT_INPUT_CMN_
#define _LIGHT_INPUT_CMN_

#if defined(COMPUTE_SHADER)
#   define ACCESS
#else
#   define ACCESS readonly
#endif

const int LIGHT_DIRECTIONAL = 0;
const int LIGHT_OMNIDIRECTIONAL = 1;
const int LIGHT_SPOT = 2;

struct Light {
    /// rgb = colour
    /// w = reserved
    vec4   _colour;
    /// xyz = light positon (or direction for Directional lights)
    /// w = range
    vec4   _positionWV; 
    /// xyz = spot direction
    /// w = spot angle   
    vec4   _directionWV;
    /// x = light type: 0.0 - directional, 1.0  - point, 2.0 - spot
    /// y = casts shadows
    /// z = shadow block index
    /// w = if directional light : csm split count else : reserved
    ivec4  _options;
};

layout(binding = BUFFER_LIGHT_NORMAL, std430) coherent ACCESS buffer dvd_LightBlock
{
    Light dvd_LightSource[MAX_POSSIBLE_LIGHTS];
};

layout(binding = BUFFER_LIGHT_INDICES, std430) coherent ACCESS buffer perTileLightIndexBuffer
{
    uint perTileLightIndices[];
};

#if defined(FRAG_SHADER)
struct Shadow {
    uvec4 _arrayOffset;
    mat4  _lightVP[MAX_SPLITS_PER_LIGHT];
    vec4  _lightPosition[MAX_SPLITS_PER_LIGHT];
    vec4  _floatValues[MAX_SPLITS_PER_LIGHT];
};

layout(binding = BUFFER_LIGHT_SHADOW, std430) coherent ACCESS buffer dvd_ShadowBlock
{
    Shadow dvd_ShadowSource[MAX_SHADOW_CASTING_LIGHTS];
};

#endif 

#define windowWidth int(dvd_ViewPort.z)
#define windowHeight int(dvd_ViewPort.w)

// calculate the number of tiles in the horizontal direction
uint GetNumTilesX()
{
    return uint((windowWidth + FORWARD_PLUS_TILE_RES - 1) / float(FORWARD_PLUS_TILE_RES));
}

// calculate the number of tiles in the vertical direction
uint GetNumTilesY()
{
    return uint((windowHeight + FORWARD_PLUS_TILE_RES - 1) / float(FORWARD_PLUS_TILE_RES));
}

uint GetTileIndex(in vec2 ScreenPos)
{
    float fTileRes = float(FORWARD_PLUS_TILE_RES);
    return uint(floor(ScreenPos.x / fTileRes) + floor(ScreenPos.y / fTileRes) * GetNumTilesX());
}

#endif //_LIGHT_INPUT_CMN_

Commits for Divide-Framework/trunk/assets/shaders/GLSL/common/lightInput.cmn

Diff revisions: vs.
Revision Author Commited Message
727 Diff Diff IonutCava picture IonutCava Tue 14 Jun, 2016 16:01:38 +0000

[IonutCava]
- Remove node and cmd buffers from GFXDevice and add them as a new BufferData struct to RenderPass class.
— Each render pass holds its own buffers
- Improvements / fixes to the CSM code
- Added a global toggle to enable/disable custom memory allocators

721 Diff Diff IonutCava picture IonutCava Wed 08 Jun, 2016 15:47:49 +0000

[IonutCava]
- Spelling: change all references from our code of “color” to the PROPER British version of “colour” because it sounds 100x better

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

593 Diff Diff IonutCava picture IonutCava Thu 03 Dec, 2015 17:17:30 +0000

[IonutCava]
- Culling, light rendering, physics transforms and impostor updates

591 Diff Diff IonutCava picture IonutCava Wed 02 Dec, 2015 17:17:23 +0000

[IonutCava]
- More work on the ForwardPlus renderer
- Singleton cleanup
- First steps for reducing scope of GFXDevice class

590 Diff Diff IonutCava picture IonutCava Tue 01 Dec, 2015 16:37:37 +0000

[IonutCava]
- More work on the ForwardPlus renderer

588 Diff Diff IonutCava picture IonutCava Mon 30 Nov, 2015 17:11:02 +0000

[IonutCava]
- More work on the Forward+ renderer

587 Diff Diff IonutCava picture IonutCava Fri 27 Nov, 2015 17:00:25 +0000

[IonutCava]
- Finished multi-light rendering:
— Proper position/distance transform (homogeneous trans for positions / non-homogeneous trans for directions)
-— Point lights with range based attenuation
-— Spot lights with inner and outer cones for smooth falloff
-— Directional lights same as before
- Added a basic Flashlight system: spot light at the camera’s position facing forward (toggled with L key)
- WarScene updated:
— 16 point lights moving around the scene with random colours

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

[IonutCava]
- Point and Directional light updates

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

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