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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
/*
Copyright (c) 2017 DIVIDE-Studio
Copyright (c) 2009 Ionut Cava

This file is part of DIVIDE Framework.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software
and associated documentation files (the "Software"), to deal in the Software
without restriction,
including without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED,
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
IN CONNECTION WITH THE SOFTWARE
OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

*/

#ifndef _SCENE_SHADER_DATA_H_
#define _SCENE_SHADER_DATA_H_

#include "Rendering/Lighting/Headers/Light.h"

namespace Divide {
class SceneShaderData {
  private:
    struct SceneShaderBufferData {
        vec4<F32> _fogDetails;
        vec4<F32> _windDetails;
        vec4<F32> _shadowingSettings;
        vec4<F32> _otherData;
        vec4<F32> _otherData2;
        vec4<U32> _lightCountPerType;
        vec4<F32> _waterPositionsW/*[MAX_WATER_BODIES]*/;
        vec4<F32> _waterDetails/*[MAX_WATER_BODIES]*/;
    };

  public:
    SceneShaderData(GFXDevice& context);
    ~SceneShaderData();

    inline void fogDetails(F32 colourR, F32 colourG, F32 colourB, F32 density) {
        _bufferData._fogDetails.set(colourR, colourG, colourB, density / 1000.0f);
    }

    inline void fogDensity(F32 density) {
        _bufferData._fogDetails.w = density;
    }

    inline void shadowingSettings(F32 lightBleedBias, F32 minShadowVariance, F32 shadowFadeDist, F32 shadowMaxDist) {
        _bufferData._shadowingSettings.set(lightBleedBias, minShadowVariance, shadowFadeDist, shadowMaxDist);
    }

    inline void windDetails(F32 directionX, F32 directionY, F32 directionZ, F32 speed) {
        _bufferData._windDetails.set(directionX, directionY, directionZ, speed);
    }

    inline void elapsedTime(U32 timeMS) {
        _bufferData._otherData.x = to_F32(timeMS);
    }

    inline void enableDebugRender(bool state) {
        _bufferData._otherData.y = state ? 1.0f : 0.0f;
    }

    inline void toggleShadowMapping(bool state) {
        _bufferData._otherData.z = state ? 1.0f : 0.0f;
    }

    inline void setRendererFlag(U32 flag) {
        _bufferData._otherData.w = to_F32(flag);
    }

    inline void deltaTime(F32 deltaTimeSeconds) {
        _bufferData._otherData2.x = deltaTimeSeconds;
    }

    inline void lightCount(LightType type, U32 lightCount) {
        _bufferData._lightCountPerType[to_U32(type)] = lightCount;
    }

    inline void detailLevel(RenderDetailLevel renderDetailLevel, RenderDetailLevel shadowDetailLevel) {
        _bufferData._otherData2.y = to_F32(renderDetailLevel);
        _bufferData._otherData2.z = to_F32(shadowDetailLevel);
    }

    inline void waterDetails(U8 index, const vec3<F32>& positionW, const vec3<F32>& dimensions) {
        ACKNOWLEDGE_UNUSED(index);
        _bufferData._waterPositionsW/*[index]*/.set(positionW);
        _bufferData._waterDetails/*[index]*/.set(dimensions);
    }

    void uploadToGPU();

  private:
      GFXDevice& _context;
      SceneShaderBufferData _bufferData;
      /// Generic scene data that doesn't change per shader
      ShaderBuffer* _sceneShaderData;
};
}; //namespace Divide

#endif //_SCENE_SHADER_DATA_H_

Commits for Divide-Framework/trunk/Source Code/Scenes/Headers/SceneShaderData.h

Diff revisions: vs.
Revision Author Commited Message
888 Diff Diff IonutCava picture IonutCava Mon 03 Apr, 2017 20:04:19 +0000

[IonutCava]
- Terrain <-> Water body collision checking for caustics

886 Diff Diff IonutCava picture IonutCava Wed 29 Mar, 2017 23:36:51 +0000

[Ionut]
- Initial code for multiple water block support (position + length/width/depth)

872 Diff Diff IonutCava picture IonutCava Mon 06 Mar, 2017 23:23:20 +0000

[IonutCava]
- Optimise static casts

867 Diff Diff IonutCava picture IonutCava Mon 20 Feb, 2017 17:01:12 +0000

[IonutCava]
- Rename to_XNN and to_const_XNN functions to reflect the target data type they are converting to.
- Cleanup Angle namespace and remove all “inDegrees” parameters from rotation functions. Use aliases to differentiate between Degree and Radian parameters.
- Profile guided optimizations.

850 Diff Diff IonutCava picture IonutCava Mon 06 Feb, 2017 17:04:39 +0000

[IonutCava]
- More code rot fixes
- Separate Planar reflectors/refractors from Cube R/R
- Now passing detail levels to shaders

836 Diff Diff IonutCava picture IonutCava Fri 27 Jan, 2017 14:59:56 +0000

[IonutCava]
- Update copyright notice

807 Diff Diff IonutCava picture IonutCava Mon 09 Jan, 2017 17:06:26 +0000

[IonutCava]
- Split PlatformDefines.h into 2. Move data type defines to PlatformDataTypes.h
- Continue to improve velocity map calculation
- Remove “destroy()” calls from most classes. Attempt to move as many classes to the RAII system.

801 Diff Diff IonutCava picture IonutCava Sun 27 Nov, 2016 21:28:01 +0000

[IonutCava]
- More performance analysis guided optimizations.
- Some refactoring to allow later removal of Singletons status for: GFXDevice, SFXDevice, PXDevice, GUI and Input.
— Pass a PlatformContext around objects to access these classes.

730 Diff Diff IonutCava picture IonutCava Thu 16 Jun, 2016 15:35:07 +0000

[IonutCava]
- More shadow mapping fixes
- Small performance improvements
- Proper per scene XML data loading (e.g. fog)

721 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