model refresh
This commit is contained in:
parent
76875cb8cb
commit
c03b9b91ea
@ -187,7 +187,7 @@ public class AssetManager {
|
||||
for(MeshShaderOverride shaderOverride : shaderOverrides){
|
||||
Model model = null;
|
||||
if((model = fetchModel(shaderOverride.modelName)) != null){
|
||||
for(Mesh mesh : model.meshes){
|
||||
for(Mesh mesh : model.getMeshes()){
|
||||
if(mesh.getMeshName().equals(shaderOverride.getMeshName())){
|
||||
mesh.setShader(ShaderProgram.loadSpecificShader(shaderOverride.vertPath, shaderOverride.fragPath));
|
||||
}
|
||||
|
||||
@ -144,8 +144,6 @@ public class RenderUtils {
|
||||
|
||||
public static Model createParticleModel(){
|
||||
Model particleModel = new Model();
|
||||
particleModel.meshes = new ArrayList<Mesh>();
|
||||
particleModel.modelMatrix = new Matrix4d();
|
||||
|
||||
|
||||
Mesh particleMesh = new Mesh("particleBillboard");
|
||||
@ -249,7 +247,7 @@ public class RenderUtils {
|
||||
particleMesh.setParent(particleModel);
|
||||
|
||||
|
||||
particleModel.meshes.add(particleMesh);
|
||||
particleModel.getMeshes().add(particleMesh);
|
||||
|
||||
|
||||
return particleModel;
|
||||
@ -258,10 +256,7 @@ public class RenderUtils {
|
||||
|
||||
public static Model createPlaneModel(String vertexShader, String fragmentShader){
|
||||
Model rVal = new Model();
|
||||
|
||||
rVal.meshes = new ArrayList<Mesh>();
|
||||
rVal.modelMatrix = new Matrix4d();
|
||||
|
||||
|
||||
|
||||
Mesh planeMesh = new Mesh("plane");
|
||||
|
||||
@ -365,7 +360,7 @@ public class RenderUtils {
|
||||
planeMesh.setParent(rVal);
|
||||
|
||||
|
||||
rVal.meshes.add(planeMesh);
|
||||
rVal.getMeshes().add(planeMesh);
|
||||
|
||||
|
||||
return rVal;
|
||||
@ -376,7 +371,6 @@ public class RenderUtils {
|
||||
public static Model createBitmapDisplay(){
|
||||
|
||||
Model rVal = new Model();
|
||||
rVal.meshes = new ArrayList<Mesh>();
|
||||
Mesh m = new Mesh(AssetDataStrings.ASSET_STRING_BITMAP_FONT_MESH_NAME);
|
||||
m.generateVAO();
|
||||
//vertices
|
||||
@ -456,10 +450,9 @@ public class RenderUtils {
|
||||
uiMat.set_diffuse("/Textures/Fonts/myfont1-harsher.png");
|
||||
uiMat.set_specular("/Textures/Fonts/myfont1-harsher.png");
|
||||
m.setMaterial(uiMat);
|
||||
rVal.materials = new ArrayList<Material>();
|
||||
rVal.materials.add(uiMat);
|
||||
rVal.getMaterials().add(uiMat);
|
||||
|
||||
rVal.meshes.add(m);
|
||||
rVal.getMeshes().add(m);
|
||||
|
||||
return rVal;
|
||||
}
|
||||
@ -475,7 +468,6 @@ public class RenderUtils {
|
||||
public static Model createBitmapCharacter(){
|
||||
|
||||
Model rVal = new Model();
|
||||
rVal.meshes = new ArrayList<Mesh>();
|
||||
Mesh m = new Mesh(AssetDataStrings.ASSET_STRING_BITMAP_FONT_MESH_NAME);
|
||||
m.generateVAO();
|
||||
//vertices
|
||||
@ -550,7 +542,7 @@ public class RenderUtils {
|
||||
glBindVertexArray(0);
|
||||
m.setParent(rVal);
|
||||
|
||||
rVal.meshes.add(m);
|
||||
rVal.getMeshes().add(m);
|
||||
|
||||
return rVal;
|
||||
}
|
||||
@ -560,7 +552,6 @@ public class RenderUtils {
|
||||
public static Model createInWindowPanel(String vertexShader, String fragmentShader){
|
||||
|
||||
Model rVal = new Model();
|
||||
rVal.meshes = new ArrayList<Mesh>();
|
||||
Mesh m = new Mesh("plane");
|
||||
m.generateVAO();
|
||||
//vertices
|
||||
@ -635,7 +626,7 @@ public class RenderUtils {
|
||||
glBindVertexArray(0);
|
||||
m.setParent(rVal);
|
||||
|
||||
rVal.meshes.add(m);
|
||||
rVal.getMeshes().add(m);
|
||||
|
||||
return rVal;
|
||||
}
|
||||
@ -645,7 +636,6 @@ public class RenderUtils {
|
||||
|
||||
public static Model createTerrainModelPrecomputedShader(float[][] heightfield, float[][] texturemap, ShaderProgram program, int stride){
|
||||
Model rVal = new Model();
|
||||
rVal.meshes = new ArrayList<Mesh>();
|
||||
Mesh m = new Mesh("terrain");
|
||||
int width = heightfield.length;
|
||||
int height = heightfield[0].length;
|
||||
@ -812,7 +802,7 @@ public class RenderUtils {
|
||||
groundMat.set_specular("/Textures/Ground/Dirt1.png");
|
||||
m.setMaterial(groundMat);
|
||||
|
||||
rVal.meshes.add(m);
|
||||
rVal.getMeshes().add(m);
|
||||
return rVal;
|
||||
}
|
||||
|
||||
@ -849,7 +839,6 @@ public class RenderUtils {
|
||||
|
||||
|
||||
Model rVal = new Model();
|
||||
rVal.meshes = new ArrayList<Mesh>();
|
||||
Mesh m = new Mesh("terrain");
|
||||
int width = heightfield.length;
|
||||
int height = heightfield[0].length;
|
||||
@ -1373,7 +1362,7 @@ public class RenderUtils {
|
||||
groundMat.set_specular("/Textures/Ground/Dirt1.png");
|
||||
m.setMaterial(groundMat);
|
||||
|
||||
rVal.meshes.add(m);
|
||||
rVal.getMeshes().add(m);
|
||||
return rVal;
|
||||
}
|
||||
|
||||
@ -1438,7 +1427,6 @@ public class RenderUtils {
|
||||
|
||||
public static Model createUnitCube(){
|
||||
Model rVal = new Model();
|
||||
rVal.meshes = new ArrayList<Mesh>();
|
||||
Mesh m = new Mesh("cube");
|
||||
|
||||
// System.out.println(actualWidth + " " + actualHeight);
|
||||
@ -1598,7 +1586,7 @@ public class RenderUtils {
|
||||
groundMat.set_specular("/Textures/Ground/Dirt1.png");
|
||||
m.setMaterial(groundMat);
|
||||
|
||||
rVal.meshes.add(m);
|
||||
rVal.getMeshes().add(m);
|
||||
return rVal;
|
||||
}
|
||||
|
||||
|
||||
@ -947,7 +947,7 @@ public class RenderingEngine {
|
||||
modelTransformMatrix.translate(cameraModifiedPosition);
|
||||
// modelTransformMatrix.translate(-0.25f, 0.0f, 0.5f); //center sphere
|
||||
modelTransformMatrix.scale(data.getRadius() * 2);
|
||||
hitboxModel.modelMatrix = modelTransformMatrix;
|
||||
hitboxModel.setModelMatrix(modelTransformMatrix);
|
||||
hitboxModel.draw(renderPipelineState);
|
||||
}
|
||||
} else if(data.getType().equals(EntityDataStrings.COLLISION_ENTITY_DATA_TYPE_HIT)){
|
||||
@ -959,7 +959,7 @@ public class RenderingEngine {
|
||||
modelTransformMatrix.translate(cameraModifiedPosition);
|
||||
// modelTransformMatrix.translate(-0.25f, 0.0f, 0.5f); //center sphere
|
||||
modelTransformMatrix.scale(data.getRadius() * 2);
|
||||
hitboxModel.modelMatrix = modelTransformMatrix;
|
||||
hitboxModel.setModelMatrix(modelTransformMatrix);
|
||||
hitboxModel.draw(renderPipelineState);
|
||||
}
|
||||
}
|
||||
@ -970,7 +970,7 @@ public class RenderingEngine {
|
||||
modelTransformMatrix.translate(new Vector3f((float)position.x,(float)position.y,(float)position.z).sub(CameraEntityUtils.getCameraCenter(Globals.playerCamera)));
|
||||
// modelTransformMatrix.translate(-0.25f, 0.0f, 0.5f); //center sphere
|
||||
modelTransformMatrix.scale(data.getRadius() * 2);
|
||||
hitboxModel.modelMatrix = modelTransformMatrix;
|
||||
hitboxModel.setModelMatrix(modelTransformMatrix);
|
||||
hitboxModel.draw(renderPipelineState);
|
||||
}
|
||||
}
|
||||
@ -995,7 +995,7 @@ public class RenderingEngine {
|
||||
modelTransformMatrix.rotate(EntityUtils.getRotation(physicsEntity));
|
||||
// modelTransformMatrix.translate(template.getOffsetX(),template.getOffsetY(),template.getOffsetZ()); //center sphere
|
||||
modelTransformMatrix.scale(template.getDimension1(),template.getDimension2() * 0.5,template.getDimension3());
|
||||
physicsGraphicsModel.modelMatrix = modelTransformMatrix;
|
||||
physicsGraphicsModel.setModelMatrix(modelTransformMatrix);
|
||||
physicsGraphicsModel.draw(renderPipelineState);
|
||||
}
|
||||
break;
|
||||
@ -1011,7 +1011,7 @@ public class RenderingEngine {
|
||||
modelTransformMatrix.rotate(rotation);
|
||||
// modelTransformMatrix.translate(template.getOffsetX(),template.getOffsetY(),template.getOffsetZ()); //center sphere
|
||||
modelTransformMatrix.scale(template.getDimension1(),template.getDimension2(),template.getDimension3());
|
||||
physicsGraphicsModel.modelMatrix = modelTransformMatrix;
|
||||
physicsGraphicsModel.setModelMatrix(modelTransformMatrix);
|
||||
physicsGraphicsModel.draw(renderPipelineState);
|
||||
}
|
||||
break;
|
||||
@ -1033,7 +1033,7 @@ public class RenderingEngine {
|
||||
modelTransformMatrix.rotate(rotation);
|
||||
// modelTransformMatrix.translate(template.getOffsetX(),template.getOffsetY(),template.getOffsetZ()); //center sphere
|
||||
modelTransformMatrix.scale(new Vector3d(scale));
|
||||
physicsGraphicsModel.modelMatrix = modelTransformMatrix;
|
||||
physicsGraphicsModel.setModelMatrix(modelTransformMatrix);
|
||||
physicsGraphicsModel.draw(renderPipelineState);
|
||||
}
|
||||
} else if(physicsEntity.containsKey(EntityDataStrings.COLLISION_ENTITY_TYPE_CUBE)){
|
||||
@ -1048,7 +1048,7 @@ public class RenderingEngine {
|
||||
modelTransformMatrix.rotate(rotation);
|
||||
// modelTransformMatrix.translate(template.getOffsetX(),template.getOffsetY(),template.getOffsetZ()); //center sphere
|
||||
modelTransformMatrix.scale(new Vector3d(scale));
|
||||
physicsGraphicsModel.modelMatrix = modelTransformMatrix;
|
||||
physicsGraphicsModel.setModelMatrix(modelTransformMatrix);
|
||||
physicsGraphicsModel.draw(renderPipelineState);
|
||||
}
|
||||
}
|
||||
@ -1073,7 +1073,7 @@ public class RenderingEngine {
|
||||
modelTransformMatrix.rotate(rotation);
|
||||
// modelTransformMatrix.translate(template.getOffsetX(),template.getOffsetY(),template.getOffsetZ()); //center sphere
|
||||
modelTransformMatrix.scale(new Vector3d(scale));
|
||||
shapeGraphicsModel.modelMatrix = modelTransformMatrix;
|
||||
shapeGraphicsModel.setModelMatrix(modelTransformMatrix);
|
||||
shapeGraphicsModel.draw(renderPipelineState);
|
||||
}
|
||||
}
|
||||
|
||||
@ -123,7 +123,7 @@ public class Actor {
|
||||
if(model != null && model.getAnimation(animationName) != null){
|
||||
double length = model.getAnimation(animationName).duration;
|
||||
ActorAnimationMask animMask = new ActorAnimationMask(priority, animationName, 0, length);
|
||||
for(Bone bone : model.bones){
|
||||
for(Bone bone : model.getBones()){
|
||||
animMask.addBone(bone.boneID);
|
||||
}
|
||||
toRemoveMasks.clear();
|
||||
@ -188,7 +188,7 @@ public class Actor {
|
||||
public void applyModelMatrix(Matrix4d modelMatrix){
|
||||
Model model = Globals.assetManager.fetchModel(modelPath);
|
||||
if(model != null){
|
||||
model.modelMatrix = modelMatrix;
|
||||
model.setModelMatrix(modelMatrix);
|
||||
}
|
||||
}
|
||||
|
||||
@ -257,7 +257,7 @@ public class Actor {
|
||||
// model.playAnimation(animation);
|
||||
// model.incrementTime(animationTime);
|
||||
// model.updateNodeTransform();
|
||||
Bone currentBone = model.boneMap.get(boneName);
|
||||
Bone currentBone = model.getBoneMap().get(boneName);
|
||||
if(currentBone != null){
|
||||
Vector4d result = currentBone.final_transform.transform(new Matrix4d(currentBone.inverseBindPoseMatrix).invert().transform(new Vector4d(rVal.x,rVal.y,rVal.z,1)));
|
||||
// currentBone.inverseBindPoseMatrix
|
||||
@ -279,7 +279,7 @@ public class Actor {
|
||||
// if(animation != null){
|
||||
// model.playAnimation(animation);
|
||||
// model.incrementTime(animationTime);
|
||||
Bone currentBone = model.boneMap.get(boneName);
|
||||
Bone currentBone = model.getBoneMap().get(boneName);
|
||||
if(currentBone != null){
|
||||
AxisAngle4f axisAngle = new AxisAngle4f();
|
||||
new Matrix4f(currentBone.final_transform).getRotation(axisAngle);
|
||||
@ -301,7 +301,7 @@ public class Actor {
|
||||
// model.playAnimation(animation);
|
||||
// model.incrementTime(animationTime);
|
||||
// model.updateNodeTransform();
|
||||
Bone currentBone = model.boneMap.get(boneName);
|
||||
Bone currentBone = model.getBoneMap().get(boneName);
|
||||
if(currentBone != null){
|
||||
rVal = currentBone.final_transform;
|
||||
// currentBone.inverseBindPoseMatrix
|
||||
@ -372,7 +372,7 @@ public class Actor {
|
||||
*/
|
||||
static boolean isWithinFrustumBox(RenderPipelineState renderPipelineState, Model model){
|
||||
Sphered sphere = model.getBoundingSphere();
|
||||
Vector3d modelPosition = model.modelMatrix.getTranslation(new Vector3d());
|
||||
Vector3d modelPosition = model.getModelMatrix().getTranslation(new Vector3d());
|
||||
return renderPipelineState.getFrustumIntersection().testSphere((float)(sphere.x + modelPosition.x), (float)(sphere.y + modelPosition.y), (float)(sphere.z + modelPosition.z), (float)sphere.r);
|
||||
}
|
||||
|
||||
|
||||
@ -19,6 +19,7 @@ import org.lwjgl.assimp.AINodeAnim;
|
||||
import org.lwjgl.assimp.AIQuatKey;
|
||||
import org.lwjgl.assimp.AIVectorKey;
|
||||
|
||||
import electrosphere.logger.LoggerInterface;
|
||||
import electrosphere.renderer.loading.ModelPretransforms;
|
||||
|
||||
/**
|
||||
@ -204,32 +205,32 @@ public class Animation {
|
||||
meshChannelData = null;
|
||||
}
|
||||
public void describeAnimation(){
|
||||
System.out.println("=====================");
|
||||
System.out.println("Name: \"" + name + "\"");
|
||||
System.out.println("ID: " + ID);
|
||||
System.out.println("Duration: " + duration);
|
||||
System.out.println("Ticks per second: " + ticksPerSecond);
|
||||
LoggerInterface.loggerRenderer.DEBUG("=====================");
|
||||
LoggerInterface.loggerRenderer.DEBUG("Name: \"" + name + "\"");
|
||||
LoggerInterface.loggerRenderer.DEBUG("ID: " + ID);
|
||||
LoggerInterface.loggerRenderer.DEBUG("Duration: " + duration);
|
||||
LoggerInterface.loggerRenderer.DEBUG("Ticks per second: " + ticksPerSecond);
|
||||
Iterator<AnimChannel> channelIterator = channels.iterator();
|
||||
while(channelIterator.hasNext()){
|
||||
AnimChannel channelCurrent = channelIterator.next();
|
||||
System.out.println("=====================");
|
||||
LoggerInterface.loggerRenderer.DEBUG("=====================");
|
||||
channelCurrent.describeChannel();
|
||||
}
|
||||
System.out.println("=====================");
|
||||
LoggerInterface.loggerRenderer.DEBUG("=====================");
|
||||
}
|
||||
public void fullDescribeAnimation(){
|
||||
System.out.println("=====================");
|
||||
System.out.println("Name: " + name);
|
||||
System.out.println("ID: " + ID);
|
||||
System.out.println("Duration: " + duration);
|
||||
System.out.println("Ticks per second: " + ticksPerSecond);
|
||||
LoggerInterface.loggerRenderer.DEBUG("=====================");
|
||||
LoggerInterface.loggerRenderer.DEBUG("Name: " + name);
|
||||
LoggerInterface.loggerRenderer.DEBUG("ID: " + ID);
|
||||
LoggerInterface.loggerRenderer.DEBUG("Duration: " + duration);
|
||||
LoggerInterface.loggerRenderer.DEBUG("Ticks per second: " + ticksPerSecond);
|
||||
Iterator<AnimChannel> channelIterator = channels.iterator();
|
||||
while(channelIterator.hasNext()){
|
||||
AnimChannel channelCurrent = channelIterator.next();
|
||||
System.out.println("=====================");
|
||||
LoggerInterface.loggerRenderer.DEBUG("=====================");
|
||||
channelCurrent.fullDescribeChannel();
|
||||
}
|
||||
System.out.println("=====================");
|
||||
LoggerInterface.loggerRenderer.DEBUG("=====================");
|
||||
}
|
||||
|
||||
public boolean incrementTime(double time){
|
||||
|
||||
@ -65,7 +65,7 @@ public class ModelLoader {
|
||||
//if it exists..
|
||||
if(mesh_map != null){
|
||||
//iterate through each mesh in the model that was provided as input
|
||||
Iterator<Mesh> mesh_iterator = m.meshes.iterator();
|
||||
Iterator<Mesh> mesh_iterator = m.getMeshes().iterator();
|
||||
while(mesh_iterator.hasNext()){
|
||||
Mesh current_mesh = mesh_iterator.next();
|
||||
LoggerInterface.loggerRenderer.DEBUG(current_mesh.getMeshName());
|
||||
|
||||
@ -783,7 +783,6 @@ public class FluidChunkModelGeneration {
|
||||
*/
|
||||
public static Model generateFluidModel(FluidChunkModelData data){
|
||||
Model rVal = new Model();
|
||||
rVal.meshes = new ArrayList<Mesh>();
|
||||
Mesh m = generateFluidMesh(data);
|
||||
|
||||
|
||||
@ -796,7 +795,7 @@ public class FluidChunkModelGeneration {
|
||||
m.setShader(FluidChunkModelGeneration.fluidChunkShaderProgram);
|
||||
m.setParent(rVal);
|
||||
|
||||
rVal.meshes.add(m);
|
||||
rVal.getMeshes().add(m);
|
||||
|
||||
return rVal;
|
||||
}
|
||||
|
||||
@ -795,7 +795,6 @@ public class TerrainChunkModelGeneration {
|
||||
*/
|
||||
public static Model generateTerrainModel(TerrainChunkData data){
|
||||
Model rVal = new Model();
|
||||
rVal.meshes = new ArrayList<Mesh>();
|
||||
Mesh m = generateTerrainMesh(data);
|
||||
|
||||
|
||||
@ -808,7 +807,7 @@ public class TerrainChunkModelGeneration {
|
||||
m.setShader(TerrainChunkModelGeneration.terrainChunkShaderProgram);
|
||||
m.setParent(rVal);
|
||||
|
||||
rVal.meshes.add(m);
|
||||
rVal.getMeshes().add(m);
|
||||
rVal.setBoundingSphere(m.getBoundingSphere());
|
||||
|
||||
return rVal;
|
||||
|
||||
@ -403,7 +403,7 @@ public class Mesh {
|
||||
int incrementer = 0;
|
||||
while (boneIterator.hasNext()){
|
||||
String boneName = boneIterator.next();
|
||||
Bone currentBone = parent.boneMap.get(boneName);
|
||||
Bone currentBone = parent.getBoneMap().get(boneName);
|
||||
String currentUniform = "bones[" + incrementer + "]";
|
||||
if(currentBone != null){
|
||||
Matrix4d currentMat = new Matrix4d(currentBone.final_transform);
|
||||
@ -431,7 +431,7 @@ public class Mesh {
|
||||
|
||||
if(renderPipelineState.getBufferStandardUniforms()){
|
||||
//buffer model/view/proj matrices
|
||||
GL45.glUniformMatrix4fv(Globals.renderingEngine.getActiveShader().shaderVertexModelLoc, false, parent.modelMatrix.get(new float[16]));
|
||||
GL45.glUniformMatrix4fv(Globals.renderingEngine.getActiveShader().shaderVertexModelLoc, false, parent.getModelMatrix().get(new float[16]));
|
||||
glUniformMatrix4fv(Globals.renderingEngine.getActiveShader().shaderVertexViewLoc, false, Globals.viewMatrix.get(new float[16]));
|
||||
glUniformMatrix4fv(Globals.renderingEngine.getActiveShader().shaderVertexProjectionLoc, false, Globals.projectionMatrix.get(new float[16]));
|
||||
glUniform3fv(Globals.renderingEngine.getActiveShader().shaderVertexViewPosLoc, CameraEntityUtils.getCameraEye(Globals.playerCamera).get(BufferUtils.createFloatBuffer(3)));
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
package electrosphere.renderer.model;
|
||||
|
||||
import electrosphere.renderer.RenderPipelineState;
|
||||
import electrosphere.renderer.actor.ActorAnimationMask;
|
||||
import electrosphere.renderer.actor.ActorBoneRotator;
|
||||
import electrosphere.renderer.actor.ActorMeshMask;
|
||||
import electrosphere.renderer.actor.ActorShaderMask;
|
||||
@ -10,43 +9,24 @@ import electrosphere.renderer.actor.ActorTextureMask;
|
||||
import electrosphere.renderer.anim.AnimChannel;
|
||||
import electrosphere.renderer.anim.Animation;
|
||||
import electrosphere.renderer.loading.ModelPretransforms;
|
||||
import electrosphere.renderer.loading.ModelPretransforms.MeshMetadata;
|
||||
import electrosphere.renderer.meshgen.MeshLoader;
|
||||
import electrosphere.renderer.shader.ShaderProgram;
|
||||
import electrosphere.renderer.anim.AnimNode;
|
||||
import electrosphere.engine.Globals;
|
||||
import electrosphere.logger.LoggerInterface;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.ListIterator;
|
||||
|
||||
import org.joml.Matrix4d;
|
||||
import org.joml.Matrix4f;
|
||||
import org.joml.Vector3f;
|
||||
import org.lwjgl.BufferUtils;
|
||||
import org.lwjgl.PointerBuffer;
|
||||
import org.lwjgl.assimp.AIMaterial;
|
||||
import org.lwjgl.assimp.AIMesh;
|
||||
import org.lwjgl.assimp.AIScene;
|
||||
import static org.lwjgl.assimp.Assimp.*;
|
||||
import static org.lwjgl.opengl.ARBVertexBufferObject.*;
|
||||
import static org.lwjgl.opengl.ARBVertexProgram.*;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import static org.lwjgl.opengl.GL11.*;
|
||||
import static org.lwjgl.opengl.GL13.*;
|
||||
import static org.lwjgl.opengl.GL15.*;
|
||||
import static org.lwjgl.opengl.GL20.*;
|
||||
import static org.lwjgl.opengl.GL30.*;
|
||||
import electrosphere.renderer.texture.TextureMap;
|
||||
import java.nio.FloatBuffer;
|
||||
import org.lwjgl.assimp.Assimp;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.Map;
|
||||
import java.util.Stack;
|
||||
import org.joml.Quaternionf;
|
||||
import org.joml.Sphered;
|
||||
import org.joml.Vector3d;
|
||||
import org.lwjgl.assimp.AIAnimation;
|
||||
@ -54,31 +34,54 @@ import org.lwjgl.assimp.AIBone;
|
||||
import org.lwjgl.assimp.AINode;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author satellite
|
||||
* A model
|
||||
* Contains a list of meshes to draw
|
||||
* Contains animations to apply to those meshes
|
||||
*/
|
||||
public class Model {
|
||||
boolean is_Ready_To_Display = false;
|
||||
AIScene scene;
|
||||
public List<Mesh> meshes;
|
||||
public ArrayList<Animation> animations;
|
||||
public ArrayList<Bone> bones;
|
||||
public HashMap<String,Bone> boneMap;
|
||||
HashMap<String,Animation> animMap;
|
||||
public HashMap<String,AnimNode> node_map;
|
||||
public ArrayList<Material> materials;
|
||||
public Matrix4d modelMatrix = new Matrix4d();
|
||||
ShaderProgram program;
|
||||
Matrix4d globalInverseTransform;
|
||||
|
||||
//the model matrix for this model
|
||||
private Matrix4d modelMatrix = new Matrix4d();
|
||||
|
||||
//an optional global transform applied to the parent bone. Typically found in models loaded from files
|
||||
private Matrix4d globalInverseTransform = new Matrix4d();
|
||||
|
||||
//the meshes in the model
|
||||
private List<Mesh> meshes = new ArrayList<Mesh>();
|
||||
|
||||
//the materials in the model
|
||||
private List<Material> materials = new ArrayList<Material>();
|
||||
|
||||
//bone data for the model
|
||||
private List<Bone> bones = new ArrayList<Bone>();
|
||||
private Map<String,Bone> boneMap = new HashMap<String,Bone>();
|
||||
|
||||
AnimNode root_anim_node;
|
||||
ActorMeshMask meshMask;
|
||||
Map<String,ActorShaderMask> shaderMask = new HashMap<String,ActorShaderMask>();
|
||||
Map<String,ActorTextureMask> textureMap = null;
|
||||
//these structures are used to parse the tree of bones of the model
|
||||
private AnimNode rootAnimNode;
|
||||
private Map<String,AnimNode> nodeMap = new HashMap<String,AnimNode>();
|
||||
|
||||
//animation data for the model
|
||||
private List<Animation> animations = new ArrayList<Animation>();
|
||||
private Map<String,Animation> animMap = new HashMap<String,Animation>();
|
||||
|
||||
|
||||
//these are masks that can be applied to the model to overwrite meshes, shaders, and textures of it
|
||||
private ActorMeshMask meshMask;
|
||||
private Map<String,ActorShaderMask> shaderMask = new HashMap<String,ActorShaderMask>();
|
||||
private Map<String,ActorTextureMask> textureMap = new HashMap<String,ActorTextureMask>();
|
||||
|
||||
//The bounding sphere for this particular model
|
||||
Sphered boundingSphere;
|
||||
private Sphered boundingSphere = new Sphered();
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public Model(){
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads a model from an ai scene object
|
||||
* @param path The path of the model
|
||||
@ -87,10 +90,6 @@ public class Model {
|
||||
*/
|
||||
public static Model createModelFromAiscene(String path, AIScene s){
|
||||
Model rVal = new Model();
|
||||
//
|
||||
//set the scene
|
||||
//
|
||||
rVal.scene = s;
|
||||
|
||||
ModelPretransforms.ModelMetadata modelMetadata = Globals.modelPretransforms.getModel(path);
|
||||
ModelPretransforms.GlobalTransform globalTransform = null;
|
||||
@ -141,7 +140,7 @@ public class Model {
|
||||
Iterator<Mesh> meshIterator = rVal.meshes.iterator();
|
||||
rVal.bones = new ArrayList<Bone>();
|
||||
rVal.boneMap = new HashMap<String,Bone>();
|
||||
rVal.node_map = new HashMap<String, AnimNode>();
|
||||
rVal.nodeMap = new HashMap<String, AnimNode>();
|
||||
while(meshIterator.hasNext()){
|
||||
Mesh currentMesh = meshIterator.next();
|
||||
Iterator<Bone> boneIterator = currentMesh.getBones().iterator();
|
||||
@ -171,9 +170,9 @@ public class Model {
|
||||
if(globalTransform != null){
|
||||
rVal.globalInverseTransform.scale(globalTransform.getScale());
|
||||
}
|
||||
// System.out.println("Global inverse transform");
|
||||
// System.out.println(globalInverseTransform);
|
||||
rVal.root_anim_node = rVal.build_anim_node_map(s.mRootNode(),null);
|
||||
LoggerInterface.loggerRenderer.DEBUG("Global Inverse Transform");
|
||||
LoggerInterface.loggerRenderer.DEBUG(rVal.globalInverseTransform + "");
|
||||
rVal.rootAnimNode = rVal.buildAnimNodeMap(s.mRootNode(),null);
|
||||
//
|
||||
//load animations
|
||||
//
|
||||
@ -201,46 +200,11 @@ public class Model {
|
||||
return rVal;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public Model(){
|
||||
/*
|
||||
public boolean is_Ready_To_Display = false;
|
||||
public AIScene scene;
|
||||
public ArrayList<Mesh> meshes;
|
||||
public ArrayList<Animation> animations;
|
||||
public ArrayList<Bone> bones;
|
||||
public HashMap<String,Bone> boneMap;
|
||||
public HashMap<String,AnimNode> node_map = new HashMap();
|
||||
public ArrayList<Material> materials;
|
||||
public Matrix4f modelMatrix = new Matrix4f().translation(new Vector3f(0,0,0));
|
||||
ShaderProgram program;
|
||||
public Animation currentAnimation;
|
||||
public Matrix4f globalInverseTransform;
|
||||
*/
|
||||
scene = null;
|
||||
meshes = null;
|
||||
animations = null;
|
||||
bones = null;
|
||||
boneMap = null;
|
||||
node_map = null;
|
||||
materials = null;
|
||||
modelMatrix = new Matrix4d();
|
||||
program = null;
|
||||
globalInverseTransform = null;
|
||||
this.boundingSphere = new Sphered();
|
||||
}
|
||||
|
||||
public void free() {
|
||||
aiReleaseImport(scene);
|
||||
scene = null;
|
||||
meshes = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Draws the model
|
||||
* @param renderPipelineState the render pipeline state
|
||||
*/
|
||||
public void draw(RenderPipelineState renderPipelineState){
|
||||
// if(node_map != null && !node_map.isEmpty()){
|
||||
// update_node_transform(root_anim_node);
|
||||
// }
|
||||
Iterator<Mesh> mesh_Iterator = meshes.iterator();
|
||||
while(mesh_Iterator.hasNext()){
|
||||
Mesh currentMesh = mesh_Iterator.next();
|
||||
@ -274,43 +238,32 @@ public class Model {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines the correct shader to use for a given mesh
|
||||
* @param shaderMask The shader mask
|
||||
* @param mesh The mesh
|
||||
* @param oldShader The original shader on the mesh
|
||||
* @return The correct shader program to use for this mesh
|
||||
*/
|
||||
ShaderProgram getCorrectShader(Map<String,ActorShaderMask> shaderMask, Mesh mesh, ShaderProgram oldShader){
|
||||
ShaderProgram rVal = oldShader;
|
||||
if(shaderMask.containsKey(mesh.getMeshName())){
|
||||
ActorShaderMask specificMask = shaderMask.get(mesh.getMeshName());
|
||||
ShaderProgram overwriteShader = null;
|
||||
if((overwriteShader = Globals.assetManager.fetchShader(specificMask.getVertexShaderPath(), specificMask.getGeometryShaderPath(), specificMask.getFragmentShaderPath())) != null){
|
||||
// ShaderProgram oldProgram = mesh.shader;
|
||||
rVal = overwriteShader;
|
||||
}
|
||||
}
|
||||
return rVal;
|
||||
}
|
||||
|
||||
|
||||
// public void playAnimation(String s){
|
||||
// this.currentAnimation = null;
|
||||
// Iterator<Animation> animationIterator = animations.iterator();
|
||||
// while(animationIterator.hasNext()){
|
||||
// Animation current_iterator_item = animationIterator.next();
|
||||
// if(current_iterator_item.name.equals(s)){
|
||||
// this.currentAnimation = current_iterator_item;
|
||||
// }
|
||||
// }
|
||||
// if(currentAnimation != null){
|
||||
// // if(s.contains("Walk")){
|
||||
// // currentAnimation.describeAnimation();
|
||||
// //// currentAnimation.fullDescribeAnimation();
|
||||
// // }
|
||||
// currentAnimation.timeCurrent = 0;
|
||||
// Iterator<AnimChannel> channelIterator = currentAnimation.channels.iterator();
|
||||
// while(channelIterator.hasNext()){
|
||||
// AnimChannel currentChannel = channelIterator.next();
|
||||
// currentChannel.rewind();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
/**
|
||||
* Applies an animation mask to the model
|
||||
* @param animationName The name of the animation
|
||||
* @param time The temporal location in the animation to mask
|
||||
* @param mask The mask
|
||||
*/
|
||||
public void applyAnimationMask(String animationName, double time, List<String> mask){
|
||||
Animation animationCurrent = animMap.get(animationName);
|
||||
if(animationCurrent != null){
|
||||
@ -331,53 +284,13 @@ public class Model {
|
||||
}
|
||||
}
|
||||
|
||||
// public void incrementTime(double time){
|
||||
// if(currentAnimation != null){
|
||||
// boolean isDone = currentAnimation.incrementTime(time);
|
||||
// if(isDone){
|
||||
// currentAnimation.timeCurrent = 0;
|
||||
// Iterator<AnimChannel> channelIterator = currentAnimation.channels.iterator();
|
||||
// while(channelIterator.hasNext()){
|
||||
// AnimChannel currentChannel = channelIterator.next();
|
||||
// currentChannel.rewind();
|
||||
// }
|
||||
// Iterator<Bone> boneIterator = bones.iterator();
|
||||
// while(boneIterator.hasNext()){
|
||||
// Bone currentBone = boneIterator.next();
|
||||
// currentBone.transform = new Matrix4f();
|
||||
// }
|
||||
// currentAnimation = null;
|
||||
// } else {
|
||||
// //First we push transformFromParent into deform so that later in the pipeline bones without a current animation take on transformFromParent as their transformation to the hierarchy
|
||||
// //I BELIEVE this is so that control bones still apply their offset to the hierarchy even when they're not animated :tm:
|
||||
// //4/5/20
|
||||
// // Iterator<Bone> boneIterator = bones.iterator();
|
||||
// // while(boneIterator.hasNext()){
|
||||
// // Bone currentBone = boneIterator.next();
|
||||
// //// currentBone.deform = currentBone.transformFromParent;
|
||||
// // }
|
||||
// //Once that's done, for every channel we set the corresponding bone's deform to the channels TRS
|
||||
// Iterator<AnimChannel> channelIterator = currentAnimation.channels.iterator();
|
||||
// while(channelIterator.hasNext()){
|
||||
// AnimChannel currentChannel = channelIterator.next();
|
||||
// currentChannel.incrementTime(time);
|
||||
// Bone currentBone = boneMap.get(currentChannel.getNodeID());
|
||||
// if(currentBone != null){
|
||||
// //T * S * R
|
||||
// currentBone.deform = new Matrix4f();
|
||||
// currentBone.deform.translate(currentChannel.getCurrentPosition());
|
||||
// currentBone.deform.rotate(currentChannel.getCurrentRotation());
|
||||
// currentBone.deform.scale(currentChannel.getCurrentScale());
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
/**
|
||||
* Logs all animations for a given model
|
||||
*/
|
||||
public void describeAllAnimations(){
|
||||
if(animations.size() > 0){
|
||||
System.out.println("=====================");
|
||||
System.out.println(animations.size() + " animations available in model!");
|
||||
LoggerInterface.loggerRenderer.DEBUG("=====================");
|
||||
LoggerInterface.loggerRenderer.DEBUG(animations.size() + " animations available in model!");
|
||||
Iterator<Animation> animIterator = animations.iterator();
|
||||
while(animIterator.hasNext()){
|
||||
Animation currentAnim = animIterator.next();
|
||||
@ -386,50 +299,50 @@ public class Model {
|
||||
}
|
||||
}
|
||||
|
||||
public final AnimNode build_anim_node_map(AINode node, AnimNode parent){
|
||||
/**
|
||||
* Recursively builds the bone tree
|
||||
* @param node The current assimp bone to operate on
|
||||
* @param parent The parent bone
|
||||
* @return The current bone
|
||||
*/
|
||||
public final AnimNode buildAnimNodeMap(AINode node, AnimNode parent){
|
||||
AnimNode node_object = new AnimNode(node.mName().dataString(), parent, node);
|
||||
node_map.put(node_object.id, node_object);
|
||||
nodeMap.put(node_object.id, node_object);
|
||||
if(boneMap.containsKey(node_object.id)){
|
||||
node_object.is_bone = true;
|
||||
}
|
||||
int num_children = node.mNumChildren();
|
||||
for(int i = 0; i < num_children; i++){
|
||||
AnimNode temp_child = build_anim_node_map(AINode.create(node.mChildren().get(i)),node_object);
|
||||
// if(boneMap.containsKey(node_object.id)){
|
||||
// Bone parent_bone = boneMap.get(node_object.id);
|
||||
// node_object.children.add(temp_child);
|
||||
// if(boneMap.containsKey(temp_child.id)){
|
||||
// Bone child_bone = boneMap.get(temp_child.id);
|
||||
// parent_bone.children.add(child_bone);
|
||||
// child_bone.parent = parent_bone;
|
||||
// }
|
||||
// }
|
||||
AnimNode temp_child = buildAnimNodeMap(AINode.create(node.mChildren().get(i)),node_object);
|
||||
node_object.children.add(temp_child);
|
||||
}
|
||||
return node_object;
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the position of all bones to their correct locations given bone rotators, static morph, and current animation
|
||||
* @param boneRotators The bone rotators to apply
|
||||
* @param staticMorph The static morph to apply
|
||||
*/
|
||||
public void updateNodeTransform(Map<String,ActorBoneRotator> boneRotators, ActorStaticMorph staticMorph){
|
||||
if(this.root_anim_node != null){
|
||||
update_node_transform(this.root_anim_node,boneRotators,staticMorph);
|
||||
if(this.rootAnimNode != null){
|
||||
updateNodeTransform(this.rootAnimNode,boneRotators,staticMorph);
|
||||
}
|
||||
}
|
||||
|
||||
void update_node_transform(AnimNode n, Map<String,ActorBoneRotator> boneRotators, ActorStaticMorph staticMorph){
|
||||
/**
|
||||
* Recursively updates the position of all bones to their correct locations given bone rotators, static morph, and current animation
|
||||
* @param n the current node to operate on
|
||||
* @param boneRotators The bone rotators to apply
|
||||
* @param staticMorph The static morph to apply
|
||||
*/
|
||||
void updateNodeTransform(AnimNode n, Map<String,ActorBoneRotator> boneRotators, ActorStaticMorph staticMorph){
|
||||
if(n.parent != null){
|
||||
n.transform = new Matrix4d(n.parent.transform);
|
||||
} else {
|
||||
n.transform = new Matrix4d();
|
||||
}
|
||||
if(n.is_bone){
|
||||
/*
|
||||
Bone bone = boneList.get(j);
|
||||
Node node = rootNode.findByName(bone.getBoneName());
|
||||
Matrix4f boneMatrix = Node.getParentTransforms(node, i);
|
||||
boneMatrix.mul(bone.getOffsetMatrix());
|
||||
boneMatrix = new Matrix4f(rootTransformation).mul(boneMatrix);
|
||||
frame.setMatrix(j, boneMatrix);
|
||||
*/
|
||||
//
|
||||
//bone rotators (turrets, hair, etc)
|
||||
Bone target_bone = boneMap.get(n.id);
|
||||
@ -449,35 +362,32 @@ public class Model {
|
||||
bone_matrix.mul(target_bone.inverseBindPoseMatrix);
|
||||
bone_matrix = new Matrix4d(globalInverseTransform).mul(bone_matrix);
|
||||
target_bone.final_transform = bone_matrix;
|
||||
// if(!toggled){
|
||||
// System.out.println(n.id);
|
||||
// System.out.println("Transform:");
|
||||
// System.out.println(n.parent.transform);
|
||||
// System.out.println(target_bone.deform);
|
||||
// System.out.println(n.transform);
|
||||
// System.out.println("Final transform:");
|
||||
// System.out.println(globalInverseTransform);
|
||||
// System.out.println(n.transform);
|
||||
// System.out.println(target_bone.inverseBindPoseMatrix);
|
||||
// System.out.println(target_bone.final_transform);
|
||||
// System.out.println("\n\n\n\n");
|
||||
// }
|
||||
} else {
|
||||
n.transform = n.transform.mul(electrosphere.util.Utilities.convertAIMatrix(n.raw_data.mTransformation()));
|
||||
}
|
||||
Iterator<AnimNode> node_iterator = n.children.iterator();
|
||||
while(node_iterator.hasNext()){
|
||||
AnimNode current_node = node_iterator.next();
|
||||
update_node_transform(current_node,boneRotators,staticMorph);
|
||||
updateNodeTransform(current_node,boneRotators,staticMorph);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Draws a ui model
|
||||
*/
|
||||
public void drawUI(){
|
||||
for(Mesh m : meshes){
|
||||
m.complexDraw(Globals.renderingEngine.getRenderPipelineState());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Pushes a uniform to a given mesh
|
||||
* @param meshName The name of the mesh
|
||||
* @param uniformKey The uniform key
|
||||
* @param uniform The value of the uniform
|
||||
*/
|
||||
public void pushUniformToMesh(String meshName, String uniformKey, Object uniform){
|
||||
for(Mesh m : meshes){
|
||||
if(m.getMeshName().equals(meshName)){
|
||||
@ -486,12 +396,20 @@ public class Model {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Logs all bone IDs (names)
|
||||
*/
|
||||
public void listAllBoneIDs(){
|
||||
for(String id : boneMap.keySet()){
|
||||
System.out.println(id);
|
||||
LoggerInterface.loggerRenderer.DEBUG(id);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a given mesh by its name
|
||||
* @param meshName the name of the mesh
|
||||
* @return The mesh if it exists, or null
|
||||
*/
|
||||
public Mesh getMesh(String meshName){
|
||||
for(Mesh mesh : meshes){
|
||||
if(mesh.getMeshName().matches(meshName)){
|
||||
@ -501,45 +419,113 @@ public class Model {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets an animation by its name
|
||||
* @param animName The name of the animation
|
||||
* @return the animation if it exists, or null
|
||||
*/
|
||||
public Animation getAnimation(String animName){
|
||||
return animMap.get(animName);
|
||||
}
|
||||
|
||||
public Map<String,ActorShaderMask> getShaderMask(){
|
||||
return shaderMask;
|
||||
}
|
||||
|
||||
/**
|
||||
* Describes the model at a high level
|
||||
*/
|
||||
public void describeHighLevel(){
|
||||
System.out.println("Meshes: ");
|
||||
LoggerInterface.loggerRenderer.DEBUG("Meshes: ");
|
||||
for(Mesh mesh : meshes){
|
||||
System.out.println(mesh.getMeshName());
|
||||
LoggerInterface.loggerRenderer.DEBUG(mesh.getMeshName());
|
||||
}
|
||||
System.out.println("Animations: ");
|
||||
LoggerInterface.loggerRenderer.DEBUG("Animations: ");
|
||||
for(Animation anim : animations){
|
||||
System.out.println(anim.name);
|
||||
LoggerInterface.loggerRenderer.DEBUG(anim.name);
|
||||
}
|
||||
System.out.println("Bones:");
|
||||
LoggerInterface.loggerRenderer.DEBUG("Bones:");
|
||||
for(Bone bone : bones){
|
||||
System.out.println(bone.boneID);
|
||||
LoggerInterface.loggerRenderer.DEBUG(bone.boneID);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Pure getters and setters
|
||||
//
|
||||
|
||||
|
||||
/**
|
||||
* Gets the meshes in this model
|
||||
* @return the list of meshes
|
||||
*/
|
||||
public List<Mesh> getMeshes(){
|
||||
return meshes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the model matrix for this model
|
||||
* @param modelMatrix the model matrix
|
||||
*/
|
||||
public void setModelMatrix(Matrix4d modelMatrix){
|
||||
this.modelMatrix = modelMatrix;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the model matrix for this model
|
||||
* @return the model matrix
|
||||
*/
|
||||
public Matrix4d getModelMatrix(){
|
||||
return modelMatrix;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the list of bones
|
||||
* @return the list of bones
|
||||
*/
|
||||
public List<Bone> getBones(){
|
||||
return bones;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the map of bone name -> bone
|
||||
* @return the map
|
||||
*/
|
||||
public Map<String,Bone> getBoneMap(){
|
||||
return boneMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the list of materials in this model
|
||||
* @return The list of materials
|
||||
*/
|
||||
public List<Material> getMaterials(){
|
||||
return materials;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the mesh mask
|
||||
* @param meshMask the mesh mask to set
|
||||
*/
|
||||
public void setMeshMask(ActorMeshMask meshMask){
|
||||
this.meshMask = meshMask;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the texture mask
|
||||
* @param textureMask the texture mask
|
||||
*/
|
||||
public void setTextureMask(Map<String,ActorTextureMask> textureMask){
|
||||
this.textureMap = textureMask;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the shader program to use drawing the modal
|
||||
* @param program The shader program
|
||||
* Gets the shader mask map
|
||||
* @return The shader mask map
|
||||
*/
|
||||
public void setProgram(ShaderProgram program){
|
||||
this.program = program;
|
||||
public Map<String,ActorShaderMask> getShaderMask(){
|
||||
return shaderMask;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Utility method to attempt overwriting the model's meshes with a new material
|
||||
* @param material The material
|
||||
|
||||
@ -82,7 +82,7 @@ public class Window implements DrawableElement, ContainerElement, NavigableEleme
|
||||
planeModel.pushUniformToMesh("plane", "mDimension", boxDimensions);
|
||||
planeModel.pushUniformToMesh("plane", "tPosition", texPosition);
|
||||
planeModel.pushUniformToMesh("plane", "tDimension", texScale);
|
||||
planeModel.meshes.get(0).setMaterial(customMat);
|
||||
planeModel.getMeshes().get(0).setMaterial(customMat);
|
||||
planeModel.drawUI();
|
||||
} else {
|
||||
LoggerInterface.loggerRenderer.ERROR("Window unable to find plane model!!", new Exception());
|
||||
|
||||
@ -172,7 +172,7 @@ public class ActorPanel implements DrawableElement, DraggableElement {
|
||||
planeModel.pushUniformToMesh("plane", "mDimension", boxDimensions);
|
||||
planeModel.pushUniformToMesh("plane", "tPosition", texPosition);
|
||||
planeModel.pushUniformToMesh("plane", "tDimension", texScale);
|
||||
planeModel.meshes.get(0).setMaterial(customMat);
|
||||
planeModel.getMeshes().get(0).setMaterial(customMat);
|
||||
planeModel.draw(Globals.renderingEngine.getRenderPipelineState());
|
||||
} else {
|
||||
LoggerInterface.loggerRenderer.ERROR("Actor Panel unable to find plane model!!", new Exception());
|
||||
|
||||
@ -92,7 +92,7 @@ public class ImagePanel implements DrawableElement, DraggableElement {
|
||||
planeModel.pushUniformToMesh("plane", "mDimension", boxDimensions);
|
||||
planeModel.pushUniformToMesh("plane", "tPosition", texPosition);
|
||||
planeModel.pushUniformToMesh("plane", "tDimension", texScale);
|
||||
planeModel.meshes.get(0).setMaterial(customMat);
|
||||
planeModel.getMeshes().get(0).setMaterial(customMat);
|
||||
planeModel.drawUI();
|
||||
} else {
|
||||
LoggerInterface.loggerRenderer.ERROR("Image Panel unable to find plane model!!", new Exception());
|
||||
|
||||
@ -257,7 +257,7 @@ public class ScrollableContainer implements DrawableElement, ContainerElement {
|
||||
planeModel.pushUniformToMesh("plane", "mDimension", boxDimensions);
|
||||
planeModel.pushUniformToMesh("plane", "tPosition", texPosition);
|
||||
planeModel.pushUniformToMesh("plane", "tDimension", texScale);
|
||||
planeModel.meshes.get(0).setMaterial(customMat);
|
||||
planeModel.getMeshes().get(0).setMaterial(customMat);
|
||||
planeModel.drawUI();
|
||||
} else {
|
||||
LoggerInterface.loggerRenderer.ERROR("ScrollableContainer unable to find plane model!!", new Exception());
|
||||
|
||||
@ -102,7 +102,7 @@ public class Slider implements ClickableElement, DraggableElement, FocusableElem
|
||||
//bounding box/margin
|
||||
planeModel.pushUniformToMesh("plane", "mPosition", boxPosition);
|
||||
planeModel.pushUniformToMesh("plane", "mDimension", boxDimensions);
|
||||
planeModel.pushUniformToMesh(planeModel.meshes.get(0).getMeshName(), "color", colorBackground);
|
||||
planeModel.pushUniformToMesh(planeModel.getMeshes().get(0).getMeshName(), "color", colorBackground);
|
||||
planeModel.drawUI();
|
||||
|
||||
//actual slider
|
||||
@ -114,7 +114,7 @@ public class Slider implements ClickableElement, DraggableElement, FocusableElem
|
||||
boxDimensions = new Vector3f(ndcWidth,ndcHeight,0);
|
||||
planeModel.pushUniformToMesh("plane", "mPosition", boxPosition);
|
||||
planeModel.pushUniformToMesh("plane", "mDimension", boxDimensions);
|
||||
planeModel.pushUniformToMesh(planeModel.meshes.get(0).getMeshName(), "color", colorForeground);
|
||||
planeModel.pushUniformToMesh(planeModel.getMeshes().get(0).getMeshName(), "color", colorForeground);
|
||||
planeModel.drawUI();
|
||||
} else {
|
||||
LoggerInterface.loggerRenderer.ERROR("Window unable to find plane model!!", new Exception());
|
||||
|
||||
@ -77,7 +77,7 @@ public class LayoutSchemeListScrollable implements DrawableElement,LayoutScheme
|
||||
planeModel.pushUniformToMesh("plane", "mDimension", boxDimensions);
|
||||
planeModel.pushUniformToMesh("plane", "tPosition", texPosition);
|
||||
planeModel.pushUniformToMesh("plane", "tDimension", texScale);
|
||||
planeModel.meshes.get(0).setMaterial(customMat);
|
||||
planeModel.getMeshes().get(0).setMaterial(customMat);
|
||||
planeModel.drawUI();
|
||||
|
||||
if(Globals.RENDER_FLAG_RENDER_UI_BOUNDS){
|
||||
|
||||
Loading…
Reference in New Issue
Block a user