ITS WORKING EVEN MORE
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
#version 450
|
||||
|
||||
layout(location = 1) in flat vec4 colour;
|
||||
layout(location = 0) out vec4 outColour;
|
||||
void main() {
|
||||
outColour = colour;
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
#version 450
|
||||
#extension GL_ARB_shader_draw_parameters : require
|
||||
|
||||
layout(binding = 0, std140) uniform SceneUniform {
|
||||
mat4 VP;
|
||||
ivec3 camSecPos;
|
||||
uint screenW;
|
||||
vec3 camSubSecPos;
|
||||
uint screenH;
|
||||
};
|
||||
|
||||
#define NODE_DATA_INDEX 1
|
||||
#import <voxy:lod/hierarchical/node.glsl>
|
||||
|
||||
layout(binding = 2, std430) restrict buffer NodeList {
|
||||
uint count;
|
||||
uint nodeQueue[];
|
||||
};
|
||||
|
||||
layout(location = 1) out flat vec4 colour;
|
||||
|
||||
void main() {
|
||||
UnpackedNode node;
|
||||
unpackNode(node, nodeQueue[gl_InstanceID]);
|
||||
|
||||
vec4 base = VP*vec4(vec3(((node.pos<<node.lodLevel)-camSecPos)<<5)-camSubSecPos, 1);
|
||||
|
||||
vec4 pos = base + (VP*vec4(ivec3(gl_VertexID&1, (gl_VertexID>>2)&1, (gl_VertexID>>1)&1)<<(5+node.lodLevel), 1));
|
||||
|
||||
gl_Position = pos;
|
||||
|
||||
uint hash = node.nodeId*1231421+123141;
|
||||
hash ^= hash>>16;
|
||||
hash = hash*1231421+123141;
|
||||
hash ^= hash>>16;
|
||||
hash = hash * 1827364925 + 123325621;
|
||||
colour = vec4(float(hash&15u)/15, float((hash>>4)&15u)/15, float((hash>>8)&15u)/15, 1);
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
#version 460 core
|
||||
layout(local_size_x=1, local_size_y=1) in;
|
||||
|
||||
|
||||
layout(binding = 0, std430) restrict buffer DrawCmd {
|
||||
uint count;
|
||||
uint instanceCount;
|
||||
uint firstIndex;
|
||||
int baseVertex;
|
||||
uint baseInstance;
|
||||
};
|
||||
|
||||
layout(binding = 1, std430) restrict buffer NodeList {
|
||||
uint nodeCount;
|
||||
uint nodes[];
|
||||
};
|
||||
|
||||
void main() {
|
||||
count = 6 * 2 * 3;
|
||||
instanceCount = nodeCount;
|
||||
firstIndex = (1<<8)*6;
|
||||
baseVertex = 0;
|
||||
baseInstance = 0;
|
||||
}
|
||||
@@ -92,5 +92,5 @@ void markRequested(inout UnpackedNode node) {
|
||||
}
|
||||
|
||||
void debugDumpNode(in UnpackedNode node) {
|
||||
printf("Node %d, %d@[%d,%d,%d], flags: %d, mesh: %d, ChildPtr: %d", node.nodeId, node.lodLevel, node.pos.x, node.pos.y, node.pos.z, node.flags, node.meshPtr, node.childPtr);
|
||||
//printf("Node %d, %d@[%d,%d,%d], flags: %d, mesh: %d, ChildPtr: %d", node.nodeId, node.lodLevel, node.pos.x, node.pos.y, node.pos.z, node.flags, node.meshPtr, node.childPtr);
|
||||
}
|
||||
Reference in New Issue
Block a user