fix squished view, start work on inventory state
This commit is contained in:
parent
ff231c1c1d
commit
12e0ddb6a3
@ -75,7 +75,7 @@
|
||||
{
|
||||
"type" : "GROUND",
|
||||
"acceleration" : 16.0,
|
||||
"maxVelocity" : 3.0,
|
||||
"maxVelocity" : 1.0,
|
||||
"animationStartup" : {
|
||||
"name" : "Armature|WalkStart",
|
||||
"length" : 1,
|
||||
|
||||
Binary file not shown.
@ -0,0 +1,45 @@
|
||||
package electrosphere.entity.state.inventory;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import electrosphere.entity.Entity;
|
||||
|
||||
public class RelationalInventoryState {
|
||||
|
||||
int capacity;
|
||||
|
||||
Map<String,Entity> items = new HashMap<String,Entity>();
|
||||
|
||||
public RelationalInventoryState(List<String> slots){
|
||||
for(String slot : slots){
|
||||
items.put(slot,null);
|
||||
}
|
||||
}
|
||||
|
||||
public void addItem(String slot, Entity item){
|
||||
items.put(slot,item);
|
||||
}
|
||||
|
||||
public Entity removeItemSlot(String slot){
|
||||
Entity rVal = items.remove(slot);
|
||||
items.put(slot,null);
|
||||
return rVal;
|
||||
}
|
||||
|
||||
public Entity getItemSlot(String slot){
|
||||
return items.get(slot);
|
||||
}
|
||||
|
||||
public boolean hasItemInSlot(String slot){
|
||||
//if the slot is a key return if the value at the key isn't null, otherwise return false
|
||||
return items.containsKey(slot) ? items.get(slot) != null : false;
|
||||
}
|
||||
|
||||
public Set<String> getSlots(){
|
||||
return items.keySet();
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,29 @@
|
||||
package electrosphere.entity.state.inventory;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import electrosphere.entity.Entity;
|
||||
|
||||
public class UnrelationalInventoryState {
|
||||
|
||||
int capacity;
|
||||
|
||||
List<Entity> items = new LinkedList<Entity>();
|
||||
|
||||
public void addItem(Entity item){
|
||||
items.add(item);
|
||||
}
|
||||
|
||||
public void removeItem(Entity item){
|
||||
items.remove(item);
|
||||
}
|
||||
|
||||
public List<Entity> getItems(){
|
||||
return items;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -140,7 +140,7 @@ public class UserSettings {
|
||||
}
|
||||
Globals.WINDOW_WIDTH = Globals.userSettings.displayWidth;
|
||||
Globals.WINDOW_HEIGHT = Globals.userSettings.displayHeight;
|
||||
Globals.FOV = Globals.userSettings.graphicsFOV;
|
||||
Globals.verticalFOV = Globals.userSettings.graphicsFOV;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -177,7 +177,7 @@ public class Globals {
|
||||
//title bar dimensions
|
||||
public static int WINDOW_TITLE_BAR_HEIGHT = 0;
|
||||
|
||||
public static float FOV = 90;
|
||||
public static float verticalFOV = 90;
|
||||
|
||||
//matrices for drawing models
|
||||
public static Matrix4f viewMatrix = new Matrix4f();
|
||||
|
||||
@ -232,8 +232,10 @@ public class RenderingEngine {
|
||||
//
|
||||
Globals.projectionMatrix = new Matrix4f();
|
||||
Globals.viewMatrix = new Matrix4f();
|
||||
float FOV = (float)(Globals.FOV * Math.PI /180.0f);
|
||||
Globals.projectionMatrix.setPerspective(FOV, 1.0f, 0.1f, view_Range);
|
||||
float verticalFOV = (float)(Globals.verticalFOV * Math.PI /180.0f);
|
||||
float aspectRatio = (float)((float)Globals.WINDOW_WIDTH / (float)Globals.WINDOW_HEIGHT);
|
||||
float nearClip = 0.001f;
|
||||
Globals.projectionMatrix.setPerspective(verticalFOV, aspectRatio, nearClip, view_Range);
|
||||
Globals.viewMatrix.translation(new Vector3f(0.0f,0.0f,-3.0f));
|
||||
}
|
||||
|
||||
@ -258,7 +260,7 @@ public class RenderingEngine {
|
||||
}
|
||||
float rotationalDiff = phi;
|
||||
float dist = calculateDist(new Vector3f(cameraPos.x,0,cameraPos.z), new Vector3f(position.x,0,position.z));
|
||||
if(rotationalDiff > (Globals.FOV / 180 * Math.PI) && dist > 300){
|
||||
if(rotationalDiff > (Globals.verticalFOV / 180 * Math.PI) && dist > 300){
|
||||
rVal = false;
|
||||
}
|
||||
return rVal;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user