Better rendering on mac

This commit is contained in:
satellite 2021-07-10 13:53:49 -04:00
parent 908de02404
commit 3cf8a45c63
4 changed files with 30 additions and 27 deletions

2
.gitignore vendored
View File

@ -1,5 +1,7 @@
/target /target
/**/.DS_Store
/build /build
/launcher/launcher.exe /launcher/launcher.exe

View File

@ -480,13 +480,13 @@ public class LoadingThread extends Thread {
// } // }
//trees \:D/ //trees \:D/
for(int i = 0; i < 10; i++){ // for(int i = 0; i < 10; i++){
Random rand = new Random(); // Random rand = new Random();
String treePath = "Models/tree1.fbx"; // String treePath = "Models/tree1.fbx";
Entity tree = EntityUtils.spawnDrawableEntity(treePath); // Entity tree = EntityUtils.spawnDrawableEntity(treePath);
EntityUtils.getPosition(tree).set(rand.nextFloat() * 150 + 10, 0, rand.nextFloat() * 150 + 10); // EntityUtils.getPosition(tree).set(rand.nextFloat() * 150 + 10, 0, rand.nextFloat() * 150 + 10);
// EntityUtils.getEntityRotation(tree).rotateAxis((float)-Math.PI/2.0f, new Vector3f(1,0,0)); //// EntityUtils.getEntityRotation(tree).rotateAxis((float)-Math.PI/2.0f, new Vector3f(1,0,0));
} // }
String buildingPath = "Models/building1.fbx"; String buildingPath = "Models/building1.fbx";
Entity building = EntityUtils.spawnDrawableEntity(buildingPath); Entity building = EntityUtils.spawnDrawableEntity(buildingPath);
@ -496,22 +496,22 @@ public class LoadingThread extends Thread {
// ActorUtils.applyBlenderTransformer(building); // ActorUtils.applyBlenderTransformer(building);
//spawn evil goblin //spawn evil goblin
Entity goblin = CreatureUtils.spawnBasicCreature("Goblin"); // Entity goblin = CreatureUtils.spawnBasicCreature("Goblin");
EntityUtils.getPosition(goblin).set(30, 0, 30); // EntityUtils.getPosition(goblin).set(30, 0, 30);
EntityUtils.getScale(goblin).set(0.005f); // EntityUtils.getScale(goblin).set(0.005f);
//give evil goblin sword // //give evil goblin sword
Entity goblinSword = ItemUtils.spawnBasicItem("Katana"); // Entity goblinSword = ItemUtils.spawnBasicItem("Katana");
AttachUtils.attachEntityToEntityAtBone(goblin, goblinSword, "Bone.031"); // AttachUtils.attachEntityToEntityAtBone(goblin, goblinSword, "Bone.031");
//attach ai to evil goblin // //attach ai to evil goblin
MindlessAttacker.attachToCreature(goblin); // MindlessAttacker.attachToCreature(goblin);
//
//
Entity testHomie = CreatureUtils.spawnBasicCreature("Human"); // Entity testHomie = CreatureUtils.spawnBasicCreature("Human");
EntityUtils.getScale(testHomie).set(0.005f); // EntityUtils.getScale(testHomie).set(0.005f);
EntityUtils.getPosition(testHomie).set(2,0,2); // EntityUtils.getPosition(testHomie).set(2,0,2);
//
Entity sword = ItemUtils.spawnBasicItem("Katana"); // Entity sword = ItemUtils.spawnBasicItem("Katana");
AttachUtils.attachEntityToEntityAtBone(testHomie, sword, "Bone.020"); // AttachUtils.attachEntityToEntityAtBone(testHomie, sword, "Bone.020");
} }

View File

@ -93,7 +93,7 @@ public class ServerConnectionHandler implements Runnable {
System.exit(1); System.exit(1);
} }
//spawn player in world //spawn player in world
Entity newPlayerCharacter = CreatureUtils.spawnBasicCreature("Goblin"); Entity newPlayerCharacter = CreatureUtils.spawnBasicCreature("Human");
playerCharacterID = newPlayerCharacter.getId(); playerCharacterID = newPlayerCharacter.getId();
EntityUtils.getPosition(newPlayerCharacter).set(Globals.spawnPoint.x,0,Globals.spawnPoint.z); EntityUtils.getPosition(newPlayerCharacter).set(Globals.spawnPoint.x,0,Globals.spawnPoint.z);
//spawn player sword //spawn player sword

View File

@ -1,5 +1,6 @@
package electrosphere.renderer.framebuffer; package electrosphere.renderer.framebuffer;
import electrosphere.main.Globals;
import static org.lwjgl.opengl.GL11.GL_DEPTH_COMPONENT; import static org.lwjgl.opengl.GL11.GL_DEPTH_COMPONENT;
import static org.lwjgl.opengl.GL11.GL_FLOAT; import static org.lwjgl.opengl.GL11.GL_FLOAT;
import static org.lwjgl.opengl.GL11.GL_LINEAR; import static org.lwjgl.opengl.GL11.GL_LINEAR;
@ -50,7 +51,7 @@ public class FramebufferUtils {
//texture //texture
int texture = glGenTextures(); int texture = glGenTextures();
glBindTexture(GL_TEXTURE_2D,texture); glBindTexture(GL_TEXTURE_2D,texture);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 1920, 1080, 0, GL_RGB, GL_UNSIGNED_BYTE, NULL); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, Globals.WINDOW_WIDTH, Globals.WINDOW_HEIGHT, 0, GL_RGB, GL_UNSIGNED_BYTE, NULL);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
buffer.setTexture(texture); buffer.setTexture(texture);
@ -60,7 +61,7 @@ public class FramebufferUtils {
//renderbuffer //renderbuffer
int renderBuffer = glGenRenderbuffers(); int renderBuffer = glGenRenderbuffers();
glBindRenderbuffer(GL_RENDERBUFFER, renderBuffer); glBindRenderbuffer(GL_RENDERBUFFER, renderBuffer);
glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH24_STENCIL8, 1920, 1080); glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH24_STENCIL8, Globals.WINDOW_WIDTH, Globals.WINDOW_HEIGHT);
//bind rbo to fbo //bind rbo to fbo
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_RENDERBUFFER, renderBuffer); glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_RENDERBUFFER, renderBuffer);
//check make sure compiled //check make sure compiled
@ -73,7 +74,7 @@ public class FramebufferUtils {
public static Renderbuffer generateScreensizeStencilDepthRenderbuffer(){ public static Renderbuffer generateScreensizeStencilDepthRenderbuffer(){
Renderbuffer buffer = new Renderbuffer(); Renderbuffer buffer = new Renderbuffer();
buffer.bind(); buffer.bind();
glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH24_STENCIL8, 1920, 1080); glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH24_STENCIL8, Globals.WINDOW_WIDTH, Globals.WINDOW_HEIGHT);
return buffer; return buffer;
} }