Fix transparent bug
This commit is contained in:
parent
c38fe6b322
commit
8a82598ccc
BIN
assets/Models/foliageBlockTemplate1Test1.fbx
Normal file
BIN
assets/Models/foliageBlockTemplate1Test1.fbx
Normal file
Binary file not shown.
@ -431,6 +431,20 @@
|
|||||||
"Textures/skyscraper1.png",
|
"Textures/skyscraper1.png",
|
||||||
"Textures/skyscraper1.png"
|
"Textures/skyscraper1.png"
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
"Models/foliageBlockTemplate1Test1.fbx" : {
|
||||||
|
"Plane" : [
|
||||||
|
"Textures/leaf3layer1.png",
|
||||||
|
"Textures/leaf3layer1.png"
|
||||||
|
],
|
||||||
|
"Plane.001" : [
|
||||||
|
"Textures/leaf3layer1.png",
|
||||||
|
"Textures/leaf3layer1.png"
|
||||||
|
],
|
||||||
|
"Plane.002" : [
|
||||||
|
"Textures/leaf3layer1.png",
|
||||||
|
"Textures/leaf3layer1.png"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
BIN
assets/Textures/leaf3layer1.png
Normal file
BIN
assets/Textures/leaf3layer1.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 183 KiB |
@ -1,3 +1,3 @@
|
|||||||
#maven.buildNumber.plugin properties file
|
#maven.buildNumber.plugin properties file
|
||||||
#Fri Jul 14 20:48:01 EDT 2023
|
#Tue Jul 25 19:29:28 EDT 2023
|
||||||
buildNumber=4
|
buildNumber=5
|
||||||
|
|||||||
@ -8,6 +8,7 @@ import org.joml.Vector3d;
|
|||||||
import electrosphere.engine.Globals;
|
import electrosphere.engine.Globals;
|
||||||
import electrosphere.engine.assetmanager.AssetDataStrings;
|
import electrosphere.engine.assetmanager.AssetDataStrings;
|
||||||
import electrosphere.entity.Entity;
|
import electrosphere.entity.Entity;
|
||||||
|
import electrosphere.entity.EntityCreationUtils;
|
||||||
import electrosphere.entity.EntityDataStrings;
|
import electrosphere.entity.EntityDataStrings;
|
||||||
import electrosphere.entity.EntityUtils;
|
import electrosphere.entity.EntityUtils;
|
||||||
import electrosphere.entity.ServerEntityUtils;
|
import electrosphere.entity.ServerEntityUtils;
|
||||||
@ -150,6 +151,11 @@ public class ArenaLoading {
|
|||||||
// Entity sword = ItemUtils.spawnBasicItem("Katana");
|
// Entity sword = ItemUtils.spawnBasicItem("Katana");
|
||||||
// EntityUtils.initiallyPositionEntity(sword, new Vector3d(1,0.4f,2));
|
// EntityUtils.initiallyPositionEntity(sword, new Vector3d(1,0.4f,2));
|
||||||
// EntityUtils.getRotation(sword).set(new Quaternionf().rotationY((float)(Math.PI/2.0)));
|
// EntityUtils.getRotation(sword).set(new Quaternionf().rotationY((float)(Math.PI/2.0)));
|
||||||
|
|
||||||
|
|
||||||
|
// Entity leafBlock = EntityCreationUtils.createClientSpatialEntity();
|
||||||
|
// EntityCreationUtils.makeEntityDrawable(leafBlock, "Models/foliageBlockTemplate1Test1.fbx");
|
||||||
|
// EntityUtils.getPosition(leafBlock).set(3,3,3);
|
||||||
|
|
||||||
//floating island 1
|
//floating island 1
|
||||||
// Entity island1 = ObjectUtils.spawnBasicObject("floatingisland1");
|
// Entity island1 = ObjectUtils.spawnBasicObject("floatingisland1");
|
||||||
|
|||||||
@ -14,8 +14,10 @@ import electrosphere.client.terrain.cells.DrawCellManager;
|
|||||||
import electrosphere.collision.CollisionEngine;
|
import electrosphere.collision.CollisionEngine;
|
||||||
import electrosphere.controls.ControlHandler;
|
import electrosphere.controls.ControlHandler;
|
||||||
import electrosphere.engine.Globals;
|
import electrosphere.engine.Globals;
|
||||||
|
import electrosphere.entity.DrawableUtils;
|
||||||
import electrosphere.entity.Entity;
|
import electrosphere.entity.Entity;
|
||||||
import electrosphere.entity.EntityCreationUtils;
|
import electrosphere.entity.EntityCreationUtils;
|
||||||
|
import electrosphere.entity.EntityDataStrings;
|
||||||
import electrosphere.entity.EntityUtils;
|
import electrosphere.entity.EntityUtils;
|
||||||
import electrosphere.entity.state.BehaviorTree;
|
import electrosphere.entity.state.BehaviorTree;
|
||||||
import electrosphere.entity.state.movement.ApplyRotationTree;
|
import electrosphere.entity.state.movement.ApplyRotationTree;
|
||||||
@ -28,6 +30,7 @@ import electrosphere.menu.WindowUtils;
|
|||||||
import electrosphere.net.NetUtils;
|
import electrosphere.net.NetUtils;
|
||||||
import electrosphere.net.client.ClientNetworking;
|
import electrosphere.net.client.ClientNetworking;
|
||||||
import electrosphere.renderer.ui.Window;
|
import electrosphere.renderer.ui.Window;
|
||||||
|
import electrosphere.server.datacell.EntityDataCellMapper;
|
||||||
|
|
||||||
public class ClientLoading {
|
public class ClientLoading {
|
||||||
|
|
||||||
@ -235,6 +238,10 @@ public class ClientLoading {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Entity leafBlob = EntityCreationUtils.createClientSpatialEntity();
|
||||||
|
EntityCreationUtils.makeEntityDrawable(leafBlob, "Models/foliageBlockTemplate1Test1.fbx");
|
||||||
|
DrawableUtils.makeEntityTransparent(leafBlob);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void initDrawCellManager(){
|
static void initDrawCellManager(){
|
||||||
|
|||||||
17
src/main/java/electrosphere/entity/DrawableUtils.java
Normal file
17
src/main/java/electrosphere/entity/DrawableUtils.java
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
package electrosphere.entity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Utilities to manipulating drawable entities (eg making an entity transparent)
|
||||||
|
*/
|
||||||
|
public class DrawableUtils {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Edits entity data to make the entity transparent
|
||||||
|
* @param entity The entity to edit
|
||||||
|
*/
|
||||||
|
public static void makeEntityTransparent(Entity entity){
|
||||||
|
entity.putData(EntityDataStrings.DRAW_TRANSPARENT_PASS, true);
|
||||||
|
entity.removeData(EntityDataStrings.DRAW_SOLID_PASS);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -206,7 +206,6 @@ public class ServerGravityTree implements BehaviorTree {
|
|||||||
boolean rVal = false;
|
boolean rVal = false;
|
||||||
for(Impulse impulse : collidable.getImpulses()){
|
for(Impulse impulse : collidable.getImpulses()){
|
||||||
if(impulse.getType().equals(Collidable.TYPE_TERRAIN)){
|
if(impulse.getType().equals(Collidable.TYPE_TERRAIN)){
|
||||||
System.out.println(rVal);
|
|
||||||
rVal = true;
|
rVal = true;
|
||||||
break;
|
break;
|
||||||
} else if(
|
} else if(
|
||||||
|
|||||||
@ -15,6 +15,7 @@ import static org.lwjgl.glfw.GLFW.glfwSwapBuffers;
|
|||||||
import static org.lwjgl.glfw.GLFW.glfwTerminate;
|
import static org.lwjgl.glfw.GLFW.glfwTerminate;
|
||||||
import static org.lwjgl.glfw.GLFW.glfwWindowHint;
|
import static org.lwjgl.glfw.GLFW.glfwWindowHint;
|
||||||
import static org.lwjgl.opengl.GL11.GL_ALWAYS;
|
import static org.lwjgl.opengl.GL11.GL_ALWAYS;
|
||||||
|
import static org.lwjgl.opengl.GL45.GL_LEQUAL;
|
||||||
import static org.lwjgl.opengl.GL11.GL_BLEND;
|
import static org.lwjgl.opengl.GL11.GL_BLEND;
|
||||||
import static org.lwjgl.opengl.GL11.GL_COLOR;
|
import static org.lwjgl.opengl.GL11.GL_COLOR;
|
||||||
import static org.lwjgl.opengl.GL11.GL_COLOR_BUFFER_BIT;
|
import static org.lwjgl.opengl.GL11.GL_COLOR_BUFFER_BIT;
|
||||||
@ -686,7 +687,9 @@ public class RenderingEngine {
|
|||||||
//
|
//
|
||||||
// Set render pipeline state
|
// Set render pipeline state
|
||||||
//
|
//
|
||||||
|
renderPipelineState.setUseMeshShader(true);
|
||||||
renderPipelineState.setSelectedShader(SelectedShaderEnum.OIT);
|
renderPipelineState.setSelectedShader(SelectedShaderEnum.OIT);
|
||||||
|
glDepthFunc(GL_LEQUAL);
|
||||||
|
|
||||||
//
|
//
|
||||||
//!!!WARNING!!!
|
//!!!WARNING!!!
|
||||||
@ -721,6 +724,8 @@ public class RenderingEngine {
|
|||||||
currentActor.draw(renderPipelineState);
|
currentActor.draw(renderPipelineState);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//draw all instanced models
|
||||||
|
Globals.clientInstanceManager.draw(renderPipelineState);
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|||||||
@ -13,6 +13,7 @@ import java.util.zip.DeflaterOutputStream;
|
|||||||
import java.util.zip.InflaterOutputStream;
|
import java.util.zip.InflaterOutputStream;
|
||||||
|
|
||||||
import electrosphere.engine.Globals;
|
import electrosphere.engine.Globals;
|
||||||
|
import electrosphere.logger.LoggerInterface;
|
||||||
import electrosphere.net.server.Server;
|
import electrosphere.net.server.Server;
|
||||||
import electrosphere.server.terrain.manager.ServerTerrainChunk;
|
import electrosphere.server.terrain.manager.ServerTerrainChunk;
|
||||||
import electrosphere.util.FileUtils;
|
import electrosphere.util.FileUtils;
|
||||||
@ -158,7 +159,7 @@ public class ChunkDiskMap {
|
|||||||
* @param terrainChunk The terrain chunk
|
* @param terrainChunk The terrain chunk
|
||||||
*/
|
*/
|
||||||
public void saveToDisk(ServerTerrainChunk terrainChunk){
|
public void saveToDisk(ServerTerrainChunk terrainChunk){
|
||||||
System.out.println("Save to disk: " + terrainChunk.getWorldX() + " " + terrainChunk.getWorldY() + " " + terrainChunk.getWorldZ());
|
LoggerInterface.loggerEngine.DEBUG("Save to disk: " + terrainChunk.getWorldX() + " " + terrainChunk.getWorldY() + " " + terrainChunk.getWorldZ());
|
||||||
//get the file name for this chunk
|
//get the file name for this chunk
|
||||||
String fileName = null;
|
String fileName = null;
|
||||||
String chunkKey = getTerrainChunkKey(terrainChunk.getWorldX(),terrainChunk.getWorldY(),terrainChunk.getWorldZ());
|
String chunkKey = getTerrainChunkKey(terrainChunk.getWorldX(),terrainChunk.getWorldY(),terrainChunk.getWorldZ());
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user