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
/**/.DS_Store
/build
/launcher/launcher.exe

View File

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

View File

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

View File

@ -1,5 +1,6 @@
package electrosphere.renderer.framebuffer;
import electrosphere.main.Globals;
import static org.lwjgl.opengl.GL11.GL_DEPTH_COMPONENT;
import static org.lwjgl.opengl.GL11.GL_FLOAT;
import static org.lwjgl.opengl.GL11.GL_LINEAR;
@ -50,7 +51,7 @@ public class FramebufferUtils {
//texture
int texture = glGenTextures();
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_MAG_FILTER, GL_LINEAR);
buffer.setTexture(texture);
@ -60,7 +61,7 @@ public class FramebufferUtils {
//renderbuffer
int renderBuffer = glGenRenderbuffers();
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
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_RENDERBUFFER, renderBuffer);
//check make sure compiled
@ -73,7 +74,7 @@ public class FramebufferUtils {
public static Renderbuffer generateScreensizeStencilDepthRenderbuffer(){
Renderbuffer buffer = new Renderbuffer();
buffer.bind();
glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH24_STENCIL8, 1920, 1080);
glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH24_STENCIL8, Globals.WINDOW_WIDTH, Globals.WINDOW_HEIGHT);
return buffer;
}