texture map refactor
This commit is contained in:
		
							parent
							
								
									bfbdf5cf3e
								
							
						
					
					
						commit
						9941dd333e
					
				
							
								
								
									
										35
									
								
								assets/Models/creatures/person2/texturemap.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										35
									
								
								assets/Models/creatures/person2/texturemap.json
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,35 @@ | |||||||
|  | { | ||||||
|  |     "textureMap": { | ||||||
|  |         "Models/creatures/person2/person2_1.glb": [ | ||||||
|  |             { | ||||||
|  |                 "meshName" : "Torso.001", | ||||||
|  |                 "diffuse" : "/Textures/skin1.png", | ||||||
|  |                 "isDefault" : true | ||||||
|  |             }, | ||||||
|  |             { | ||||||
|  |                 "meshName" : "Eyebrow.R", | ||||||
|  |                 "diffuse" : "/Textures/b1.png" | ||||||
|  |             }, | ||||||
|  |             { | ||||||
|  |                 "meshName" : "Eyebrow.L", | ||||||
|  |                 "diffuse" : "/Textures/b1.png" | ||||||
|  |             }, | ||||||
|  |             { | ||||||
|  |                 "meshName" : "Eye.R", | ||||||
|  |                 "diffuse" : "/Textures/w1.png" | ||||||
|  |             }, | ||||||
|  |             { | ||||||
|  |                 "meshName" : "Eye.L", | ||||||
|  |                 "diffuse" : "/Textures/w1.png" | ||||||
|  |             }, | ||||||
|  |             { | ||||||
|  |                 "meshName" : "Iris.R", | ||||||
|  |                 "diffuse" : "/Textures/b1.png" | ||||||
|  |             }, | ||||||
|  |             { | ||||||
|  |                 "meshName" : "Iris.L", | ||||||
|  |                 "diffuse" : "/Textures/b1.png" | ||||||
|  |             } | ||||||
|  |         ] | ||||||
|  |     } | ||||||
|  | } | ||||||
							
								
								
									
										11
									
								
								assets/Models/creatures/texturemap.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								assets/Models/creatures/texturemap.json
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,11 @@ | |||||||
|  | { | ||||||
|  |     "textureMap": { | ||||||
|  |         "Models/creatures/viewmodel.glb": [ | ||||||
|  |             { | ||||||
|  |                 "meshName" : "hands", | ||||||
|  |                 "diffuse" : "/Textures/skin1.png", | ||||||
|  |                 "isDefault" : true | ||||||
|  |             } | ||||||
|  |         ] | ||||||
|  |     } | ||||||
|  | } | ||||||
| @ -1,462 +1,277 @@ | |||||||
| { | { | ||||||
|     "texture_map": { |     "textureMap": { | ||||||
|         "Models/plane.fbx": { |         "Models/plane.fbx": [ | ||||||
|             "Cube": [ |             { | ||||||
|                 "/Textures/Ground/Dirt1.png", |                 "meshName" : "Cube", | ||||||
|                 "/Textures/Ground/Dirt1.png" |                 "diffuse" : "/Textures/Ground/Dirt1.png" | ||||||
|             ] |             } | ||||||
|  |         ], | ||||||
|  |         "Models/basic/geometry/unitsphere.glb": [ | ||||||
|  |             { | ||||||
|  |                 "meshName" : "Sphere", | ||||||
|  |                 "diffuse" : "/Textures/transparent_blue.png" | ||||||
|  |             } | ||||||
|  |         ], | ||||||
|  |         "Models/basic/geometry/unitsphere.fbx": [ | ||||||
|  |             { | ||||||
|  |                 "meshName" : "Sphere", | ||||||
|  |                 "diffuse" : "/Textures/transparent_blue.png" | ||||||
|  |             } | ||||||
|  |         ], | ||||||
|  |         "Models/basic/geometry/unitsphere_1.fbx": [ | ||||||
|  |             { | ||||||
|  |                 "meshName" : "Sphere", | ||||||
|  |                 "diffuse" : "/Textures/transparent_red.png" | ||||||
|  |             } | ||||||
|  |         ], | ||||||
|  |         "Models/basic/geometry/unitsphere_grey.fbx": [ | ||||||
|  |             { | ||||||
|  |                 "meshName" : "Sphere", | ||||||
|  |                 "diffuse" : "/Textures/transparent_grey.png" | ||||||
|  |             } | ||||||
|  |         ], | ||||||
|  |         "Models/basic/geometry/SmallCube.fbx": [ | ||||||
|  |             { | ||||||
|  |                 "meshName" : "Sphere", | ||||||
|  |                 "diffuse" : "/Textures/transparent_grey.png", | ||||||
|  |                 "isDefault": true | ||||||
|  |             } | ||||||
|  |         ], | ||||||
|  |         "Models/basic/geometry/unitcapsule.glb": [ | ||||||
|  |             { | ||||||
|  |                 "meshName" : "Sphere", | ||||||
|  |                 "diffuse" : "/Textures/transparent_grey.png", | ||||||
|  |                 "isDefault": true | ||||||
|  |             } | ||||||
|  |         ], | ||||||
|  |         "Models/items/weapons/katana1alt.fbx": [ | ||||||
|  |             { | ||||||
|  |                 "meshName" : "Cube.001", | ||||||
|  |                 "diffuse" : "/Textures/katana1.png" | ||||||
|  |             } | ||||||
|  |         ], | ||||||
|  |         "Models/tree1.fbx": [ | ||||||
|  |             { | ||||||
|  |                 "meshName" : "Cube.002", | ||||||
|  |                 "diffuse" : "/Textures/Branch.png" | ||||||
|             }, |             }, | ||||||
|         "Models/arcdock5deg1notex.fbx": { |             { | ||||||
|             "Cube": [ |                 "meshName" : "Cylinder", | ||||||
|                 "/Textures/w1.png", |                 "diffuse" : "/Textures/Branch.png" | ||||||
|                 "/Textures/w1.png" |             } | ||||||
|             ] |         ], | ||||||
|  |         "Models/goblin1.fbx" : [ | ||||||
|  |             { | ||||||
|  |                 "meshName" : "makehuman1", | ||||||
|  |                 "diffuse" : "/Textures/GoblinSkin.png", | ||||||
|  |                 "isDefault" : true | ||||||
|             }, |             }, | ||||||
|         "Models/wheat1.fbx": { |             { | ||||||
|             "Cube": [ |                 "meshName" : "high-poly", | ||||||
|                 "/Textures/wheat1.png", |                 "diffuse" : "/Textures/GoblinEyes.png" | ||||||
|                 "/Textures/wheat1.png" |             } | ||||||
|             ] |         ], | ||||||
|  |         "Models/elf1.fbx" : [ | ||||||
|  |             { | ||||||
|  |                 "meshName" : "Torso.001", | ||||||
|  |                 "diffuse" : "/Textures/skin1.png", | ||||||
|  |                 "isDefault" : true | ||||||
|             }, |             }, | ||||||
|         "Models/wheat2.fbx": { |             { | ||||||
|             "Wheat": [ |                 "meshName" : "Eyebrow.R", | ||||||
|                 "/Textures/wheat2.png", |                 "diffuse" : "/Textures/b1.png" | ||||||
|                 "/Textures/wheat2.png" |  | ||||||
|             ] |  | ||||||
|             }, |             }, | ||||||
|         "Models/unitsphere.fbx": { |             { | ||||||
|             "Sphere": [ |                 "meshName" : "Eyebrow.L", | ||||||
|                 "/Textures/transparent_blue.png", |                 "diffuse" : "/Textures/b1.png" | ||||||
|                 "/Textures/transparent_blue.png" |  | ||||||
|             ] |  | ||||||
|             }, |             }, | ||||||
|         "Models/basic/geometry/unitsphere_1.fbx": { |             { | ||||||
|             "Sphere": [ |                 "meshName" : "Eye.R", | ||||||
|                 "/Textures/transparent_red.png", |                 "diffuse" : "/Textures/w1.png" | ||||||
|                 "/Textures/transparent_red.png" |  | ||||||
|             ] |  | ||||||
|             }, |             }, | ||||||
|         "Models/unitsphere_grey.fbx": { |             { | ||||||
|             "Sphere": [ |                 "meshName" : "Eye.L", | ||||||
|                 "/Textures/transparent_grey.png", |                 "diffuse" : "/Textures/w1.png" | ||||||
|                 "/Textures/transparent_grey.png" |  | ||||||
|             ] |  | ||||||
|             }, |             }, | ||||||
|         "Models/katana1alt.fbx": { |             { | ||||||
|             "Cube.001":  [ |                 "meshName" : "Iris.R", | ||||||
|                 "/Textures/katana1.png", |                 "diffuse" : "/Textures/b1.png" | ||||||
|                 "/Textures/katana1.png" |  | ||||||
|             ] |  | ||||||
|             }, |             }, | ||||||
|         "Models/tree1.fbx": { |             { | ||||||
|             "Cube.002":  [ |                 "meshName" : "Iris.L", | ||||||
|                 "/Textures/Branch.png", |                 "diffuse" : "/Textures/b1.png" | ||||||
|                 "/Textures/Branch.png" |             } | ||||||
|         ], |         ], | ||||||
|             "Cylinder":  [ |         "Models/building1.fbx" : [ | ||||||
|                 "/Textures/Branch.png", |             { | ||||||
|                 "/Textures/Branch.png" |                 "meshName" : "Cube.001", | ||||||
|             ] |                 "diffuse" : "/Textures/building_diffuse.png" | ||||||
|  |             } | ||||||
|  |         ], | ||||||
|  |         "Models/basic/geometry/unitcylinder.fbx" : [ | ||||||
|  |             { | ||||||
|  |                 "meshName" : "Cylinder", | ||||||
|  |                 "diffuse" : "/Textures/transparent_blue.png" | ||||||
|  |             } | ||||||
|  |         ], | ||||||
|  |         "Models/basic/geometry/unitplane.fbx" : [ | ||||||
|  |             { | ||||||
|  |                 "meshName" : "Plane", | ||||||
|  |                 "diffuse" : "/Textures/transparent_blue.png" | ||||||
|  |             } | ||||||
|  |         ], | ||||||
|  |         "Models/basic/geometry/unitcube.fbx" : [ | ||||||
|  |             { | ||||||
|  |                 "meshName" : "Cube", | ||||||
|  |                 "diffuse" : "/Textures/transparent_blue.png" | ||||||
|  |             } | ||||||
|  |         ], | ||||||
|  |         "Models/falloak1.fbx" : [ | ||||||
|  |             { | ||||||
|  |                 "meshName" : "Tree", | ||||||
|  |                 "diffuse" : "/Textures/transparent_blue.png", | ||||||
|  |                 "isDefault" : true | ||||||
|  |             } | ||||||
|  |         ], | ||||||
|  |         "Models/deer1.fbx" : [ | ||||||
|  |             { | ||||||
|  |                 "meshName" : "Cube.001", | ||||||
|  |                 "diffuse" : "/Textures/transparent_blue.png", | ||||||
|  |                 "isDefault" : true | ||||||
|  |             } | ||||||
|  |         ], | ||||||
|  |         "Models/bow1.fbx" : [ | ||||||
|  |             { | ||||||
|  |                 "meshName" : "BowMesh", | ||||||
|  |                 "diffuse" : "/Textures/bow1.png", | ||||||
|  |                 "isDefault" : true | ||||||
|  |             } | ||||||
|  |         ], | ||||||
|  |         "Models/arrow1.fbx" : [ | ||||||
|  |             { | ||||||
|  |                 "meshName" : "ArrowMesh", | ||||||
|  |                 "diffuse" : "/Textures/arrow1.png", | ||||||
|  |                 "isDefault" : true | ||||||
|  |             } | ||||||
|  |         ], | ||||||
|  |         "/Models/engine/lockoncrosshair1.fbx" : [ | ||||||
|  |             { | ||||||
|  |                 "meshName" : "Cube", | ||||||
|  |                 "diffuse" : "/Textures/w1.png", | ||||||
|  |                 "isDefault" : true | ||||||
|  |             } | ||||||
|  |         ], | ||||||
|  |         "Models/creatures/person2/clothing/shorts1.fbx" : [ | ||||||
|  |             { | ||||||
|  |                 "meshName" : "ClothingItem", | ||||||
|  |                 "diffuse" : "/Textures/shorts1.png", | ||||||
|  |                 "isDefault" : true | ||||||
|  |             } | ||||||
|  |         ], | ||||||
|  |         "Models/creatures/person2/hair/hairshort1meshed.fbx" : [ | ||||||
|  |             { | ||||||
|  |                 "meshName" : "Hair", | ||||||
|  |                 "diffuse" : "/Textures/b1.png", | ||||||
|  |                 "isDefault" : true | ||||||
|  |             } | ||||||
|  |         ], | ||||||
|  |         "Models/boots1.fbx" : [ | ||||||
|  |             { | ||||||
|  |                 "meshName" : "BootLeft", | ||||||
|  |                 "diffuse" : "/Textures/boots1.png" | ||||||
|             }, |             }, | ||||||
|         "Models/goblin1.fbx" : { |             { | ||||||
|             "makehuman1" : [ |                 "meshName" : "BootRight", | ||||||
|                 "/Textures/GoblinSkin.png", |                 "diffuse" : "/Textures/boots1.png" | ||||||
|                 "/Textures/GoblinSkin.png" |             } | ||||||
|         ], |         ], | ||||||
|             "high-poly" : [ |         "Models/shirt1.fbx" : [ | ||||||
|                 "/Textures/GoblinEyes.png", |             { | ||||||
|                 "/Textures/GoblinEyes.png" |                 "meshName" : "ClothingItem", | ||||||
|             ] |                 "diffuse" : "/Textures/shirt1.png", | ||||||
|  |                 "isDefault" : true | ||||||
|  |             } | ||||||
|  |         ], | ||||||
|  |         "Models/environment/cloudRing.fbx" : [ | ||||||
|  |             { | ||||||
|  |                 "meshName" : "Sphere", | ||||||
|  |                 "diffuse" : "/Textures/cloudRing.png", | ||||||
|  |                 "isDefault" : true | ||||||
|  |             } | ||||||
|  |         ], | ||||||
|  |         "Models/environment/skyboxSphere.fbx" : [ | ||||||
|  |             { | ||||||
|  |                 "meshName" : "Sphere", | ||||||
|  |                 "diffuse" : "/Textures/starrySky.png", | ||||||
|  |                 "isDefault" : true | ||||||
|  |             } | ||||||
|  |         ], | ||||||
|  |         "Models/campfire1.fbx" : [ | ||||||
|  |             { | ||||||
|  |                 "meshName" : "Cylinder", | ||||||
|  |                 "diffuse" : "/Textures/campfire1.png", | ||||||
|  |                 "isDefault" : true | ||||||
|  |             } | ||||||
|  |         ], | ||||||
|  |         "Models/crate2.fbx" : [ | ||||||
|  |             { | ||||||
|  |                 "meshName" : "Cube", | ||||||
|  |                 "diffuse" : "/Textures/woodplanks1.png", | ||||||
|  |                 "isDefault" : true | ||||||
|  |             } | ||||||
|  |         ], | ||||||
|  |         "Models/shrine2.fbx" : [ | ||||||
|  |             { | ||||||
|  |                 "meshName" : "Roof", | ||||||
|  |                 "diffuse" : "/Textures/shrine2Roof.png" | ||||||
|             }, |             }, | ||||||
|         "Models/baseman5.glb" : { |             { | ||||||
|             "Torso.001" : [ |                 "meshName" : "MainWalls", | ||||||
|                 "/Textures/skin1.png", |                 "diffuse" : "/Textures/shrine2MainWalls.png" | ||||||
|                 "/Textures/skin1.png" |  | ||||||
|             ], |  | ||||||
|             "Hand.L" : [ |  | ||||||
|                 "/Textures/skin1.png", |  | ||||||
|                 "/Textures/skin1.png" |  | ||||||
|             ], |  | ||||||
|             "Forearm.L" : [ |  | ||||||
|                 "/Textures/skin1.png", |  | ||||||
|                 "/Textures/skin1.png" |  | ||||||
|             ], |  | ||||||
|             "Bicep.L.001" : [ |  | ||||||
|                 "/Textures/skin1.png", |  | ||||||
|                 "/Textures/skin1.png" |  | ||||||
|             ], |  | ||||||
|             "Hand.R" : [ |  | ||||||
|                 "/Textures/skin1.png", |  | ||||||
|                 "/Textures/skin1.png" |  | ||||||
|             ], |  | ||||||
|             "Forearm.R" : [ |  | ||||||
|                 "/Textures/skin1.png", |  | ||||||
|                 "/Textures/skin1.png" |  | ||||||
|             ], |  | ||||||
|             "Bicep.R.001" : [ |  | ||||||
|                 "/Textures/skin1.png", |  | ||||||
|                 "/Textures/skin1.png" |  | ||||||
|             ], |  | ||||||
|             "Foot.L" : [ |  | ||||||
|                 "/Textures/skin1.png", |  | ||||||
|                 "/Textures/skin1.png" |  | ||||||
|             ], |  | ||||||
|             "Foot.R" : [ |  | ||||||
|                 "/Textures/skin1.png", |  | ||||||
|                 "/Textures/skin1.png" |  | ||||||
|             ], |  | ||||||
|             "LowerLeg.L" : [ |  | ||||||
|                 "/Textures/skin1.png", |  | ||||||
|                 "/Textures/skin1.png" |  | ||||||
|             ], |  | ||||||
|             "LowerLeg.R" : [ |  | ||||||
|                 "/Textures/skin1.png", |  | ||||||
|                 "/Textures/skin1.png" |  | ||||||
|             ], |  | ||||||
|             "UpperLeg.L" : [ |  | ||||||
|                 "/Textures/skin1.png", |  | ||||||
|                 "/Textures/skin1.png" |  | ||||||
|             ], |  | ||||||
|             "UpperLeg.R" : [ |  | ||||||
|                 "/Textures/skin1.png", |  | ||||||
|                 "/Textures/skin1.png" |  | ||||||
|             ], |  | ||||||
|             "Shorts" : [ |  | ||||||
|                 "/Textures/skin1.png", |  | ||||||
|                 "/Textures/skin1.png" |  | ||||||
|             ], |  | ||||||
|             "Shoulder.L.001" : [ |  | ||||||
|                 "/Textures/skin1.png", |  | ||||||
|                 "/Textures/skin1.png" |  | ||||||
|             ], |  | ||||||
|             "Shoulder.R.001" : [ |  | ||||||
|                 "/Textures/skin1.png", |  | ||||||
|                 "/Textures/skin1.png" |  | ||||||
|             ], |  | ||||||
|             "Neck.001" : [ |  | ||||||
|                 "/Textures/skin1.png", |  | ||||||
|                 "/Textures/skin1.png" |  | ||||||
|             ], |  | ||||||
|             "Head" : [ |  | ||||||
|                 "/Textures/skin1.png", |  | ||||||
|                 "/Textures/skin1.png" |  | ||||||
|             ], |  | ||||||
|             "Eyebrow.R" : [ |  | ||||||
|                 "/Textures/b1.png", |  | ||||||
|                 "/Textures/b1.png" |  | ||||||
|             ], |  | ||||||
|             "Eyebrow.L" : [ |  | ||||||
|                 "/Textures/b1.png", |  | ||||||
|                 "/Textures/b1.png" |  | ||||||
|             ], |  | ||||||
|             "Eye.R" : [ |  | ||||||
|                 "/Textures/w1.png", |  | ||||||
|                 "/Textures/w1.png" |  | ||||||
|             ], |  | ||||||
|             "Eye.L" : [ |  | ||||||
|                 "/Textures/w1.png", |  | ||||||
|                 "/Textures/w1.png" |  | ||||||
|             ], |  | ||||||
|             "Ear.R" : [ |  | ||||||
|                 "/Textures/skin1.png", |  | ||||||
|                 "/Textures/skin1.png" |  | ||||||
|             ], |  | ||||||
|             "Ear.L" : [ |  | ||||||
|                 "/Textures/skin1.png", |  | ||||||
|                 "/Textures/skin1.png" |  | ||||||
|             ], |  | ||||||
|             "Iris.R" : [ |  | ||||||
|                 "/Textures/b1.png", |  | ||||||
|                 "/Textures/b1.png" |  | ||||||
|             ], |  | ||||||
|             "Iris.L" : [ |  | ||||||
|                 "/Textures/b1.png", |  | ||||||
|                 "/Textures/b1.png" |  | ||||||
|             ] |  | ||||||
|             }, |             }, | ||||||
|         "Models/elf1.fbx" : { |             { | ||||||
|             "Torso" : [ |                 "meshName" : "Feet", | ||||||
|                 "/Textures/skin1.png", |                 "diffuse" : "/Textures/shrine2Feet.png" | ||||||
|                 "/Textures/skin1.png" |  | ||||||
|             ], |  | ||||||
|             "Hand.L" : [ |  | ||||||
|                 "/Textures/skin1.png", |  | ||||||
|                 "/Textures/skin1.png" |  | ||||||
|             ], |  | ||||||
|             "Forearm.L" : [ |  | ||||||
|                 "/Textures/skin1.png", |  | ||||||
|                 "/Textures/skin1.png" |  | ||||||
|             ], |  | ||||||
|             "Bicep.L" : [ |  | ||||||
|                 "/Textures/skin1.png", |  | ||||||
|                 "/Textures/skin1.png" |  | ||||||
|             ], |  | ||||||
|             "Hand.R" : [ |  | ||||||
|                 "/Textures/skin1.png", |  | ||||||
|                 "/Textures/skin1.png" |  | ||||||
|             ], |  | ||||||
|             "Forearm.R" : [ |  | ||||||
|                 "/Textures/skin1.png", |  | ||||||
|                 "/Textures/skin1.png" |  | ||||||
|             ], |  | ||||||
|             "Bicep.R" : [ |  | ||||||
|                 "/Textures/skin1.png", |  | ||||||
|                 "/Textures/skin1.png" |  | ||||||
|             ], |  | ||||||
|             "Foot.L" : [ |  | ||||||
|                 "/Textures/skin1.png", |  | ||||||
|                 "/Textures/skin1.png" |  | ||||||
|             ], |  | ||||||
|             "Foot.R" : [ |  | ||||||
|                 "/Textures/skin1.png", |  | ||||||
|                 "/Textures/skin1.png" |  | ||||||
|             ], |  | ||||||
|             "LowerLeg.L" : [ |  | ||||||
|                 "/Textures/skin1.png", |  | ||||||
|                 "/Textures/skin1.png" |  | ||||||
|             ], |  | ||||||
|             "LowerLeg.R" : [ |  | ||||||
|                 "/Textures/skin1.png", |  | ||||||
|                 "/Textures/skin1.png" |  | ||||||
|             ], |  | ||||||
|             "UpperLeg.L" : [ |  | ||||||
|                 "/Textures/skin1.png", |  | ||||||
|                 "/Textures/skin1.png" |  | ||||||
|             ], |  | ||||||
|             "UpperLeg.R" : [ |  | ||||||
|                 "/Textures/skin1.png", |  | ||||||
|                 "/Textures/skin1.png" |  | ||||||
|             ], |  | ||||||
|             "Shorts" : [ |  | ||||||
|                 "/Textures/skin1.png", |  | ||||||
|                 "/Textures/skin1.png" |  | ||||||
|             ], |  | ||||||
|             "Shoulder.L" : [ |  | ||||||
|                 "/Textures/skin1.png", |  | ||||||
|                 "/Textures/skin1.png" |  | ||||||
|             ], |  | ||||||
|             "Shoulder.R" : [ |  | ||||||
|                 "/Textures/skin1.png", |  | ||||||
|                 "/Textures/skin1.png" |  | ||||||
|             ], |  | ||||||
|             "Neck" : [ |  | ||||||
|                 "/Textures/skin1.png", |  | ||||||
|                 "/Textures/skin1.png" |  | ||||||
|             ], |  | ||||||
|             "Head" : [ |  | ||||||
|                 "/Textures/skin1.png", |  | ||||||
|                 "/Textures/skin1.png" |  | ||||||
|             ], |  | ||||||
|             "Eyebrow.R" : [ |  | ||||||
|                 "/Textures/b1.png", |  | ||||||
|                 "/Textures/b1.png" |  | ||||||
|             ], |  | ||||||
|             "Eyebrow.L" : [ |  | ||||||
|                 "/Textures/b1.png", |  | ||||||
|                 "/Textures/b1.png" |  | ||||||
|             ], |  | ||||||
|             "Eye.R" : [ |  | ||||||
|                 "/Textures/w1.png", |  | ||||||
|                 "/Textures/w1.png" |  | ||||||
|             ], |  | ||||||
|             "Eye.L" : [ |  | ||||||
|                 "/Textures/w1.png", |  | ||||||
|                 "/Textures/w1.png" |  | ||||||
|             ], |  | ||||||
|             "Iris.R" : [ |  | ||||||
|                 "/Textures/b1.png", |  | ||||||
|                 "/Textures/b1.png" |  | ||||||
|             ], |  | ||||||
|             "Iris.L" : [ |  | ||||||
|                 "/Textures/b1.png", |  | ||||||
|                 "/Textures/b1.png" |  | ||||||
|             ] |  | ||||||
|             }, |             }, | ||||||
|         "Models/building1.fbx" : { |             { | ||||||
|             "Cube.001" : [ |                 "meshName" : "Platform", | ||||||
|                 "/Textures/building_diffuse.png", |                 "diffuse" : "/Textures/shrine2Platform.png" | ||||||
|                 "/Textures/building_diffuse.png" |  | ||||||
|             ] |  | ||||||
|             }, |             }, | ||||||
|         "Models/unitcylinder.fbx" : { |             { | ||||||
|             "Cylinder" : [ |                 "meshName" : "SupportBeams", | ||||||
|                 "/Textures/transparent_blue.png", |                 "diffuse" : "/Textures/shrine2SupportBeams.png" | ||||||
|                 "/Textures/transparent_blue.png" |  | ||||||
|             ] |  | ||||||
|             }, |             }, | ||||||
|         "Models/unitplane.fbx" : { |             { | ||||||
|             "Plane" : [ |                 "meshName" : "Stairs", | ||||||
|                 "/Textures/transparent_blue.png", |                 "diffuse" : "/Textures/shrine2Stairs.png" | ||||||
|                 "/Textures/transparent_blue.png" |             } | ||||||
|             ] |  | ||||||
|         }, |  | ||||||
|         "Models/unitcube.fbx" : { |  | ||||||
|             "Cube" : [ |  | ||||||
|                 "/Textures/transparent_blue.png", |  | ||||||
|                 "/Textures/transparent_blue.png" |  | ||||||
|             ] |  | ||||||
|         }, |  | ||||||
|         "Models/falloak1.fbx" : { |  | ||||||
|             "Tree" : [ |  | ||||||
|                 "/Textures/falloak1.png", |  | ||||||
|                 "/Textures/falloak1.png" |  | ||||||
|         ], |         ], | ||||||
|             "Cube.003" : [ |         "Models/foliage/foliageBlockTemplate1Test1.fbx" : [ | ||||||
|                 "/Textures/falloak1.png", |             { | ||||||
|                 "/Textures/falloak1.png" |                 "meshName" : "Plane", | ||||||
|             ] |                 "diffuse" : "/Textures/leaf3layer1.png", | ||||||
|         }, |                 "isDefault" : true | ||||||
|         "Models/deer1.fbx" : { |             } | ||||||
|             "Cube.001" : [ |  | ||||||
|                 "/Textures/deer1.png", |  | ||||||
|                 "/Textures/deer1.png" |  | ||||||
|             ] |  | ||||||
|         }, |  | ||||||
|         "Models/bow1.fbx" : { |  | ||||||
|             "BowMesh" : [ |  | ||||||
|                 "/Textures/bow1.png", |  | ||||||
|                 "/Textures/bow1.png" |  | ||||||
|             ] |  | ||||||
|         }, |  | ||||||
|         "Models/arrow1.fbx" : { |  | ||||||
|             "ArrowMesh" : [ |  | ||||||
|                 "/Textures/arrow1.png", |  | ||||||
|                 "/Textures/arrow1.png" |  | ||||||
|             ] |  | ||||||
|         }, |  | ||||||
|         "Models/engine/lockoncrosshair1.fbx" : { |  | ||||||
|             "Cube" : [ |  | ||||||
|                 "/Textures/w1.png", |  | ||||||
|                 "/Textures/w1.png" |  | ||||||
|             ] |  | ||||||
|         }, |  | ||||||
|         "Models/creatures/person2/clothing/shorts1.fbx" : { |  | ||||||
|             "ClothingItem" : [ |  | ||||||
|                 "/Textures/shorts1.png", |  | ||||||
|                 "/Textures/shorts1.png" |  | ||||||
|             ] |  | ||||||
|         }, |  | ||||||
|         "Models/creatures/person2/hair/hairshort1meshed.fbx" : { |  | ||||||
|             "Hair" : [ |  | ||||||
|                 "/Textures/b1.png", |  | ||||||
|                 "/Textures/b1.png" |  | ||||||
|             ] |  | ||||||
|         }, |  | ||||||
|         "Models/boots1.fbx" : { |  | ||||||
|             "BootLeft" : [ |  | ||||||
|                 "/Textures/boots1.png", |  | ||||||
|                 "/Textures/boots1.png" |  | ||||||
|         ], |         ], | ||||||
|             "BootRight" : [ |         "Models/proceduralTree2/proceduralTree2.fbx": [ | ||||||
|                 "/Textures/boots1.png", |             { | ||||||
|                 "/Textures/boots1.png" |                 "meshName" : "Trunk", | ||||||
|             ] |                 "diffuse" : "/Textures/proceduralTree2/Trunk.png", | ||||||
|         }, |                 "isDefault" : true | ||||||
|         "Models/shirt1.fbx" : { |             } | ||||||
|             "ClothingItem" : [ |  | ||||||
|                 "/Textures/shirt1.png", |  | ||||||
|                 "/Textures/shirt1.png" |  | ||||||
|             ] |  | ||||||
|         }, |  | ||||||
|         "Models/environment/cloudRing.fbx" : { |  | ||||||
|             "Sphere" : [ |  | ||||||
|                 "/Textures/cloudRing.png", |  | ||||||
|                 "/Textures/cloudRing.png" |  | ||||||
|             ] |  | ||||||
|         }, |  | ||||||
|         "Models/environment/skyboxSphere.fbx" : { |  | ||||||
|             "Sphere" : [ |  | ||||||
|                 "/Textures/starrySky.png", |  | ||||||
|                 "/Textures/starrySky.png" |  | ||||||
|             ] |  | ||||||
|         }, |  | ||||||
|         "Models/campfire1.fbx" : { |  | ||||||
|             "Cylinder" : [ |  | ||||||
|                 "/Textures/campfire1.png", |  | ||||||
|                 "/Textures/campfire1.png" |  | ||||||
|             ] |  | ||||||
|         }, |  | ||||||
|         "Models/crate2.fbx" : { |  | ||||||
|             "Cube" : [ |  | ||||||
|                 "/Textures/woodplanks1.png", |  | ||||||
|                 "/Textures/woodplanks1.png" |  | ||||||
|             ] |  | ||||||
|         }, |  | ||||||
|         "Models/shrine2.fbx" : { |  | ||||||
|             "Roof" : [ |  | ||||||
|                 "/Textures/shrine2Roof.png", |  | ||||||
|                 "/Textures/shrine2Roof.png" |  | ||||||
|         ], |         ], | ||||||
|             "MainWalls" : [ |         "Models/proceduralTree2/proceduralTree2v2.fbx": [ | ||||||
|                 "/Textures/shrine2MainWalls.png", |             { | ||||||
|                 "/Textures/shrine2MainWalls.png" |                 "meshName" : "Trunk", | ||||||
|  |                 "diffuse" : "/Textures/foliage/proceduralTree2/Trunk.png", | ||||||
|  |                 "isDefault" : true | ||||||
|  |             } | ||||||
|         ], |         ], | ||||||
|             "Feet" : [ |         "Models/foliage/grass2.fbx": [ | ||||||
|                 "/Textures/shrine2Feet.png", |             { | ||||||
|                 "/Textures/shrine2Feet.png" |                 "meshName": "Plane", | ||||||
|             ], |                 "diffuse": "/Textures/b1.png" | ||||||
|             "Platform" : [ |             } | ||||||
|                 "/Textures/shrine2Platform.png", |  | ||||||
|                 "/Textures/shrine2Platform.png" |  | ||||||
|             ], |  | ||||||
|             "SupportBeams" : [ |  | ||||||
|                 "/Textures/shrine2SupportBeams.png", |  | ||||||
|                 "/Textures/shrine2SupportBeams.png" |  | ||||||
|             ], |  | ||||||
|             "Stairs" : [ |  | ||||||
|                 "/Textures/shrine2Stairs.png", |  | ||||||
|                 "/Textures/shrine2Stairs.png" |  | ||||||
|             ] |  | ||||||
|         }, |  | ||||||
|         "Models/floatingisland1.fbx" : { |  | ||||||
|             "Cube" : [ |  | ||||||
|                 "/Textures/floatingisland1.png", |  | ||||||
|                 "/Textures/floatingisland1.png" |  | ||||||
|             ] |  | ||||||
|         }, |  | ||||||
|         "Models/testvalley.fbx" : { |  | ||||||
|             "Plane.001" : [ |  | ||||||
|                 "/Textures/grass1.png", |  | ||||||
|                 "/Textures/grass1.png" |  | ||||||
|             ] |  | ||||||
|         }, |  | ||||||
|         "Models/f15.fbx" : { |  | ||||||
|             "Cube.001" : [ |  | ||||||
|                 "/Textures/f15.png", |  | ||||||
|                 "/Textures/f15.png" |  | ||||||
|             ] |  | ||||||
|         }, |  | ||||||
|         "Models/skyscraper1.fbx" : { |  | ||||||
|             "Cube.001" : [ |  | ||||||
|                 "Textures/skyscraper1.png", |  | ||||||
|                 "Textures/skyscraper1.png" |  | ||||||
|             ] |  | ||||||
|         }, |  | ||||||
|         "Models/foliage/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" |  | ||||||
|             ] |  | ||||||
|         }, |  | ||||||
|         "Models/proceduralTree2/proceduralTree2.fbx": { |  | ||||||
|             "Trunk" : [ |  | ||||||
|                 "Models/proceduralTree2/Trunk.png", |  | ||||||
|                 "Models/proceduralTree2/Trunk.png" |  | ||||||
|             ] |  | ||||||
|         }, |  | ||||||
|         "Models/proceduralTree2/proceduralTree2v2.fbx": { |  | ||||||
|             "Trunk" : [ |  | ||||||
|                 "Models/foliage/proceduralTree2/Trunk.png", |  | ||||||
|                 "Models/foliage/proceduralTree2/Trunk.png" |  | ||||||
|         ] |         ] | ||||||
|     } |     } | ||||||
| } | } | ||||||
| } |  | ||||||
| @ -13,3 +13,11 @@ | |||||||
|   fix items falling through floor |   fix items falling through floor | ||||||
|   fix jump tree not applying force while movement tree is active |   fix jump tree not applying force while movement tree is active | ||||||
| 
 | 
 | ||||||
