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];
};
/**
Cutoff for fragment alpha
*/
#define FRAGMENT_ALPHA_CUTOFF 0.001
out vec4 FragColor;
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);
void main(){
if(texture(material.diffuse, TexCoord).a < 0.01){
if(texture(material.diffuse, TexCoord).a < FRAGMENT_ALPHA_CUTOFF){
discard;
}
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
#Wed Nov 13 21:13:23 EST 2024
buildNumber=384
#Fri Nov 15 15:38:56 EST 2024
buildNumber=385

View File

@ -25,3 +25,6 @@ TODO(?):
- Some css support
- 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
Remove FontUtils .testcache creation
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
if(targetHasWhitelist){
ServerEntityUtils.destroyEntity(this.realWorldItem);
if(this.realWorldItem != null){
ServerEntityUtils.destroyEntity(this.realWorldItem);
}
this.realWorldItem = null;
} else {
ServerEntityUtils.destroyEntity(this.realWorldItem);
if(this.realWorldItem != null){
ServerEntityUtils.destroyEntity(this.realWorldItem);
}
this.realWorldItem = null;
}

View File

@ -11,7 +11,7 @@ import electrosphere.util.FileUtils;
import java.io.File;
import org.lwjgl.assimp.AIScene;
import static org.lwjgl.assimp.Assimp.*;
import org.lwjgl.assimp.Assimp;
/**
* Main model loading class
@ -26,16 +26,16 @@ public class ModelLoader {
public static AIScene loadAIScene(String path){
AIScene rVal;
File toRead = FileUtils.getAssetFile(path);
rVal = aiImportFile(toRead.getAbsolutePath(),
aiProcess_GenSmoothNormals |
aiProcess_JoinIdenticalVertices |
aiProcess_Triangulate |
aiProcess_FixInfacingNormals |
aiProcess_LimitBoneWeights |
aiProcess_GlobalScale
);
rVal = Assimp.aiImportFile(toRead.getAbsolutePath(),
Assimp.aiProcess_GenSmoothNormals |
Assimp.aiProcess_JoinIdenticalVertices |
Assimp.aiProcess_Triangulate |
Assimp.aiProcess_FixInfacingNormals |
Assimp.aiProcess_LimitBoneWeights |
Assimp.aiProcess_GlobalScale
);
if(rVal == null){
LoggerInterface.loggerRenderer.ERROR(new IllegalStateException(aiGetErrorString()));
LoggerInterface.loggerRenderer.ERROR(new IllegalStateException(Assimp.aiGetErrorString()));
}
return rVal;
}
@ -69,9 +69,9 @@ public class ModelLoader {
for(Mesh mesh : m.getMeshes()){
MeshTextureData meshTextureData = Globals.textureMapDefault.getMeshTextures(path, mesh.getMeshName());
if(meshTextureData != null){
setMaterial(mesh,meshTextureData);
ModelLoader.setMaterial(mesh,meshTextureData);
} else if(defaultMeshData != null){
setMaterial(mesh,defaultMeshData);
ModelLoader.setMaterial(mesh,defaultMeshData);
} else {
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()){
MeshTextureData meshTextureData = localTextureMap.getMeshTextures(path, mesh.getMeshName());
if(meshTextureData != null){
setMaterial(mesh,meshTextureData);
ModelLoader.setMaterial(mesh,meshTextureData);
} else if(defaultMeshData != null){
setMaterial(mesh,defaultMeshData);
ModelLoader.setMaterial(mesh,defaultMeshData);
} else {
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();
}
}
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(){
boolean rVal = false;
Texture diffuseTexture = Globals.assetManager.fetchTexture(diffuse);

View File

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

View File

@ -30,6 +30,13 @@ import static org.lwjgl.opengl.GL30.*;
*/
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
*/