Visual updates + fixes
Some checks failed
studiorailgun/Renderer/pipeline/head There was a failure building this commit

This commit is contained in:
austin 2024-11-15 15:54:30 -05:00
parent d0235a01d6
commit 851875b62f
10 changed files with 45 additions and 31 deletions

View File

@ -49,6 +49,11 @@ struct Cluster {
uint lightIndices[MAX_LIGHTS_PER_CLUSTER]; uint lightIndices[MAX_LIGHTS_PER_CLUSTER];
}; };
/**
Cutoff for fragment alpha
*/
#define FRAGMENT_ALPHA_CUTOFF 0.001
out vec4 FragColor; out vec4 FragColor;
layout(std430, binding = CLUSTER_SSBO_BIND_POINT) restrict buffer clusterGridSSBO { layout(std430, binding = CLUSTER_SSBO_BIND_POINT) restrict buffer clusterGridSSBO {
@ -106,7 +111,7 @@ float calcLightIntensityTotal(vec3 normal);
float ShadowCalculation(vec4 fragPosLightSpace, vec3 lightDir, vec3 normal); float ShadowCalculation(vec4 fragPosLightSpace, vec3 lightDir, vec3 normal);
void main(){ void main(){
if(texture(material.diffuse, TexCoord).a < 0.01){ if(texture(material.diffuse, TexCoord).a < FRAGMENT_ALPHA_CUTOFF){
discard; discard;
} }
vec3 norm = normalize(Normal); vec3 norm = normalize(Normal);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 134 KiB

After

Width:  |  Height:  |  Size: 131 KiB

View File

@ -1,3 +1,3 @@
#maven.buildNumber.plugin properties file #maven.buildNumber.plugin properties file
#Wed Nov 13 21:13:23 EST 2024 #Fri Nov 15 15:38:56 EST 2024
buildNumber=384 buildNumber=385

View File

@ -25,3 +25,6 @@ TODO(?):
- Some css support - Some css support
- Language file for translation - Language file for translation
- Live reloading of scripts
- Async asset reloading (including data files)

View File

@ -1049,6 +1049,8 @@ Script engine preloading
Fix YogaUtils.refreshComponent breaking when passed null window Fix YogaUtils.refreshComponent breaking when passed null window
Remove FontUtils .testcache creation Remove FontUtils .testcache creation
File watching scripts source dir File watching scripts source dir
Fix STBImage flipping bug (set flag statically)
Update visuals on pine tree

View File

@ -271,10 +271,14 @@ public class ServerToolbarState implements BehaviorTree {
// //
//Visual transforms //Visual transforms
if(targetHasWhitelist){ if(targetHasWhitelist){
ServerEntityUtils.destroyEntity(this.realWorldItem); if(this.realWorldItem != null){
ServerEntityUtils.destroyEntity(this.realWorldItem);
}
this.realWorldItem = null; this.realWorldItem = null;
} else { } else {
ServerEntityUtils.destroyEntity(this.realWorldItem); if(this.realWorldItem != null){
ServerEntityUtils.destroyEntity(this.realWorldItem);
}
this.realWorldItem = null; this.realWorldItem = null;
} }

View File

@ -11,7 +11,7 @@ import electrosphere.util.FileUtils;
import java.io.File; import java.io.File;
import org.lwjgl.assimp.AIScene; import org.lwjgl.assimp.AIScene;
import static org.lwjgl.assimp.Assimp.*; import org.lwjgl.assimp.Assimp;
/** /**
* Main model loading class * Main model loading class
@ -26,16 +26,16 @@ public class ModelLoader {
public static AIScene loadAIScene(String path){ public static AIScene loadAIScene(String path){
AIScene rVal; AIScene rVal;
File toRead = FileUtils.getAssetFile(path); File toRead = FileUtils.getAssetFile(path);
rVal = aiImportFile(toRead.getAbsolutePath(), rVal = Assimp.aiImportFile(toRead.getAbsolutePath(),
aiProcess_GenSmoothNormals | Assimp.aiProcess_GenSmoothNormals |
aiProcess_JoinIdenticalVertices | Assimp.aiProcess_JoinIdenticalVertices |
aiProcess_Triangulate | Assimp.aiProcess_Triangulate |
aiProcess_FixInfacingNormals | Assimp.aiProcess_FixInfacingNormals |
aiProcess_LimitBoneWeights | Assimp.aiProcess_LimitBoneWeights |
aiProcess_GlobalScale Assimp.aiProcess_GlobalScale
); );
if(rVal == null){ if(rVal == null){
LoggerInterface.loggerRenderer.ERROR(new IllegalStateException(aiGetErrorString())); LoggerInterface.loggerRenderer.ERROR(new IllegalStateException(Assimp.aiGetErrorString()));
} }
return rVal; return rVal;
} }
@ -69,9 +69,9 @@ public class ModelLoader {
for(Mesh mesh : m.getMeshes()){ for(Mesh mesh : m.getMeshes()){
MeshTextureData meshTextureData = Globals.textureMapDefault.getMeshTextures(path, mesh.getMeshName()); MeshTextureData meshTextureData = Globals.textureMapDefault.getMeshTextures(path, mesh.getMeshName());
if(meshTextureData != null){ if(meshTextureData != null){
setMaterial(mesh,meshTextureData); ModelLoader.setMaterial(mesh,meshTextureData);
} else if(defaultMeshData != null){ } else if(defaultMeshData != null){
setMaterial(mesh,defaultMeshData); ModelLoader.setMaterial(mesh,defaultMeshData);
} else { } else {
LoggerInterface.loggerRenderer.WARNING("Model " + path + " does not have texture data defined for \"" + mesh.getMeshName() + "\""); LoggerInterface.loggerRenderer.WARNING("Model " + path + " does not have texture data defined for \"" + mesh.getMeshName() + "\"");
} }
@ -84,9 +84,9 @@ public class ModelLoader {
for(Mesh mesh : m.getMeshes()){ for(Mesh mesh : m.getMeshes()){
MeshTextureData meshTextureData = localTextureMap.getMeshTextures(path, mesh.getMeshName()); MeshTextureData meshTextureData = localTextureMap.getMeshTextures(path, mesh.getMeshName());
if(meshTextureData != null){ if(meshTextureData != null){
setMaterial(mesh,meshTextureData); ModelLoader.setMaterial(mesh,meshTextureData);
} else if(defaultMeshData != null){ } else if(defaultMeshData != null){
setMaterial(mesh,defaultMeshData); ModelLoader.setMaterial(mesh,defaultMeshData);
} else { } else {
LoggerInterface.loggerRenderer.WARNING("Model " + path + " does not have texture data defined for \"" + mesh.getMeshName() + "\""); LoggerInterface.loggerRenderer.WARNING("Model " + path + " does not have texture data defined for \"" + mesh.getMeshName() + "\"");
} }

View File

@ -116,18 +116,11 @@ public class Material {
Globals.renderingEngine.checkError(); Globals.renderingEngine.checkError();
} }
} }
public void apply_material(OpenGLState openGLState, int diffuse_channel, int specular_channel){
Texture diffuseTexture = Globals.assetManager.fetchTexture(diffuse);
if(diffuseTexture != null){
diffuseTexture.bind(openGLState,diffuse_channel);
}
Texture specularTexture = Globals.assetManager.fetchTexture(specular);
if(specularTexture != null){
specularTexture.bind(openGLState,specular_channel);
}
Globals.renderingEngine.checkError();
}
/**
* Checks if this material has transparency
* @return true if there is transparency, false otherwise
*/
public boolean isTransparent(){ public boolean isTransparent(){
boolean rVal = false; boolean rVal = false;
Texture diffuseTexture = Globals.assetManager.fetchTexture(diffuse); Texture diffuseTexture = Globals.assetManager.fetchTexture(diffuse);

View File

@ -387,7 +387,7 @@ public class Mesh {
if(renderPipelineState.getUseMaterial() && textureMask == null){ if(renderPipelineState.getUseMaterial() && textureMask == null){
Globals.renderingEngine.checkError(); Globals.renderingEngine.checkError();
if(material == null){ if(material == null){
Globals.materialDefault.apply_material(openGLState,0,1); Globals.materialDefault.apply_material(openGLState);
openGLState.getActiveShader().setUniform(openGLState, "hasTransparency", 0); openGLState.getActiveShader().setUniform(openGLState, "hasTransparency", 0);
} else { } else {
material.apply_material(openGLState); material.apply_material(openGLState);

View File

@ -30,6 +30,13 @@ import static org.lwjgl.opengl.GL30.*;
*/ */
public class Texture { public class Texture {
/**
* Makes sure images are flipped the way opengl expects
*/
static {
STBImage.stbi_set_flip_vertically_on_load(true);
}
/** /**
* Pointer for an uninitialized texture * Pointer for an uninitialized texture
*/ */