_basic_ Rendering
This commit is contained in:
@@ -1,15 +1,10 @@
|
||||
#line 1
|
||||
struct Frustum {
|
||||
vec4 planes[6];
|
||||
};
|
||||
|
||||
layout(binding = 0, std140) uniform SceneUniform {
|
||||
mat4 MVP;
|
||||
ivec3 baseSectionPos;
|
||||
int sectionCount;
|
||||
Frustum frustum;
|
||||
vec3 cameraSubPos;
|
||||
uint frameId;
|
||||
vec3 cameraSubPos;
|
||||
};
|
||||
|
||||
struct BlockModel {
|
||||
@@ -39,44 +34,63 @@ struct DrawCommand {
|
||||
uint baseInstance;
|
||||
};
|
||||
|
||||
layout(binding = 0) uniform sampler2D blockModelAtlas;
|
||||
|
||||
#ifdef BLOCK_MODEL_TEXTURE_BINDING
|
||||
layout(binding = BLOCK_MODEL_TEXTURE_BINDING) uniform sampler2D blockModelAtlas;
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef Quad
|
||||
#define Quad ivec2
|
||||
#endif
|
||||
layout(binding = 1, std430) readonly restrict buffer QuadBuffer {
|
||||
#ifdef QUAD_BUFFER_BINDING
|
||||
layout(binding = QUAD_BUFFER_BINDING, std430) readonly restrict buffer QuadBuffer {
|
||||
Quad quadData[];
|
||||
};
|
||||
#endif
|
||||
|
||||
layout(binding = 2, std430) writeonly restrict buffer DrawBuffer {
|
||||
#ifdef DRAW_BUFFER_BINDING
|
||||
layout(binding = DRAW_BUFFER_BINDING, std430) writeonly restrict buffer DrawBuffer {
|
||||
DrawCommand cmdBuffer[];
|
||||
};
|
||||
#endif
|
||||
|
||||
layout(binding = 3, std430) restrict buffer DrawCommandCountBuffer {
|
||||
#ifdef DRAW_COUNT_BUFFER_BINDING
|
||||
layout(binding = DRAW_COUNT_BUFFER_BINDING, std430) restrict buffer DrawCommandCountBuffer {
|
||||
uint opaqueDrawCount;
|
||||
uint translucentDrawCount;
|
||||
};
|
||||
#endif
|
||||
|
||||
layout(binding = 4, std430) readonly restrict buffer SectionBuffer {
|
||||
#ifdef SECTION_METADA_BUFFER_BINDING
|
||||
layout(binding = SECTION_METADA_BUFFER_BINDING, std430) readonly restrict buffer SectionBuffer {
|
||||
SectionMeta sectionData[];
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifndef VISIBILITY_ACCESS
|
||||
#define VISIBILITY_ACCESS readonly
|
||||
#endif
|
||||
layout(binding = 5, std430) VISIBILITY_ACCESS restrict buffer VisibilityBuffer {
|
||||
#ifdef VISIBILITY_BUFFER_BINDING
|
||||
layout(binding = VISIBILITY_BUFFER_BINDING, std430) VISIBILITY_ACCESS restrict buffer VisibilityBuffer {
|
||||
uint visibilityData[];
|
||||
};
|
||||
#endif
|
||||
|
||||
layout(binding = 6, std430) readonly restrict buffer ModelBuffer {
|
||||
#ifdef MODEL_BUFFER_BINDING
|
||||
layout(binding = MODEL_BUFFER_BINDING, std430) readonly restrict buffer ModelBuffer {
|
||||
BlockModel modelData[];
|
||||
};
|
||||
#endif
|
||||
|
||||
layout(binding = 7, std430) readonly restrict buffer ModelColourBuffer {
|
||||
#ifdef MODEL_COLOUR_BUFFER_BINDING
|
||||
layout(binding = MODEL_COLOUR_BUFFER_BINDING, std430) readonly restrict buffer ModelColourBuffer {
|
||||
uint colourData[];
|
||||
};
|
||||
#endif
|
||||
|
||||
layout(binding = 8, std430) readonly restrict buffer LightingBuffer {
|
||||
#ifdef LIGHTING_BUFFER_BINDING
|
||||
layout(binding = LIGHTING_BUFFER_BINDING, std430) readonly restrict buffer LightingBuffer {
|
||||
uint lightData[];
|
||||
};
|
||||
|
||||
@@ -86,5 +100,5 @@ vec4 getLighting(uint index) {
|
||||
arr = arr & uvec4(0xFF);
|
||||
return vec4(arr)*vec4(1.0f/255.0f);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -5,7 +5,6 @@ layout(local_size_x = 128) in;
|
||||
|
||||
#import <voxy:lod/quad_format.glsl>
|
||||
#import <voxy:lod/gl46/bindings.glsl>
|
||||
#import <voxy:lod/gl46/frustum.glsl>
|
||||
#import <voxy:lod/section.glsl>
|
||||
#line 11
|
||||
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
bool testFrustumPoint(vec4 plane, vec3 min, vec3 max) {
|
||||
vec3 point = mix(max, min, lessThan(plane.xyz, vec3(0))) * plane.xyz;
|
||||
return (point.x + point.y + point.z) >= -plane.w;
|
||||
}
|
||||
|
||||
bool testFrustum(Frustum frust, vec3 min, vec3 max) {
|
||||
return testFrustumPoint(frust.planes[0], min, max) &&
|
||||
testFrustumPoint(frust.planes[1], min, max) &&
|
||||
testFrustumPoint(frust.planes[2], min, max) &&
|
||||
testFrustumPoint(frust.planes[3], min, max) &&
|
||||
testFrustumPoint(frust.planes[4], min, max) &&
|
||||
testFrustumPoint(frust.planes[5], min, max);
|
||||
}
|
||||
@@ -1,10 +1,16 @@
|
||||
#version 460 core
|
||||
#extension GL_ARB_gpu_shader_int64 : enable
|
||||
|
||||
#define QUAD_BUFFER_BINDING 1
|
||||
#define SECTION_METADA_BUFFER_BINDING 2
|
||||
#define MODEL_BUFFER_BINDING 3
|
||||
#define MODEL_COLOUR_BUFFER_BINDING 4
|
||||
#define LIGHTING_BUFFER_BINDING 5
|
||||
|
||||
|
||||
#import <voxy:lod/quad_format.glsl>
|
||||
#import <voxy:lod/gl46/bindings.glsl>
|
||||
#import <voxy:lod/block_model.glsl>
|
||||
#line 8
|
||||
|
||||
//#define DEBUG_RENDER
|
||||
|
||||
|
||||
Reference in New Issue
Block a user