Fixes and tweeks

This commit is contained in:
mcrcortex
2024-07-16 20:47:49 +10:00
parent 5d58e9e4da
commit 26825e358f
7 changed files with 79 additions and 41 deletions

View File

@@ -29,10 +29,12 @@ void main() {
gl_Position = pos;
//node.nodeId
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);
//colour = vec4(vec3(float(hash&15u)/15, float((hash>>4)&15u)/15, float((hash>>8)&15u)/15), 1);
colour = vec4(vec3(float(hash&31u)/31, float(node.lodLevel)/4, float(node.lodLevel)/4), 1);
}

View File

@@ -52,6 +52,10 @@ bool hasMesh(in UnpackedNode node) {
return node.meshPtr != NULL_MESH;
}
bool isEmptyMesh(in UnpackedNode node) {
return node.meshPtr == (NULL_MESH-1);//Specialcase
}
bool hasChildren(in UnpackedNode node) {
return node.childPtr != NULL_NODE;
}

View File

@@ -105,8 +105,8 @@ void enqueueChildren(in UnpackedNode node) {
}
void enqueueSelfForRender(in UnpackedNode node) {
printf("render %d@[%d,%d,%d]", node.lodLevel, node.pos.x, node.pos.y, node.pos.z);
if (renderQueueIndex < renderQueueMaxSize) {
//printf("render %d@[%d,%d,%d]", node.lodLevel, node.pos.x, node.pos.y, node.pos.z);
if ((!isEmptyMesh(node)) && renderQueueIndex < renderQueueMaxSize) {
renderQueue[atomicAdd(renderQueueIndex, 1)] = getMesh(node);
}
}
@@ -128,11 +128,13 @@ void main() {
//debugDumpNode(node);
if (outsideFrustum() || isCulledByHiz()) {
if (outsideFrustum()) {// || isCulledByHiz()
//printf("HizCulled");
//We are done here, dont do any more, the issue is the shader barriers maybe
// its culled, maybe just mark it as culled?
printf("Cull");
//printf("Cull");
} else {
//It is visible, TODO: maybe do a more detailed hiz test? (or make it so that )