work on model textures
Some checks failed
studiorailgun/Renderer/pipeline/head There was a failure building this commit
Some checks failed
studiorailgun/Renderer/pipeline/head There was a failure building this commit
This commit is contained in:
parent
ba2ebe1c1e
commit
dfc2d7dfc5
@ -34,7 +34,14 @@
|
|||||||
],
|
],
|
||||||
"graphicsTemplate": {
|
"graphicsTemplate": {
|
||||||
"model": {
|
"model": {
|
||||||
"path" : "Models/items/materials/rock2.glb"
|
"path" : "Models/items/materials/rock2.glb",
|
||||||
|
"meshColorMap" : {
|
||||||
|
"Cube" : {
|
||||||
|
"x" : 0.71,
|
||||||
|
"y" : 0.43,
|
||||||
|
"z" : 0.13
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"collidable": {
|
"collidable": {
|
||||||
|
|||||||
@ -20,6 +20,11 @@ in vec4 FragPosLightSpace;
|
|||||||
uniform dvec3 viewPos;
|
uniform dvec3 viewPos;
|
||||||
uniform Material material;
|
uniform Material material;
|
||||||
|
|
||||||
|
/**
|
||||||
|
The color to apply to the model
|
||||||
|
*/
|
||||||
|
uniform vec3 color;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
The output
|
The output
|
||||||
*/
|
*/
|
||||||
|
|||||||
BIN
assets/Textures/items/rock2_256.png
Normal file
BIN
assets/Textures/items/rock2_256.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 108 KiB |
@ -1,10 +1,12 @@
|
|||||||
package electrosphere.entity.types.common;
|
package electrosphere.entity.types.common;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Map.Entry;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.joml.Quaterniond;
|
import org.joml.Quaterniond;
|
||||||
import org.joml.Vector3d;
|
import org.joml.Vector3d;
|
||||||
|
import org.joml.Vector3f;
|
||||||
import org.ode4j.ode.DBody;
|
import org.ode4j.ode.DBody;
|
||||||
|
|
||||||
import electrosphere.client.interact.ClientInteractionEngine;
|
import electrosphere.client.interact.ClientInteractionEngine;
|
||||||
@ -175,6 +177,13 @@ public class CommonEntityUtils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(graphicsTemplate.getModel() != null && graphicsTemplate.getModel().getMeshColorMap() != null){
|
||||||
|
Actor creatureActor = EntityUtils.getActor(entity);
|
||||||
|
Map<String,Vector3f> meshColorMap = graphicsTemplate.getModel().getMeshColorMap();
|
||||||
|
for(Entry<String,Vector3f> entry : meshColorMap.entrySet()){
|
||||||
|
creatureActor.setUniformOnMesh(entry.getKey(), "color", entry.getValue());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Actor creatureActor = EntityUtils.getActor(entity);
|
Actor creatureActor = EntityUtils.getActor(entity);
|
||||||
|
|
||||||
|
|||||||
@ -1,18 +1,10 @@
|
|||||||
package electrosphere.game.data.graphics;
|
package electrosphere.game.data.graphics;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A graphics template for an entity
|
* A graphics template for an entity
|
||||||
*/
|
*/
|
||||||
public class GraphicsTemplate {
|
public class GraphicsTemplate {
|
||||||
|
|
||||||
//a list of shader overrides
|
|
||||||
List<String> shaderOverrideMeshList;
|
|
||||||
//??? TODO: investigate
|
|
||||||
Map<String,ShaderSet> shaderMap;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The procedural model definition
|
* The procedural model definition
|
||||||
*/
|
*/
|
||||||
@ -23,34 +15,34 @@ public class GraphicsTemplate {
|
|||||||
*/
|
*/
|
||||||
NonproceduralModel model;
|
NonproceduralModel model;
|
||||||
|
|
||||||
public List<String> getShaderOverrideMeshList(){
|
/**
|
||||||
return shaderOverrideMeshList;
|
* Gets the procedural model
|
||||||
}
|
* @return The procedural model
|
||||||
|
*/
|
||||||
public Map<String,ShaderSet> getShaderMap(){
|
|
||||||
return shaderMap;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setShaderOverrideMeshList(List<String> shaderOverrideMeshList) {
|
|
||||||
this.shaderOverrideMeshList = shaderOverrideMeshList;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setShaderMap(Map<String, ShaderSet> shaderMap) {
|
|
||||||
this.shaderMap = shaderMap;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ProceduralModel getProceduralModel() {
|
public ProceduralModel getProceduralModel() {
|
||||||
return proceduralModel;
|
return proceduralModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the procedural model
|
||||||
|
* @param proceduralModel The procedural model
|
||||||
|
*/
|
||||||
public void setProceduralModel(ProceduralModel proceduralModel) {
|
public void setProceduralModel(ProceduralModel proceduralModel) {
|
||||||
this.proceduralModel = proceduralModel;
|
this.proceduralModel = proceduralModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the non-procedural model
|
||||||
|
* @return The non-procedural model
|
||||||
|
*/
|
||||||
public NonproceduralModel getModel() {
|
public NonproceduralModel getModel() {
|
||||||
return model;
|
return model;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the non-procedural model
|
||||||
|
* @param model The non-procedural model
|
||||||
|
*/
|
||||||
public void setModel(NonproceduralModel model) {
|
public void setModel(NonproceduralModel model) {
|
||||||
this.model = model;
|
this.model = model;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,6 +2,8 @@ package electrosphere.game.data.graphics;
|
|||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.joml.Vector3f;
|
||||||
|
|
||||||
import electrosphere.game.data.creature.type.IdleData;
|
import electrosphere.game.data.creature.type.IdleData;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -24,6 +26,11 @@ public class NonproceduralModel {
|
|||||||
*/
|
*/
|
||||||
Map<String,Map<String,Object>> uniforms;
|
Map<String,Map<String,Object>> uniforms;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The map of mesh to color to apply to that mesh
|
||||||
|
*/
|
||||||
|
Map<String,Vector3f> meshColorMap;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the path of the model
|
* Gets the path of the model
|
||||||
* @return The path of the model
|
* @return The path of the model
|
||||||
@ -72,6 +79,21 @@ public class NonproceduralModel {
|
|||||||
this.uniforms = uniforms;
|
this.uniforms = uniforms;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the map of mesh to color to apply to that mesh
|
||||||
|
* @return The map of mesh to color to apply to that mesh
|
||||||
|
*/
|
||||||
|
public Map<String,Vector3f> getMeshColorMap() {
|
||||||
|
return meshColorMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the map of mesh to color to apply to that mesh
|
||||||
|
* @param meshColorMap The map of mesh to color to apply to that mesh
|
||||||
|
*/
|
||||||
|
public void setMeshColorMap(Map<String,Vector3f> meshColorMap) {
|
||||||
|
this.meshColorMap = meshColorMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user