start to fix unaligned equipped items
This commit is contained in:
		
							parent
							
								
									9c441a24c4
								
							
						
					
					
						commit
						129b9d9a33
					
				| @ -676,7 +676,7 @@ public class LoadingThread extends Thread { | |||||||
|         // OpportunisticAttacker.attachToCreature(goblin); |         // OpportunisticAttacker.attachToCreature(goblin); | ||||||
| 
 | 
 | ||||||
|         Entity sword = ItemUtils.spawnBasicItem("Katana"); |         Entity sword = ItemUtils.spawnBasicItem("Katana"); | ||||||
|         EntityUtils.getPosition(sword).set(new Vector3f(1,0.1f,2)); |         EntityUtils.getPosition(sword).set(new Vector3f(1,0.4f,2)); | ||||||
|         // Entity shorts = ItemUtils.spawnBasicItem("boots1"); |         // Entity shorts = ItemUtils.spawnBasicItem("boots1"); | ||||||
|         // EntityUtils.getPosition(shorts).set(new Vector3f(2,0.1f,2)); |         // EntityUtils.getPosition(shorts).set(new Vector3f(2,0.1f,2)); | ||||||
|         // // Entity hair = ItemUtils.spawnBasicItem("hairshort1"); |         // // Entity hair = ItemUtils.spawnBasicItem("hairshort1"); | ||||||
| @ -684,6 +684,11 @@ public class LoadingThread extends Thread { | |||||||
|         Entity bow = ItemUtils.spawnBasicItem("bow1"); |         Entity bow = ItemUtils.spawnBasicItem("bow1"); | ||||||
|         EntityUtils.getPosition(bow).set(new Vector3f(2,0.1f,1)); |         EntityUtils.getPosition(bow).set(new Vector3f(2,0.1f,1)); | ||||||
| 
 | 
 | ||||||
|  |         //crate | ||||||
|  |         Entity crate = EntityUtils.spawnDrawableEntity("Models/crate2.fbx"); | ||||||
|  |         EntityUtils.getPosition(crate).set(5,0.5,5); | ||||||
|  |         EntityUtils.getScale(crate).set(new Vector3f(0.5f)); | ||||||
|  | 
 | ||||||
|         // //center flame |         // //center flame | ||||||
|         // Entity fire = ParticleUtils.spawnStaticBillboardParticle(); |         // Entity fire = ParticleUtils.spawnStaticBillboardParticle(); | ||||||
|         // EntityUtils.getPosition(fire).set(new Vector3f(1,0.2f,1)); |         // EntityUtils.getPosition(fire).set(new Vector3f(1,0.2f,1)); | ||||||
| @ -692,24 +697,24 @@ public class LoadingThread extends Thread { | |||||||
|         // fireActor.maskShader("particleBillboard", "Shaders/flame1/flame.vs", "Shaders/flame1/flame.fs"); |         // fireActor.maskShader("particleBillboard", "Shaders/flame1/flame.vs", "Shaders/flame1/flame.fs"); | ||||||
|         // Globals.assetManager.addShaderToQueue("Shaders/flame1/flame.vs", "Shaders/flame1/flame.fs"); |         // Globals.assetManager.addShaderToQueue("Shaders/flame1/flame.vs", "Shaders/flame1/flame.fs"); | ||||||
| 
 | 
 | ||||||
|         // //campfire |         // // //campfire | ||||||
|         Entity campfire = EntityUtils.spawnDrawableEntity("Models/campfire1.fbx"); |         // Entity campfire = EntityUtils.spawnDrawableEntity("Models/campfire1.fbx"); | ||||||
|         EntityUtils.getPosition(campfire).set(1,0,1); |         // EntityUtils.getPosition(campfire).set(1,0,1); | ||||||
|         EntityUtils.getRotation(campfire).rotationX(-(float)Math.PI/2.0f); |         // EntityUtils.getRotation(campfire).rotationX(-(float)Math.PI/2.0f); | ||||||
|         campfire.putData(EntityDataStrings.DRAW_OUTLINE, true); |         // campfire.putData(EntityDataStrings.DRAW_OUTLINE, true); | ||||||
| 
 | 
 | ||||||
|         //flame |         // //flame | ||||||
|         Entity cube = EntityUtils.spawnDrawableEntity("Models/flame1.fbx"); |         // Entity cube = EntityUtils.spawnDrawableEntity("Models/flame1.fbx"); | ||||||
|         //shader mask |         // //shader mask | ||||||
|         EntityUtils.getActor(cube).maskShader("Sphere", "Shaders/flame2/flame.vs", "Shaders/flame2/flame.fs"); |         // EntityUtils.getActor(cube).maskShader("Sphere", "Shaders/flame2/flame.vs", "Shaders/flame2/flame.fs"); | ||||||
|         Globals.assetManager.addShaderToQueue("Shaders/flame2/flame.vs", "Shaders/flame2/flame.fs"); |         // Globals.assetManager.addShaderToQueue("Shaders/flame2/flame.vs", "Shaders/flame2/flame.fs"); | ||||||
|         EntityUtils.getScale(cube).set(0.8f); |         // EntityUtils.getScale(cube).set(0.8f); | ||||||
|         EntityUtils.getPosition(cube).set(1,0.08f,1); |         // EntityUtils.getPosition(cube).set(1,0.08f,1); | ||||||
|         EntityUtils.getRotation(cube).rotationX(-(float)Math.PI/2.0f); |         // EntityUtils.getRotation(cube).rotationX(-(float)Math.PI/2.0f); | ||||||
|         //texture mask |         // //texture mask | ||||||
|         EntityUtils.getActor(cube).addTextureMask(RenderUtils.generateVolumetricTextureMask("Sphere")); |         // EntityUtils.getActor(cube).addTextureMask(RenderUtils.generateVolumetricTextureMask("Sphere")); | ||||||
|         //set draw volumetric |         // //set draw volumetric | ||||||
|         cube.putData(EntityDataStrings.DRAW_VOLUMETRIC, true); |         // cube.putData(EntityDataStrings.DRAW_VOLUMETRIC, true); | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|         // Globals.assetManager.addShaderToQueue("Shaders/grass1/grass1.vs", "Shaders/grass1/grass1.gs", "Shaders/grass1/grass1.fs"); |         // Globals.assetManager.addShaderToQueue("Shaders/grass1/grass1.vs", "Shaders/grass1/grass1.gs", "Shaders/grass1/grass1.fs"); | ||||||
| @ -719,39 +724,39 @@ public class LoadingThread extends Thread { | |||||||
|         // EntityUtils.getPosition(grass).set(3,0,1); |         // EntityUtils.getPosition(grass).set(3,0,1); | ||||||
| 
 | 
 | ||||||
|         // queue grass shader |         // queue grass shader | ||||||
|         Globals.assetManager.addShaderToQueue("Shaders/grass1/grass1.vs", "Shaders/grass1/grass1.gs", "Shaders/grass1/grass1.fs"); |         // Globals.assetManager.addShaderToQueue("Shaders/grass1/grass1.vs", "Shaders/grass1/grass1.gs", "Shaders/grass1/grass1.fs"); | ||||||
|         for(int x = 0; x < 10; x++){ |         // for(int x = 0; x < 10; x++){ | ||||||
|             for(int y = 0; y < 10; y++){ |         //     for(int y = 0; y < 10; y++){ | ||||||
|                 Entity grass = EntityUtils.spawnDrawableEntity("Models/grass1.fbx"); |         //         Entity grass = EntityUtils.spawnDrawableEntity("Models/grass1.fbx"); | ||||||
|                 //shader mask |         //         //shader mask | ||||||
|                 EntityUtils.getActor(grass).maskShader("Cube", "Shaders/grass1/grass1.vs", "Shaders/grass1/grass1.gs", "Shaders/grass1/grass1.fs"); |         //         EntityUtils.getActor(grass).maskShader("Cube", "Shaders/grass1/grass1.vs", "Shaders/grass1/grass1.gs", "Shaders/grass1/grass1.fs"); | ||||||
|                 EntityUtils.getPosition(grass).set(3 + x / 5.0f,0.0,1 + y / 5.0f); |         //         EntityUtils.getPosition(grass).set(3 + x / 5.0f,0.0,1 + y / 5.0f); | ||||||
|             } |         //     } | ||||||
|         } |         // } | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|         //water cube |         // //water cube | ||||||
|         Entity water = EntityUtils.spawnDrawableEntity("Models/watercube1.fbx"); |         // Entity water = EntityUtils.spawnDrawableEntity("Models/watercube1.fbx"); | ||||||
|         EntityUtils.getActor(water).maskShader("Cube", "Shaders/water1/water.vs", "Shaders/water1/water.fs"); |         // EntityUtils.getActor(water).maskShader("Cube", "Shaders/water1/water.vs", "Shaders/water1/water.fs"); | ||||||
|         Globals.assetManager.addShaderToQueue("Shaders/water1/water.vs", "Shaders/water1/water.fs"); |         // Globals.assetManager.addShaderToQueue("Shaders/water1/water.vs", "Shaders/water1/water.fs"); | ||||||
|         // EntityUtils.getPosition(water).set(5,0.51,5); |         // // EntityUtils.getPosition(water).set(5,0.51,5); | ||||||
|         // EntityUtils.getRotation(water).rotationX((float)Math.PI/4.0f); |         // // EntityUtils.getRotation(water).rotationX((float)Math.PI/4.0f); | ||||||
|         EntityUtils.getPosition(water).set(5,-0.1,5); |         // EntityUtils.getPosition(water).set(5,-0.1,5); | ||||||
|         EntityUtils.getScale(water).set(1,1,1); |         // EntityUtils.getScale(water).set(1,1,1); | ||||||
|         //texture mask |         // //texture mask | ||||||
|         EntityUtils.getActor(water).addTextureMask(RenderUtils.generateVolumetricTextureMask("Cube")); |         // EntityUtils.getActor(water).addTextureMask(RenderUtils.generateVolumetricTextureMask("Cube")); | ||||||
|         //set draw volumetric |         // //set draw volumetric | ||||||
|         water.putData(EntityDataStrings.DRAW_VOLUMETRIC, true); |         // water.putData(EntityDataStrings.DRAW_VOLUMETRIC, true); | ||||||
|         water.removeData(EntityDataStrings.DRAW_SOLID_PASS); |         // water.removeData(EntityDataStrings.DRAW_SOLID_PASS); | ||||||
|         water.putData(EntityDataStrings.DRAW_TRANSPARENT_PASS, true); |         // water.putData(EntityDataStrings.DRAW_TRANSPARENT_PASS, true); | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|         //shrine 2 |         // //shrine 2 | ||||||
|         Entity shrine = EntityUtils.spawnDrawableEntity("Models/shrine2.fbx"); |         // Entity shrine = EntityUtils.spawnDrawableEntity("Models/shrine2.fbx"); | ||||||
|         EntityUtils.getPosition(shrine).set(15,0,15); |         // EntityUtils.getPosition(shrine).set(15,0,15); | ||||||
|         EntityUtils.getRotation(shrine).rotationX((float)-Math.PI/2.0f); |         // EntityUtils.getRotation(shrine).rotationX((float)-Math.PI/2.0f); | ||||||
|         shrine.putData(EntityDataStrings.DRAW_OUTLINE, true); |         // shrine.putData(EntityDataStrings.DRAW_OUTLINE, true); | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| //        goblin = CreatureUtils.spawnBasicCreature("Goblin"); | //        goblin = CreatureUtils.spawnBasicCreature("Goblin"); | ||||||
|  | |||||||
| @ -12,4 +12,11 @@ public class GravityUtils { | |||||||
|         } |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     public static void attemptDeactivateGravity(Entity target){ | ||||||
|  |         if(target.getDataKeys().contains(EntityDataStrings.GRAVITY_ENTITY)){ | ||||||
|  |             GravityTree tree = (GravityTree)target.getData(EntityDataStrings.GRAVITY_TREE); | ||||||
|  |             tree.stop(); | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | 
 | ||||||
| } | } | ||||||
| @ -5,6 +5,8 @@ import electrosphere.engine.LoadingThread; | |||||||
| import electrosphere.entity.Entity; | import electrosphere.entity.Entity; | ||||||
| import electrosphere.entity.EntityDataStrings; | import electrosphere.entity.EntityDataStrings; | ||||||
| import electrosphere.entity.state.equip.EquipState; | import electrosphere.entity.state.equip.EquipState; | ||||||
|  | import electrosphere.entity.state.gravity.GravityUtils; | ||||||
|  | import electrosphere.entity.state.gravity.GravityTree.GravityTreeState; | ||||||
| import electrosphere.entity.state.inventory.InventoryUtils; | import electrosphere.entity.state.inventory.InventoryUtils; | ||||||
| import electrosphere.entity.state.inventory.RelationalInventoryState; | import electrosphere.entity.state.inventory.RelationalInventoryState; | ||||||
| import electrosphere.entity.state.inventory.UnrelationalInventoryState; | import electrosphere.entity.state.inventory.UnrelationalInventoryState; | ||||||
| @ -973,6 +975,7 @@ public class MenuGenerators { | |||||||
|                             //fire equip event to equip state |                             //fire equip event to equip state | ||||||
|                             EquipState equipState = (EquipState)Globals.playerCharacter.getData(EntityDataStrings.EQUIP_STATE); |                             EquipState equipState = (EquipState)Globals.playerCharacter.getData(EntityDataStrings.EQUIP_STATE); | ||||||
|                             equipState.attemptEquip(inWorldItem,inventory.getEquipPointFromSlot(slots.get(itemId))); |                             equipState.attemptEquip(inWorldItem,inventory.getEquipPointFromSlot(slots.get(itemId))); | ||||||
|  |                             GravityUtils.attemptDeactivateGravity(inWorldItem); | ||||||
|                         } |                         } | ||||||
|                         //update ui |                         //update ui | ||||||
|                         Globals.dragSourceInventory = null; |                         Globals.dragSourceInventory = null; | ||||||
|  | |||||||
| @ -199,7 +199,7 @@ public class RenderingEngine { | |||||||
|      |      | ||||||
|     ShaderProgram activeProgram; |     ShaderProgram activeProgram; | ||||||
| 
 | 
 | ||||||
|     static int outputFramebuffer = 6; |     static int outputFramebuffer = 0; | ||||||
|      |      | ||||||
|      |      | ||||||
|     public void createOpenglContext(){ |     public void createOpenglContext(){ | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user