work on repairing particle system
Some checks failed
studiorailgun/Renderer/pipeline/head There was a failure building this commit

This commit is contained in:
austin 2025-06-04 22:38:53 -04:00
parent 6cbddbb42f
commit 7558f20f60
5 changed files with 26 additions and 38 deletions

View File

@ -2,6 +2,7 @@
#extension GL_ARB_shading_language_include : require
#include "../../lib/lights.fs"
#include "../../lib/material.fs"
#include "../../lib/standarduniform.fs"
//foliage.fs
@ -34,41 +35,26 @@ float easeIn(float interpolator);
float easeOut(float interpolator);
void main(){
vec3 norm = normalize(Normal);
vec3 viewDir = normalize(vec3(viewPos) - FragPos);
//grab light intensity
vec3 lightIntensity = vec3(calcLightIntensityTotal(Normal));
//get color of base texture
// vec3 textureColor = vec3((norm.x + 1) / 2.0, norm.y, 1.0 - (norm.x + 1) / 2.0);
vec4 textureColor = texture(material.diffuse,TexCoord) * instanceColor;
// vec3 textureColor = vec3(0.17647,0.4,0.09411);//texture(material.diffuse, TexCoord).rgb;
//shadow
float shadow = ShadowCalculation(FragPosLightSpace, normalize(-directLight.direction), Normal);
//
//point light calculations
uint clusterIndex = findCluster(ViewFragPos, zNear, zFar);
uint pointLightCount = clusters[clusterIndex].count;
for(int i = 0; i < pointLightCount; i++){
uint pointLightIndex = clusters[clusterIndex].lightIndices[i];
PointLight pointLight = pointLight[pointLightIndex];
lightIntensity = lightIntensity + CalcPointLight(pointLight, Normal, FragPos, viewDir);
}
//error checking on light clusters
if(pointLightCount > MAX_LIGHTS_PER_CLUSTER){
accum = vec4(1.0f,0.0f,0.0f,1);
reveal = textureColor.a;
return;
}
//the light level
vec3 light = getTotalLight(
material,
TexCoord,
vec3(viewPos.xyz),
FragPosLightSpace,
ViewFragPos,
FragPos,
norm,
viewDir
);
//calculate final color
vec4 finalColor = textureColor.rgba * vec4(lightIntensity,1.0);// * max(shadow,0.4);
// vec3 lightAmount = CalcDirLight(norm, viewDir);
// for(int i = 0; i < NR_POINT_LIGHTS; i++){
// lightAmount += CalcPointLight(i, norm, FragPos, viewDir);
// }
vec4 finalColor = textureColor.rgba * vec4(light,1.0);
//calculate weight function
float weight = clamp(pow(min(1.0, finalColor.a * 10.0) + 0.01, 3.0) * 1e3 *

View File

@ -1,5 +1,7 @@
//Vertex Shader
#version 450 core
#extension GL_ARB_shading_language_include : require
#include "../../lib/standarduniform.fs"
/**
Bind points for different SSBOs
@ -28,9 +30,6 @@ layout(std430, binding = PARTICLE_SSBO_BIND_POINT) restrict buffer particleSSBO
//coordinate space transformation matrices
uniform mat4 transform;
uniform mat4 view;
uniform mat4 projection;
uniform mat4 lightSpaceMatrix;
@ -61,7 +60,7 @@ void main() {
//push frag, normal, and texture positions to fragment shader
FragPos = vec3(model * FinalVertex);
ViewFragPos = vec3(view * model * FinalVertex);
ViewFragPos = vec3(standardUniforms.view * model * FinalVertex);
Normal = mat3(transpose(inverse(model))) * aNormal;
//offset based on data stored in particle data
@ -70,9 +69,9 @@ void main() {
//shadow map stuff
FragPosLightSpace = lightSpaceMatrix * vec4(FragPos, 1.0);
FragPosLightSpace = standardUniforms.lightSpaceMatrix * vec4(FragPos, 1.0);
//set final position with opengl space
gl_Position = projection * view * model * FinalVertex;
gl_Position = standardUniforms.projection * standardUniforms.view * model * FinalVertex;
}

View File

@ -2114,6 +2114,7 @@ Reorder main content draw calls to support non-OIT transparencies better
Content debug supports rendering paths
Rendering ai pathfinding paths
Simplify part of transvoxel algo
Work on repairing particle system

View File

@ -618,11 +618,10 @@ public class Mesh {
Globals.profiler.beginAggregateCpuSample("Mesh.complexDraw - Draw call");
if(renderPipelineState.getInstanced()){
if(renderPipelineState.getInstanceCount() < 1){
throw new Error("Failed to render instanced mesh with invalid instance count! " + this.getDebugData());
}
if(renderPipelineState.getInstanceCount() > 0){
GL45.glDrawElementsInstanced(GL45.GL_TRIANGLES, this.elementCount, GL45.GL_UNSIGNED_INT, 0, renderPipelineState.getInstanceCount());
Globals.renderingEngine.checkError();
}
} else if(this.useElementArray){
if(this.elementCount < 1){
throw new Error("Failed to render mesh with invalid element count! " + this.getDebugData());

View File

@ -645,6 +645,9 @@ public class Window implements DrawableElement, ContainerElement, NavigableEleme
if(child instanceof DrawableElement){
DrawableElement drawableChild = (DrawableElement) child;
drawableChild.setVisible(false);
if(drawableChild.getYogaNode() == Element.UNINITIALIZED_ID){
throw new Error("Drawable child is uninitialized!");
}
Yoga.YGNodeInsertChild(yogaNode, drawableChild.getYogaNode(), childList.size() - 1);
}
}