work on repairing particle system
Some checks failed
studiorailgun/Renderer/pipeline/head There was a failure building this commit
Some checks failed
studiorailgun/Renderer/pipeline/head There was a failure building this commit
This commit is contained in:
parent
6cbddbb42f
commit
7558f20f60
@ -2,6 +2,7 @@
|
|||||||
#extension GL_ARB_shading_language_include : require
|
#extension GL_ARB_shading_language_include : require
|
||||||
#include "../../lib/lights.fs"
|
#include "../../lib/lights.fs"
|
||||||
#include "../../lib/material.fs"
|
#include "../../lib/material.fs"
|
||||||
|
#include "../../lib/standarduniform.fs"
|
||||||
|
|
||||||
//foliage.fs
|
//foliage.fs
|
||||||
|
|
||||||
@ -34,41 +35,26 @@ float easeIn(float interpolator);
|
|||||||
float easeOut(float interpolator);
|
float easeOut(float interpolator);
|
||||||
|
|
||||||
void main(){
|
void main(){
|
||||||
|
vec3 norm = normalize(Normal);
|
||||||
vec3 viewDir = normalize(vec3(viewPos) - FragPos);
|
vec3 viewDir = normalize(vec3(viewPos) - FragPos);
|
||||||
|
|
||||||
//grab light intensity
|
|
||||||
vec3 lightIntensity = vec3(calcLightIntensityTotal(Normal));
|
|
||||||
|
|
||||||
//get color of base texture
|
//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;
|
vec4 textureColor = texture(material.diffuse,TexCoord) * instanceColor;
|
||||||
// vec3 textureColor = vec3(0.17647,0.4,0.09411);//texture(material.diffuse, TexCoord).rgb;
|
|
||||||
|
|
||||||
//shadow
|
//the light level
|
||||||
float shadow = ShadowCalculation(FragPosLightSpace, normalize(-directLight.direction), Normal);
|
vec3 light = getTotalLight(
|
||||||
|
material,
|
||||||
//
|
TexCoord,
|
||||||
//point light calculations
|
vec3(viewPos.xyz),
|
||||||
uint clusterIndex = findCluster(ViewFragPos, zNear, zFar);
|
FragPosLightSpace,
|
||||||
uint pointLightCount = clusters[clusterIndex].count;
|
ViewFragPos,
|
||||||
for(int i = 0; i < pointLightCount; i++){
|
FragPos,
|
||||||
uint pointLightIndex = clusters[clusterIndex].lightIndices[i];
|
norm,
|
||||||
PointLight pointLight = pointLight[pointLightIndex];
|
viewDir
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
//calculate final color
|
//calculate final color
|
||||||
vec4 finalColor = textureColor.rgba * vec4(lightIntensity,1.0);// * max(shadow,0.4);
|
vec4 finalColor = textureColor.rgba * vec4(light,1.0);
|
||||||
// vec3 lightAmount = CalcDirLight(norm, viewDir);
|
|
||||||
// for(int i = 0; i < NR_POINT_LIGHTS; i++){
|
|
||||||
// lightAmount += CalcPointLight(i, norm, FragPos, viewDir);
|
|
||||||
// }
|
|
||||||
|
|
||||||
//calculate weight function
|
//calculate weight function
|
||||||
float weight = clamp(pow(min(1.0, finalColor.a * 10.0) + 0.01, 3.0) * 1e3 *
|
float weight = clamp(pow(min(1.0, finalColor.a * 10.0) + 0.01, 3.0) * 1e3 *
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
//Vertex Shader
|
//Vertex Shader
|
||||||
#version 450 core
|
#version 450 core
|
||||||
|
#extension GL_ARB_shading_language_include : require
|
||||||
|
#include "../../lib/standarduniform.fs"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Bind points for different SSBOs
|
Bind points for different SSBOs
|
||||||
@ -28,9 +30,6 @@ layout(std430, binding = PARTICLE_SSBO_BIND_POINT) restrict buffer particleSSBO
|
|||||||
|
|
||||||
//coordinate space transformation matrices
|
//coordinate space transformation matrices
|
||||||
uniform mat4 transform;
|
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
|
//push frag, normal, and texture positions to fragment shader
|
||||||
FragPos = vec3(model * FinalVertex);
|
FragPos = vec3(model * FinalVertex);
|
||||||
ViewFragPos = vec3(view * model * FinalVertex);
|
ViewFragPos = vec3(standardUniforms.view * model * FinalVertex);
|
||||||
Normal = mat3(transpose(inverse(model))) * aNormal;
|
Normal = mat3(transpose(inverse(model))) * aNormal;
|
||||||
|
|
||||||
//offset based on data stored in particle data
|
//offset based on data stored in particle data
|
||||||
@ -70,9 +69,9 @@ void main() {
|
|||||||
|
|
||||||
|
|
||||||
//shadow map stuff
|
//shadow map stuff
|
||||||
FragPosLightSpace = lightSpaceMatrix * vec4(FragPos, 1.0);
|
FragPosLightSpace = standardUniforms.lightSpaceMatrix * vec4(FragPos, 1.0);
|
||||||
|
|
||||||
|
|
||||||
//set final position with opengl space
|
//set final position with opengl space
|
||||||
gl_Position = projection * view * model * FinalVertex;
|
gl_Position = standardUniforms.projection * standardUniforms.view * model * FinalVertex;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2114,6 +2114,7 @@ Reorder main content draw calls to support non-OIT transparencies better
|
|||||||
Content debug supports rendering paths
|
Content debug supports rendering paths
|
||||||
Rendering ai pathfinding paths
|
Rendering ai pathfinding paths
|
||||||
Simplify part of transvoxel algo
|
Simplify part of transvoxel algo
|
||||||
|
Work on repairing particle system
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -618,11 +618,10 @@ public class Mesh {
|
|||||||
|
|
||||||
Globals.profiler.beginAggregateCpuSample("Mesh.complexDraw - Draw call");
|
Globals.profiler.beginAggregateCpuSample("Mesh.complexDraw - Draw call");
|
||||||
if(renderPipelineState.getInstanced()){
|
if(renderPipelineState.getInstanced()){
|
||||||
if(renderPipelineState.getInstanceCount() < 1){
|
if(renderPipelineState.getInstanceCount() > 0){
|
||||||
throw new Error("Failed to render instanced mesh with invalid instance count! " + this.getDebugData());
|
|
||||||
}
|
|
||||||
GL45.glDrawElementsInstanced(GL45.GL_TRIANGLES, this.elementCount, GL45.GL_UNSIGNED_INT, 0, renderPipelineState.getInstanceCount());
|
GL45.glDrawElementsInstanced(GL45.GL_TRIANGLES, this.elementCount, GL45.GL_UNSIGNED_INT, 0, renderPipelineState.getInstanceCount());
|
||||||
Globals.renderingEngine.checkError();
|
Globals.renderingEngine.checkError();
|
||||||
|
}
|
||||||
} else if(this.useElementArray){
|
} else if(this.useElementArray){
|
||||||
if(this.elementCount < 1){
|
if(this.elementCount < 1){
|
||||||
throw new Error("Failed to render mesh with invalid element count! " + this.getDebugData());
|
throw new Error("Failed to render mesh with invalid element count! " + this.getDebugData());
|
||||||
|
|||||||
@ -645,6 +645,9 @@ public class Window implements DrawableElement, ContainerElement, NavigableEleme
|
|||||||
if(child instanceof DrawableElement){
|
if(child instanceof DrawableElement){
|
||||||
DrawableElement drawableChild = (DrawableElement) child;
|
DrawableElement drawableChild = (DrawableElement) child;
|
||||||
drawableChild.setVisible(false);
|
drawableChild.setVisible(false);
|
||||||
|
if(drawableChild.getYogaNode() == Element.UNINITIALIZED_ID){
|
||||||
|
throw new Error("Drawable child is uninitialized!");
|
||||||
|
}
|
||||||
Yoga.YGNodeInsertChild(yogaNode, drawableChild.getYogaNode(), childList.size() - 1);
|
Yoga.YGNodeInsertChild(yogaNode, drawableChild.getYogaNode(), childList.size() - 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user