|  | 
 | ||||||
|  | Things that feel bad: | ||||||
|  |   No audio | ||||||
|  |   Can't instantly start/stop blocking | ||||||
|  |   Short movement bursts feel jittery | ||||||
|  |   Jumping client side only | ||||||
|  |   First person blocking angle doesn't line up | ||||||
|  |   Attack animation feels slow | ||||||
|  | |||||||
| @ -484,6 +484,7 @@ Refactor network protocols to enforce async/sync split | |||||||
| 
 | 
 | ||||||
| (07/30/2024) | (07/30/2024) | ||||||
| Fix depth texture for shadow rendering | Fix depth texture for shadow rendering | ||||||
|  | Fix eyebrow weights on human model | ||||||
| 
 | 
 | ||||||
| # TODO | # TODO | ||||||
| 
 | 
 | ||||||
| @ -538,6 +539,8 @@ Debug | |||||||
| 
 | 
 | ||||||
| Would be nice to be able to cut clients that stream their logs to my server  | Would be nice to be able to cut clients that stream their logs to my server  | ||||||
| 
 | 
 | ||||||
|  | Refactor render flags | ||||||
|  | 
 | ||||||
| Data Cleanup | Data Cleanup | ||||||
|  - Clean up creatures |  - Clean up creatures | ||||||
|   - Remove unused ones |   - Remove unused ones | ||||||
|  | |||||||
| @ -406,7 +406,7 @@ public class Globals { | |||||||
|         //timekeeper |         //timekeeper | ||||||
|         timekeeper = new Timekeeper(); |         timekeeper = new Timekeeper(); | ||||||
|         //load in default texture map |         //load in default texture map | ||||||
|         textureMapDefault = FileUtils.loadObjectFromAssetPath("Textures/default_texture_map.json", TextureMap.class); |         textureMapDefault = TextureMap.construct("Textures/default_texture_map.json"); | ||||||
|         //load model pretransforms |         //load model pretransforms | ||||||
|         modelPretransforms = FileUtils.loadObjectFromAssetPath("Models/modelPretransforms.json", ModelPretransforms.class); |         modelPretransforms = FileUtils.loadObjectFromAssetPath("Models/modelPretransforms.json", ModelPretransforms.class); | ||||||
|         modelPretransforms.init(); |         modelPretransforms.init(); | ||||||
|  | |||||||
| @ -14,8 +14,11 @@ import electrosphere.renderer.model.Mesh; | |||||||
| import electrosphere.renderer.model.Model; | import electrosphere.renderer.model.Model; | ||||||
| import electrosphere.renderer.shader.ShaderProgram; | import electrosphere.renderer.shader.ShaderProgram; | ||||||
| import electrosphere.renderer.texture.Texture; | import electrosphere.renderer.texture.Texture; | ||||||
|  | import electrosphere.renderer.texture.TextureMap; | ||||||
| import electrosphere.server.poseactor.PoseModel; | import electrosphere.server.poseactor.PoseModel; | ||||||
|  | import electrosphere.util.FileUtils; | ||||||
| 
 | 
 | ||||||
|  | import java.io.File; | ||||||
| import java.util.LinkedList; | import java.util.LinkedList; | ||||||
| import java.util.List; | import java.util.List; | ||||||
| import java.util.Map; | import java.util.Map; | ||||||
| @ -77,8 +80,12 @@ public class AssetManager { | |||||||
|         for(String currentPath : modelsInQueue){ |         for(String currentPath : modelsInQueue){ | ||||||
|             modelsInQueue.remove(currentPath); |             modelsInQueue.remove(currentPath); | ||||||
|             AIScene aiScene = ModelLoader.loadAIScene(currentPath); |             AIScene aiScene = ModelLoader.loadAIScene(currentPath); | ||||||
|  |             TextureMap textureMap = null; | ||||||
|  |             if(getLocalTextureMapPath(currentPath) != null){ | ||||||
|  |                 textureMap = TextureMap.construct(getLocalTextureMapPath(currentPath)); | ||||||
|  |             } | ||||||
|             if(aiScene != null){ |             if(aiScene != null){ | ||||||
|                 modelsLoadedIntoMemory.put(currentPath, ModelLoader.createModelFromAiScene(aiScene,currentPath)); |                 modelsLoadedIntoMemory.put(currentPath, ModelLoader.createModelFromAiScene(aiScene,textureMap,currentPath)); | ||||||
|                 for(PhysicsMeshQueueItem physicsMeshQueueItem : physicsMeshesToLoad){ |                 for(PhysicsMeshQueueItem physicsMeshQueueItem : physicsMeshesToLoad){ | ||||||
|                     if(physicsMeshQueueItem.modelPath.contains(currentPath)){ |                     if(physicsMeshQueueItem.modelPath.contains(currentPath)){ | ||||||
|                         //create physics |                         //create physics | ||||||
| @ -303,6 +310,26 @@ public class AssetManager { | |||||||
|         return texturesLoadedIntoMemory.containsKey(path); |         return texturesLoadedIntoMemory.containsKey(path); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     /** | ||||||
|  |      * Gets a local texture map's path from a model's path | ||||||
|  |      * @param modelPath The model's path | ||||||
|  |      */ | ||||||
|  |     private String getLocalTextureMapPath(String modelPath){ | ||||||
|  |         File modelFile = FileUtils.getAssetFile(modelPath); | ||||||
|  |         File containingDirectory = modelFile.getParentFile(); | ||||||
|  |         File[] children = containingDirectory.listFiles(); | ||||||
|  |         if(children != null){ | ||||||
|  |             for(File child : children){ | ||||||
|  |                 if(child.getName().equals("texturemap.json")){ | ||||||
|  |                     String rVal = child.getPath(); | ||||||
|  |                     String fixed = rVal.replace(".\\assets", ""); | ||||||
|  |                     return fixed; | ||||||
|  |                 } | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |         return null; | ||||||
|  |     } | ||||||
|  |      | ||||||
|      |      | ||||||
|      |      | ||||||
|      |      | ||||||
|  | |||||||
| @ -6,12 +6,10 @@ import electrosphere.renderer.model.Material; | |||||||
| import electrosphere.renderer.model.Mesh; | import electrosphere.renderer.model.Mesh; | ||||||
| import electrosphere.renderer.model.Model; | import electrosphere.renderer.model.Model; | ||||||
| import electrosphere.renderer.texture.TextureMap; | import electrosphere.renderer.texture.TextureMap; | ||||||
|  | import electrosphere.renderer.texture.TextureMap.MeshTextureData; | ||||||
| import electrosphere.util.FileUtils; | import electrosphere.util.FileUtils; | ||||||
| 
 | 
 | ||||||
| import java.io.File; | import java.io.File; | ||||||
| import java.util.Iterator; |  | ||||||
| import java.util.List; |  | ||||||
| import java.util.Map; |  | ||||||
| import org.lwjgl.assimp.AIScene; | import org.lwjgl.assimp.AIScene; | ||||||
| import static org.lwjgl.assimp.Assimp.*; | import static org.lwjgl.assimp.Assimp.*; | ||||||
| 
 | 
 | ||||||
| @ -44,63 +42,95 @@ public class ModelLoader { | |||||||
|         return rVal; |         return rVal; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     public static Model createModelFromAiScene(AIScene scene, String path){ |     public static Model createModelFromAiScene(AIScene scene, TextureMap localTextureMap, String path){ | ||||||
|         Model rVal = null; |         Model rVal = null; | ||||||
|         if(scene != null){ |         if(scene != null){ | ||||||
|             rVal = Model.createModelFromAiscene(path, scene); |             rVal = Model.createModelFromAiscene(path, scene); | ||||||
|             attemptAddTexturesFromPathname(path, rVal); |             attemptAddTexturesFromPathname(path, localTextureMap, rVal); | ||||||
|         } |         } | ||||||
|         return rVal; |         return rVal; | ||||||
|     } |     } | ||||||
|      |      | ||||||
|     //TODO: this logic should exclusively use functions provided in the TextureMap class | 
 | ||||||
|     //this way if we change the underlying structure of the TextureMap it doesn't fuck over this logic |     /** | ||||||
|     static void attemptAddTexturesFromPathname(String path, Model m){ |      * Attempt to assign textures to meshes on this model based on texture map entries | ||||||
|         //first we get the default texture map that's global |      * @param path The path to the model | ||||||
|         TextureMap global_map = Globals.textureMapDefault; |      * @param localTextureMap The local texture map | ||||||
|         LoggerInterface.loggerRenderer.DEBUG(path); |      * @param m The model | ||||||
|         //then we try to get the path of our model from the map |      */ | ||||||
|         Map<String,List<String>> mesh_map = global_map.get_mesh_map(path); |     static void attemptAddTexturesFromPathname(String path, TextureMap localTextureMap, Model m){ | ||||||
|         //if it exists.. |          | ||||||
|         if(mesh_map != null){ |         LoggerInterface.loggerRenderer.DEBUG("Load textures for " + path); | ||||||
|             //iterate through each mesh in the model that was provided as input | 
 | ||||||
|             Iterator<Mesh> mesh_iterator = m.getMeshes().iterator(); |         if(Globals.textureMapDefault.containsModel(path)){ | ||||||
|             while(mesh_iterator.hasNext()){ |             // | ||||||
|                 Mesh current_mesh = mesh_iterator.next(); |             //load from global map | ||||||
|                 LoggerInterface.loggerRenderer.DEBUG(current_mesh.getMeshName()); |             // | ||||||
|                 //if the current iteration is contained within the mesh map we procured from above |             MeshTextureData defaultMeshData = Globals.textureMapDefault.getDefaultMeshTextures(path); | ||||||
|                 if(mesh_map.containsKey(current_mesh.getMeshName())){ |             for(Mesh mesh : m.getMeshes()){ | ||||||
|                     //we create a new material, check if the diffuse or specular is not null, |                 MeshTextureData meshTextureData = Globals.textureMapDefault.getMeshTextures(path, mesh.getMeshName()); | ||||||
|                     //and if they aren't we add that path as a new texture of respective type to the material |                 if(meshTextureData != null){ | ||||||
|                     Material final_material = new Material(); |                     setMaterial(mesh,meshTextureData); | ||||||
|                     List<String> texture_path_list = mesh_map.get(current_mesh.getMeshName()); |                 } else if(defaultMeshData != null){ | ||||||
|                     String diffuse_path = TextureMap.get_diffuse_path(texture_path_list); |                     setMaterial(mesh,defaultMeshData); | ||||||
|                     LoggerInterface.loggerRenderer.DEBUG(current_mesh.getMeshName() + "->" + diffuse_path); |  | ||||||
|                     if(diffuse_path != null){ |  | ||||||
|                         LoggerInterface.loggerRenderer.DEBUG(diffuse_path); |  | ||||||
| //                        Texture diffuse = new Texture(diffuse_path); |  | ||||||
|                         Globals.assetManager.addTexturePathtoQueue(diffuse_path); |  | ||||||
|                         final_material.set_diffuse(diffuse_path); |  | ||||||
|                         LoggerInterface.loggerRenderer.DEBUG(diffuse_path); |  | ||||||
|                 } else { |                 } else { | ||||||
|                         final_material.set_diffuse(Globals.textureDiffuseDefault); |                     LoggerInterface.loggerRenderer.WARNING("Model " + path + " does not have texture data defined for \"" + mesh.getMeshName() + "\""); | ||||||
|                 } |                 } | ||||||
|                     String specular_path = TextureMap.get_specular_path(texture_path_list); |             } | ||||||
|                     if(specular_path != null){ |         } else if(localTextureMap != null && localTextureMap.containsModel(path)) { | ||||||
| //                        Texture specular = new Texture(specular_path); |             // | ||||||
|                         Globals.assetManager.addTexturePathtoQueue(specular_path); |             //load from local folder for model | ||||||
|                         final_material.set_specular(specular_path); |             // | ||||||
|                         LoggerInterface.loggerRenderer.DEBUG(specular_path); |             MeshTextureData defaultMeshData = localTextureMap.getDefaultMeshTextures(path); | ||||||
|  |             for(Mesh mesh : m.getMeshes()){ | ||||||
|  |                 MeshTextureData meshTextureData = localTextureMap.getMeshTextures(path, mesh.getMeshName()); | ||||||
|  |                 if(meshTextureData != null){ | ||||||
|  |                     setMaterial(mesh,meshTextureData); | ||||||
|  |                 } else if(defaultMeshData != null){ | ||||||
|  |                     setMaterial(mesh,defaultMeshData); | ||||||
|                 } else { |                 } else { | ||||||
|                         final_material.set_specular(Globals.textureSpecularDefault); |                     LoggerInterface.loggerRenderer.WARNING("Model " + path + " does not have texture data defined for \"" + mesh.getMeshName() + "\""); | ||||||
|  |                 } | ||||||
|  |             } | ||||||
|  |         } else { | ||||||
|  |             LoggerInterface.loggerRenderer.WARNING("Trying to get textures for model that doesn't have local or global texture map entries! " + path); | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * Sets the material for the mesh | ||||||
|  |      * @param mesh The mesh | ||||||
|  |      * @param meshTextureData The texture data for the mesh | ||||||
|  |      */ | ||||||
|  |     private static void setMaterial(Mesh mesh, MeshTextureData meshTextureData){ | ||||||
|  |         Material finalMat = new Material(); | ||||||
|  | 
 | ||||||
|  |         //set diffuse | ||||||
|  |         String diffusePath = meshTextureData.getDiffuse(); | ||||||
|  |         LoggerInterface.loggerRenderer.DEBUG(mesh.getMeshName() + "->" + diffusePath); | ||||||
|  |         if(diffusePath != null){ | ||||||
|  |             LoggerInterface.loggerRenderer.DEBUG(diffusePath); | ||||||
|  | //                        Texture diffuse = new Texture(diffuse_path); | ||||||
|  |             Globals.assetManager.addTexturePathtoQueue(diffusePath); | ||||||
|  |             finalMat.set_diffuse(diffusePath); | ||||||
|  |             LoggerInterface.loggerRenderer.DEBUG(diffusePath); | ||||||
|  |         } else { | ||||||
|  |             finalMat.set_diffuse(Globals.textureDiffuseDefault); | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         //set specular | ||||||
|  |         String specularPath = meshTextureData.getSpecular(); | ||||||
|  |         if(specularPath != null){ | ||||||
|  | //                        Texture specular = new Texture(specular_path); | ||||||
|  |             Globals.assetManager.addTexturePathtoQueue(specularPath); | ||||||
|  |             finalMat.set_specular(specularPath); | ||||||
|  |             LoggerInterface.loggerRenderer.DEBUG(specularPath); | ||||||
|  |         } else { | ||||||
|  |             finalMat.set_specular(Globals.textureSpecularDefault); | ||||||
|         } |         } | ||||||
|         //once we've either added default textures or actual textures, |         //once we've either added default textures or actual textures, | ||||||
|         //set the current mesh's material to this new one |         //set the current mesh's material to this new one | ||||||
|                     current_mesh.setMaterial(final_material); |         mesh.setMaterial(finalMat); | ||||||
|                 } else { |  | ||||||
|                     LoggerInterface.loggerRenderer.WARNING("Failed to load texture for node " + current_mesh.getMeshName() + " of model " + path); |  | ||||||
|                 } |  | ||||||
|             } |  | ||||||
|         } |  | ||||||
|     } |     } | ||||||
|  | 
 | ||||||
| } | } | ||||||
|  | |||||||
| @ -83,16 +83,20 @@ public class Material { | |||||||
|     public void apply_material(OpenGLState openGLState){ |     public void apply_material(OpenGLState openGLState){ | ||||||
|         //Controls whether the texturePointer should be resolved by looking up the diffuse in asset manager or using the texture pointer already set in this material |         //Controls whether the texturePointer should be resolved by looking up the diffuse in asset manager or using the texture pointer already set in this material | ||||||
|         if(usesFetch){ |         if(usesFetch){ | ||||||
|  |             if(diffuse != null){ | ||||||
|                 Texture diffuseTexture = Globals.assetManager.fetchTexture(diffuse); |                 Texture diffuseTexture = Globals.assetManager.fetchTexture(diffuse); | ||||||
|                 if(diffuseTexture != null){ |                 if(diffuseTexture != null){ | ||||||
|                     diffuseTexture.bind(openGLState,0); |                     diffuseTexture.bind(openGLState,0); | ||||||
|                     openGLState.getActiveShader().setUniform(openGLState, "material.diffuse", 0); |                     openGLState.getActiveShader().setUniform(openGLState, "material.diffuse", 0); | ||||||
|                 } |                 } | ||||||
|  |             } | ||||||
|  |             if(specular != null){ | ||||||
|                 Texture specularTexture = Globals.assetManager.fetchTexture(specular); |                 Texture specularTexture = Globals.assetManager.fetchTexture(specular); | ||||||
|                 if(specularTexture != null){ |                 if(specularTexture != null){ | ||||||
|                     specularTexture.bind(openGLState,1); |                     specularTexture.bind(openGLState,1); | ||||||
|                     openGLState.getActiveShader().setUniform(openGLState, "material.specular", 1); |                     openGLState.getActiveShader().setUniform(openGLState, "material.specular", 1); | ||||||
|                 } |                 } | ||||||
|  |             } | ||||||
|         } else { |         } else { | ||||||
|             openGLState.glBindTextureUnit(GL_TEXTURE0, texturePointer, GL_TEXTURE_2D); |             openGLState.glBindTextureUnit(GL_TEXTURE0, texturePointer, GL_TEXTURE_2D); | ||||||
|         } |         } | ||||||
|  | |||||||
| @ -774,7 +774,7 @@ public class ShaderProgram { | |||||||
|     public void setUniform(OpenGLState openGLState, String uniformName, Object value){ |     public void setUniform(OpenGLState openGLState, String uniformName, Object value){ | ||||||
|         int uniformLocation = glGetUniformLocation(this.getShaderId(), uniformName); |         int uniformLocation = glGetUniformLocation(this.getShaderId(), uniformName); | ||||||
|         if(uniformLocation == INVALID_UNIFORM_NAME){ |         if(uniformLocation == INVALID_UNIFORM_NAME){ | ||||||
|             LoggerInterface.loggerRenderer.INFO("Searched for uniform in a shader that does not contain it. Uniform name: \"" + uniformName + "\""); |             LoggerInterface.loggerRenderer.DEBUG_LOOP("Searched for uniform in a shader that does not contain it. Uniform name: \"" + uniformName + "\""); | ||||||
|         } else { |         } else { | ||||||
|             setUniform(uniformLocation, value); |             setUniform(uniformLocation, value); | ||||||
|         } |         } | ||||||
|  | |||||||
| @ -1,64 +1,219 @@ | |||||||
| package electrosphere.renderer.texture; | package electrosphere.renderer.texture; | ||||||
| 
 | 
 | ||||||
| import java.util.ArrayList; | import java.awt.IllegalComponentStateException; | ||||||
| import java.util.HashMap; | import java.util.HashMap; | ||||||
| import java.util.List; | import java.util.List; | ||||||
| import java.util.Map; | import java.util.Map; | ||||||
|  | import java.util.Set; | ||||||
|  | 
 | ||||||
|  | import electrosphere.logger.LoggerInterface; | ||||||
|  | import electrosphere.util.FileUtils; | ||||||
| 
 | 
 | ||||||
| /** | /** | ||||||
|  * A map of textures |  * A map of textures | ||||||
|  */ |  */ | ||||||
| public class TextureMap { | public class TextureMap { | ||||||
|     //The convention is |     /** | ||||||
|     //Map of strings (the name of a model) to a model |      * The map of modelPath -> list of texture map entries | ||||||
|     //each model is a map of a string (the name of a mesh) to a list which contains |      */ | ||||||
|     //First the model's diffuse, then the model's specular |     Map<String,ModelTextureData> textureMap = new HashMap<String,ModelTextureData>(); | ||||||
|     //always in that order |  | ||||||
|     //if either the diffuse or the specular isn't included then it should |  | ||||||
|     //instead contain and empty string - "" |  | ||||||
|     //this convention must be followed |  | ||||||
|     Map<String,Map<String,List<String>>> texture_map = new HashMap<String,Map<String,List<String>>>(); |  | ||||||
| 
 | 
 | ||||||
|     public Map<String,List<String>> get_mesh_map(String name){ |     /** | ||||||
|         return texture_map.get(name); |      * Reads a texture map from a given path | ||||||
|     } |      * @param rawMapPath The path | ||||||
|      |      * @return The texture map | ||||||
|     public static List<String> get_mesh_textures(Map<String,List<String>> input, String name){ |      */ | ||||||
|         if(input == null){ |     public static TextureMap construct(String rawMapPath){ | ||||||
|             //TODO: Add big fuckin' error here |         TextureMapRaw rawData = FileUtils.loadObjectFromAssetPath(rawMapPath, TextureMapRaw.class); | ||||||
|  |         if(rawData == null){ | ||||||
|             return null; |             return null; | ||||||
|         } |         } | ||||||
|         return input.get(name); |         return TextureMap.construct(rawData); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     //for the lazy |     /** | ||||||
|     public static String get_diffuse_path(List<String> input){ |      * Constructs a texture map from raw data | ||||||
|         if(input == null || input.size() < 2){ |      * @param rawData The raw data | ||||||
|             //TODO: Add big fuckin' error here |      * @return The texture map | ||||||
|  |      */ | ||||||
|  |     private static TextureMap construct(TextureMapRaw rawData){ | ||||||
|  |         TextureMap rVal = new TextureMap(); | ||||||
|  |         Map<String,List<MeshTextureData>> rawMap = rawData.getTextureMap(); | ||||||
|  |         Set<String> modelPaths = rawMap.keySet(); | ||||||
|  |         for(String modelPath : modelPaths){ | ||||||
|  |             ModelTextureData modelTextureData = new ModelTextureData(modelPath, rawMap.get(modelPath)); | ||||||
|  |             rVal.textureMap.put(modelPath,modelTextureData); | ||||||
|  |         } | ||||||
|  |         return rVal; | ||||||
|  |     } | ||||||
|  |      | ||||||
|  |     /** | ||||||
|  |      * Gets the texture map entry for a mesh on a given model | ||||||
|  |      * @param modelPath The model's path | ||||||
|  |      * @param meshName The mesh's name | ||||||
|  |      * @return The texture map's entry if it exists, null otherwise | ||||||
|  |      */ | ||||||
|  |     public MeshTextureData getMeshTextures(String modelPath, String meshName){ | ||||||
|  |         ModelTextureData modelTextureData = textureMap.get(modelPath); | ||||||
|  |         if(modelTextureData == null){ | ||||||
|  |             LoggerInterface.loggerRenderer.WARNING("Trying to get texture for model that is not in texture map!"); | ||||||
|             return null; |             return null; | ||||||
|         } |         } | ||||||
|         return input.get(0); |         return modelTextureData.getMeshTextureData(meshName); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     //for the lazy |     /** | ||||||
|     public static String get_specular_path(List<String> input){ |      * Gets the texture map entry for a mesh on a given model | ||||||
|         if(input == null || input.size() < 2){ |      * @param modelPath The model's path | ||||||
|             //TODO: Add big fuckin' error here |      * @return The texture map's entry if it exists, null otherwise | ||||||
|  |      */ | ||||||
|  |     public MeshTextureData getDefaultMeshTextures(String modelPath){ | ||||||
|  |         ModelTextureData modelTextureData = textureMap.get(modelPath); | ||||||
|  |         if(modelTextureData == null){ | ||||||
|  |             LoggerInterface.loggerRenderer.WARNING("Trying to get texture for model that is not in texture map!"); | ||||||
|             return null; |             return null; | ||||||
|         } |         } | ||||||
|         return input.get(1); |         return modelTextureData.getDefaultMeshTextures(); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     public TextureMap(){ |      | ||||||
|         texture_map = new HashMap<String,Map<String,List<String>>>(); | 
 | ||||||
|  |     /** | ||||||
|  |      * Checks if the texture map contains the model | ||||||
|  |      * @param modelPath The model's path | ||||||
|  |      * @return true if the texture map contains the model, false otherwise | ||||||
|  |      */ | ||||||
|  |     public boolean containsModel(String modelPath){ | ||||||
|  |         return textureMap.containsKey(modelPath); | ||||||
|     } |     } | ||||||
|     public void add_model(String model_name){ | 
 | ||||||
|         texture_map.put(model_name, new HashMap<String, List<String>>()); | 
 | ||||||
|     } |     /** | ||||||
|     public void add_mesh_to_model(String model_name, String mesh_name){ |      * Texture data for a given model | ||||||
|         List<String> temp = new ArrayList<String>(); |      */ | ||||||
|         temp.add(""); |     static class ModelTextureData { | ||||||
|         temp.add(""); | 
 | ||||||
|         texture_map.get(model_name).put(mesh_name, temp); |         /** | ||||||
|  |          * The map of mesh name -> texture data | ||||||
|  |          */ | ||||||
|  |         Map<String,MeshTextureData> meshData = new HashMap<String,MeshTextureData>(); | ||||||
|  | 
 | ||||||
|  |         /** | ||||||
|  |          * The default data to apply | ||||||
|  |          */ | ||||||
|  |         MeshTextureData defaultMeshData = null; | ||||||
|  | 
 | ||||||
|  |         /** | ||||||
|  |          * Constructs an object to track texture data for a whole model | ||||||
|  |          * @param rawMeshData The raw mesh texture data | ||||||
|  |          */ | ||||||
|  |         public ModelTextureData(String modelPath, List<MeshTextureData> rawMeshData){ | ||||||
|  |             for(MeshTextureData rawMesh: rawMeshData){ | ||||||
|  |                 meshData.put(rawMesh.getMeshName(),rawMesh); | ||||||
|  |                 if(rawMesh.isDefault && this.defaultMeshData != null){ | ||||||
|  |                     LoggerInterface.loggerEngine.ERROR(new IllegalComponentStateException("Two default meshes are defined in model " + modelPath)); | ||||||
|  |                 } else if(rawMesh.isDefault){ | ||||||
|  |                     this.defaultMeshData = rawMesh; | ||||||
|  |                 } | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         /** | ||||||
|  |          * Gets the texture data for a given mesh | ||||||
|  |          * @param meshName The name of the mesh | ||||||
|  |          * @return The texture data | ||||||
|  |          */ | ||||||
|  |         public MeshTextureData getMeshTextureData(String meshName){ | ||||||
|  |             return meshData.get(meshName); | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         /** | ||||||
|  |          * Gets the default mesh texture data | ||||||
|  |          * @return The default mesh texture data | ||||||
|  |          */ | ||||||
|  |         public MeshTextureData getDefaultMeshTextures(){ | ||||||
|  |             return this.defaultMeshData; | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * Data for a mesh in a given model | ||||||
|  |      */ | ||||||
|  |     public static class MeshTextureData { | ||||||
|  | 
 | ||||||
|  |         /** | ||||||
|  |          * The name of the mesh | ||||||
|  |          */ | ||||||
|  |         String meshName; | ||||||
|  | 
 | ||||||
|  |         /** | ||||||
|  |          * The specular texture's path | ||||||
|  |          */ | ||||||
|  |         String specular; | ||||||
|  | 
 | ||||||
|  |         /** | ||||||
|  |          * The diffuse texture's path | ||||||
|  |          */ | ||||||
|  |         String diffuse; | ||||||
|  | 
 | ||||||
|  |         /** | ||||||
|  |          * If this is true, this entry will be used for all meshes that don't have a defined entry | ||||||
|  |          */ | ||||||
|  |         boolean isDefault; | ||||||
|  | 
 | ||||||
|  |         /** | ||||||
|  |          * Gets the name of the mesh | ||||||
|  |          * @return The name of the mesh | ||||||
|  |          */ | ||||||
|  |         String getMeshName(){ | ||||||
|  |             return meshName; | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         /** | ||||||
|  |          * Gets the specular texture's path | ||||||
|  |          * @return The specular texture's path | ||||||
|  |          */ | ||||||
|  |         public String getSpecular(){ | ||||||
|  |             return specular; | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         /** | ||||||
|  |          * Gets the diffuse texture's path | ||||||
|  |          * @return The diffuse texture's path | ||||||
|  |          */ | ||||||
|  |         public String getDiffuse(){ | ||||||
|  |             return diffuse; | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         /** | ||||||
|  |          * Checks if this is the default entry or not | ||||||
|  |          * @return true if is default, false otherwise | ||||||
|  |          */ | ||||||
|  |         public boolean isDefault(){ | ||||||
|  |             return isDefault; | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * The raw texture map data on disk | ||||||
|  |      */ | ||||||
|  |     static class TextureMapRaw { | ||||||
|  | 
 | ||||||
|  |         /** | ||||||
|  |          * Raw format on disk | ||||||
|  |          */ | ||||||
|  |         Map<String,List<MeshTextureData>> textureMap; | ||||||
|  | 
 | ||||||
|  |         /** | ||||||
|  |          * Gets the raw texture map data | ||||||
|  |          * @return The raw texture map data | ||||||
|  |          */ | ||||||
|  |         public Map<String,List<MeshTextureData>> getTextureMap(){ | ||||||
|  |             return textureMap; | ||||||
|  |         } | ||||||
|  |          | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  | |||||||
| @ -131,20 +131,21 @@ public class Utilities { | |||||||
|      |      | ||||||
|      |      | ||||||
|      |      | ||||||
|  |     @Deprecated | ||||||
|     public static void saveTestTextureMapToLocation(String s){ |     public static void saveTestTextureMapToLocation(String s){ | ||||||
|         TextureMap t = new TextureMap(); |         TextureMap t = new TextureMap(); | ||||||
|         t.add_model("model1"); |         // t.add_model("model1"); | ||||||
|         t.add_mesh_to_model("model1", "mesh1"); |         // t.add_mesh_to_model("model1", "mesh1"); | ||||||
|         t.add_mesh_to_model("model1", "mesh2"); |         // t.add_mesh_to_model("model1", "mesh2"); | ||||||
|         t.add_mesh_to_model("model1", "mesh3"); |         // t.add_mesh_to_model("model1", "mesh3"); | ||||||
|         t.add_model("model2"); |         // t.add_model("model2"); | ||||||
|         t.add_mesh_to_model("model2", "mesh1"); |         // t.add_mesh_to_model("model2", "mesh1"); | ||||||
|         t.add_mesh_to_model("model2", "mesh2"); |         // t.add_mesh_to_model("model2", "mesh2"); | ||||||
|         t.add_model("model3"); |         // t.add_model("model3"); | ||||||
|         t.add_mesh_to_model("model3", "mesh1"); |         // t.add_mesh_to_model("model3", "mesh1"); | ||||||
|         t.add_mesh_to_model("model3", "mesh2"); |         // t.add_mesh_to_model("model3", "mesh2"); | ||||||
|         t.add_mesh_to_model("model3", "mesh3"); |         // t.add_mesh_to_model("model3", "mesh3"); | ||||||
|         t.add_mesh_to_model("model3", "mesh4"); |         // t.add_mesh_to_model("model3", "mesh4"); | ||||||
|         Gson gson = new Gson(); |         Gson gson = new Gson(); | ||||||
|         try { |         try { | ||||||
|             Files.write(new File(s).toPath(), gson.toJson(t).getBytes()); |             Files.write(new File(s).toPath(), gson.toJson(t).getBytes()); | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user