work on model textures
Some checks failed
studiorailgun/Renderer/pipeline/head There was a failure building this commit

This commit is contained in:
austin 2025-04-13 18:06:53 -04:00
parent ba2ebe1c1e
commit dfc2d7dfc5
6 changed files with 60 additions and 25 deletions

View File

@ -34,7 +34,14 @@
],
"graphicsTemplate": {
"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": {

View File

@ -20,6 +20,11 @@ in vec4 FragPosLightSpace;
uniform dvec3 viewPos;
uniform Material material;
/**
The color to apply to the model
*/
uniform vec3 color;
/**
The output
*/

Binary file not shown.

After

Width:  |  Height:  |  Size: 108 KiB

View File

@ -1,10 +1,12 @@
package electrosphere.entity.types.common;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import org.joml.Quaterniond;
import org.joml.Vector3d;
import org.joml.Vector3f;
import org.ode4j.ode.DBody;
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);

View File

@ -1,18 +1,10 @@
package electrosphere.game.data.graphics;
import java.util.List;
import java.util.Map;
/**
* A graphics template for an entity
*/
public class GraphicsTemplate {
//a list of shader overrides
List<String> shaderOverrideMeshList;
//??? TODO: investigate
Map<String,ShaderSet> shaderMap;
/**
* The procedural model definition
*/
@ -23,34 +15,34 @@ public class GraphicsTemplate {
*/
NonproceduralModel model;
public List<String> getShaderOverrideMeshList(){
return shaderOverrideMeshList;
}
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;
}
/**
* Gets the procedural model
* @return The procedural model
*/
public ProceduralModel getProceduralModel() {
return proceduralModel;
}
/**
* Gets the procedural model
* @param proceduralModel The procedural model
*/
public void setProceduralModel(ProceduralModel proceduralModel) {
this.proceduralModel = proceduralModel;
}
/**
* Gets the non-procedural model
* @return The non-procedural model
*/
public NonproceduralModel getModel() {
return model;
}
/**
* Sets the non-procedural model
* @param model The non-procedural model
*/
public void setModel(NonproceduralModel model) {
this.model = model;
}

View File

@ -2,6 +2,8 @@ package electrosphere.game.data.graphics;
import java.util.Map;
import org.joml.Vector3f;
import electrosphere.game.data.creature.type.IdleData;
/**
@ -24,6 +26,11 @@ public class NonproceduralModel {
*/
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
* @return The path of the model
@ -72,6 +79,21 @@ public class NonproceduralModel {
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;
}
}