diff --git a/docs/src/progress/renderertodo.md b/docs/src/progress/renderertodo.md index 6f039249..f9344657 100644 --- a/docs/src/progress/renderertodo.md +++ b/docs/src/progress/renderertodo.md @@ -1893,6 +1893,9 @@ Texture class cleanup work OS data wrapper Renderer code cleanup +(05/19/2025) +Renderer code cleanup + diff --git a/src/main/java/electrosphere/renderer/actor/Actor.java b/src/main/java/electrosphere/renderer/actor/Actor.java index f86a6d15..63476539 100644 --- a/src/main/java/electrosphere/renderer/actor/Actor.java +++ b/src/main/java/electrosphere/renderer/actor/Actor.java @@ -47,83 +47,83 @@ public class Actor { /** * the model path of the model backing the actor */ - String modelPath; + private String modelPath; /** * used for statically binding textures in pipelines that dont bind textures on a per-mesh level * ie when in the ui, this can be set to bind a texture at the actor level */ - String textureOverride; + private String textureOverride; /** * scales the time that animations are played at */ - float animationScalar = 1.0f; + private float animationScalar = 1.0f; /** * The stack of animations being applied to a given actor */ - Set animationQueue = new TreeSet(); + private Set animationQueue = new TreeSet(); /** * Mask for overwriting meshes in a given actor */ - ActorMeshMask meshMask = new ActorMeshMask(); + private ActorMeshMask meshMask = new ActorMeshMask(); /** * optional overrides for specific shaders */ - List shaderMasks = new LinkedList(); + private List shaderMasks = new LinkedList(); /** * optional overrides for textures */ - Map textureMap = null; + private Map textureMap = null; /** * bone rotators */ - Map boneRotators = new HashMap(); + private Map boneRotators = new HashMap(); /** * static morph for this specific actor */ - ActorStaticMorph staticMorph; + private ActorStaticMorph staticMorph; /** * The list of bone groups */ - List boneGroups; + private List boneGroups; /** * A map of mesh -> uniforms to apply to the mesh */ - ActorUniformMap uniformMap = new ActorUniformMap(); + private ActorUniformMap uniformMap = new ActorUniformMap(); /** * Controls whether the actor should obey frustum culling */ - boolean frustumCull = true; + private boolean frustumCull = true; /** * Used for caching animation masks that should be removed */ - List toRemoveMasks = new LinkedList(); + private List toRemoveMasks = new LinkedList(); /** * Stores the positions of bones as they are updated */ - Map bonePositionMap = new HashMap(); + private Map bonePositionMap = new HashMap(); /** * Stores the rotations of bones as they are updated */ - Map boneRotationMap = new HashMap(); + private Map boneRotationMap = new HashMap(); /** * Sets scaling applied at the actor level */ - float scale = 1.0f; + private float scale = 1.0f; /** * Creates an achor diff --git a/src/main/java/electrosphere/renderer/model/Bone.java b/src/main/java/electrosphere/renderer/model/Bone.java index 3717a250..74dddfa5 100644 --- a/src/main/java/electrosphere/renderer/model/Bone.java +++ b/src/main/java/electrosphere/renderer/model/Bone.java @@ -12,25 +12,39 @@ import org.lwjgl.assimp.AIBone; */ public class Bone { - //the name of the bone + /** + * the name of the bone + */ public String boneID; - //the number of vertices affected by this bone - int numWeights; + /** + * the number of vertices affected by this bone + */ + private int numWeights; - //The map of index of vertex to weight of this bone on that vertex - Map weights = new HashMap(); + /** + * The map of index of vertex to weight of this bone on that vertex + */ + private Map weights = new HashMap(); - //the mOffsetMatrix -- transforms from mesh space to bone space in bind pose + /** + * the mOffsetMatrix -- transforms from mesh space to bone space in bind pose + */ private Matrix4d mOffsetMatrix; - //the current deform value of the bone + /** + * the current deform value of the bone + */ private Matrix4d deform; - //the final transform that is used for drawing, data, etc + /** + * the final transform that is used for drawing, data, etc + */ private Matrix4d finalTransform; - //the raw data for the bone + /** + * the raw data for the bone + */ public AIBone raw_data; /** @@ -86,19 +100,43 @@ public class Bone { this.mOffsetMatrix = new Matrix4d(mOffset); } + /** + * Gets the deform matrix of the bone + * @return The deform matrix + */ public Matrix4d getDeform(){ return new Matrix4d(deform); } + /** + * Sets the deform matrix of the bone + * @param deform The deform matrix + */ public void setDeform(Matrix4d deform){ this.deform = new Matrix4d(deform); } + /** + * Gets the final transform of the bone + * @return The final transform + */ public Matrix4d getFinalTransform(){ return new Matrix4d(finalTransform); } + /** + * Sets the final transform of the bone + * @param finalTransform The final transform + */ public void setFinalTransform(Matrix4d finalTransform){ this.finalTransform = new Matrix4d(finalTransform); } + + /** + * Gets the number of weights + * @return The number of weights + */ + public int getNumWeights(){ + return numWeights; + } } diff --git a/src/main/java/electrosphere/renderer/shader/ComputeShader.java b/src/main/java/electrosphere/renderer/shader/ComputeShader.java index 84335374..4945850d 100644 --- a/src/main/java/electrosphere/renderer/shader/ComputeShader.java +++ b/src/main/java/electrosphere/renderer/shader/ComputeShader.java @@ -24,12 +24,16 @@ public class ComputeShader implements Shader { /** * The id for the shader */ - int programId; + private int programId; - //Uniforms + /** + * Map of uniform index -> uniform value + */ public Map uniformMap = new HashMap(); - //keeps track of programs that have already been compiled and returns them instead of recompiling from scratch + /** + * keeps track of programs that have already been compiled and returns them instead of recompiling from scratch + */ static Map alreadyCompiledMap = new HashMap(); /**