grid-alignment data editing in debug menu
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
edecb36599
commit
97569c84f0
@ -258,9 +258,9 @@
|
||||
"onInteract" : "inventory"
|
||||
},
|
||||
"gridAlignedData" : {
|
||||
"width" : 10,
|
||||
"height" : 10,
|
||||
"length" : 10
|
||||
"width" : 4,
|
||||
"height" : 4,
|
||||
"length" : 4
|
||||
},
|
||||
"inventoryData" : {
|
||||
"naturalSize" : 30
|
||||
|
||||
@ -1782,6 +1782,7 @@ Furniture spawner items triggers grid alignment cursor
|
||||
Grid aligned entity work
|
||||
Grid alignment visualization work
|
||||
Move around entity debug tab classes
|
||||
Grid alignment data editing in debug menus
|
||||
|
||||
|
||||
|
||||
|
||||
@ -12,13 +12,12 @@ import electrosphere.client.interact.ClientInteractionEngine;
|
||||
import electrosphere.client.ui.menu.debug.entity.tabs.ImGuiEntityActorTab;
|
||||
import electrosphere.client.ui.menu.debug.entity.tabs.ImGuiEntityDebugActions;
|
||||
import electrosphere.client.ui.menu.debug.entity.tabs.ImGuiEntityFoliageTab;
|
||||
import electrosphere.client.ui.menu.debug.entity.tabs.ImGuiEntityFurnitureTab;
|
||||
import electrosphere.client.ui.menu.debug.entity.tabs.ImGuiEntityHitboxTab;
|
||||
import electrosphere.client.ui.menu.debug.entity.tabs.ImGuiEntityInstancedActorTab;
|
||||
import electrosphere.client.ui.menu.debug.entity.tabs.ImGuiEntityInteractionTab;
|
||||
import electrosphere.client.ui.menu.debug.entity.tabs.ImGuiEntityInventoryTab;
|
||||
import electrosphere.client.ui.menu.debug.entity.tabs.ImGuiEntityPhysicsTab;
|
||||
import electrosphere.client.ui.menu.debug.entity.tabs.ImGuiEntityServerTab;
|
||||
import electrosphere.client.ui.menu.debug.entity.tabs.ImGuiEntityToolbarTab;
|
||||
import electrosphere.collision.PhysicsEntityUtils;
|
||||
import electrosphere.data.creature.equip.EquipPoint;
|
||||
import electrosphere.data.foliage.FoliageType;
|
||||
@ -86,6 +85,7 @@ public class ImGuiEntityMacros {
|
||||
private static boolean showToolbarTab = false; //show toolbar data
|
||||
private static boolean showInventoryTab = false; //show inventory data
|
||||
private static boolean showInteractionTab = false; //show inventory data
|
||||
private static boolean showFurnitureTab = false; //show the furniture data
|
||||
private static boolean showDebugActionsTab = false; //show debug actions
|
||||
|
||||
/**
|
||||
@ -215,6 +215,9 @@ public class ImGuiEntityMacros {
|
||||
if(ClientInteractionEngine.hasInteractionBody(detailViewEntity) && ImGui.checkbox("Interaction Data", showInteractionTab)){
|
||||
showInteractionTab = !showInteractionTab;
|
||||
}
|
||||
if(CommonEntityUtils.getCommonData(detailViewEntity) != null && CommonEntityUtils.getCommonData(detailViewEntity).getGridAlignedData() != null && ImGui.checkbox("Furniture Data", showFurnitureTab)){
|
||||
showFurnitureTab = !showFurnitureTab;
|
||||
}
|
||||
if(
|
||||
(InventoryUtils.hasNaturalInventory(detailViewEntity) || InventoryUtils.hasEquipInventory(detailViewEntity) || InventoryUtils.hasToolbarInventory(detailViewEntity)) &&
|
||||
ImGui.checkbox("Inventory Data", showInventoryTab)
|
||||
@ -229,7 +232,7 @@ public class ImGuiEntityMacros {
|
||||
ImGui.nextColumn();
|
||||
ImGuiEntityServerTab.drawServerView(showServerTab, detailViewEntity);
|
||||
ImGuiEntityActorTab.drawActorView(showActorTab,detailViewEntity);
|
||||
ImGuiEntityInstancedActorTab.drawInstancedActorView(showInstancedActorTab, detailViewEntity);
|
||||
ImGuiEntityActorTab.drawInstancedActorView(showInstancedActorTab, detailViewEntity);
|
||||
ImGuiEntityHitboxTab.drawHitboxTab(showHitboxTab,detailViewEntity);
|
||||
ImGuiEntityMacros.drawPoseActor();
|
||||
ImGuiEntityMacros.drawEquipState();
|
||||
@ -238,9 +241,10 @@ public class ImGuiEntityMacros {
|
||||
ImGuiEntityMacros.drawServerViewDir();
|
||||
ImGuiEntityPhysicsTab.drawPhysicsView(showPhysicsTab, detailViewEntity);
|
||||
ImGuiEntityFoliageTab.drawFoliageView(showFoliageTab, detailViewEntity);
|
||||
ImGuiEntityToolbarTab.drawToolbarTab(showToolbarTab, detailViewEntity);
|
||||
ImGuiEntityInventoryTab.drawToolbarTab(showToolbarTab, detailViewEntity);
|
||||
ImGuiEntityInventoryTab.drawInventoryTab(showInventoryTab, detailViewEntity);
|
||||
ImGuiEntityInteractionTab.drawInteractionTab(showInteractionTab, detailViewEntity);
|
||||
ImGuiEntityFurnitureTab.drawFurnitureTab(showFurnitureTab, detailViewEntity);
|
||||
ImGuiEntityDebugActions.drawDebugActions(showDebugActionsTab, detailViewEntity);
|
||||
ImGuiEntityMacros.drawDataView();
|
||||
}
|
||||
|
||||
@ -4,16 +4,22 @@ import java.util.Set;
|
||||
import java.util.Random;
|
||||
|
||||
import electrosphere.data.common.CommonEntityType;
|
||||
import electrosphere.data.foliage.ProceduralTreeBranchModel;
|
||||
import electrosphere.data.foliage.TreeModel;
|
||||
import electrosphere.data.graphics.ProceduralModel;
|
||||
import electrosphere.engine.Globals;
|
||||
import electrosphere.entity.ClientEntityUtils;
|
||||
import electrosphere.entity.Entity;
|
||||
import electrosphere.entity.EntityUtils;
|
||||
import electrosphere.entity.state.AnimationPriorities;
|
||||
import electrosphere.entity.state.attach.AttachUtils;
|
||||
import electrosphere.entity.types.common.CommonEntityUtils;
|
||||
import electrosphere.entity.types.tree.ProceduralTree;
|
||||
import electrosphere.logger.LoggerInterface;
|
||||
import electrosphere.renderer.actor.Actor;
|
||||
import electrosphere.renderer.actor.ActorAnimationMask;
|
||||
import electrosphere.renderer.actor.ActorMeshMask;
|
||||
import electrosphere.renderer.actor.instance.InstancedActor;
|
||||
import electrosphere.renderer.anim.AnimChannel;
|
||||
import electrosphere.renderer.anim.Animation;
|
||||
import electrosphere.renderer.model.Bone;
|
||||
@ -137,4 +143,241 @@ public class ImGuiEntityActorTab {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Client scene entity view
|
||||
*/
|
||||
public static void drawInstancedActorView(boolean show, Entity detailViewEntity){
|
||||
if(show && ImGui.collapsingHeader("Instanced Actor Details")){
|
||||
ImGui.indent();
|
||||
float[] limbScalarFalloffFactor = new float[1];
|
||||
float[] minimumLimbScalar = new float[1];
|
||||
float[] maximumLimbDispersion = new float[1];
|
||||
float[] minimumLimbDispersion = new float[1];
|
||||
int[] minimumNumberForks = new int[1];
|
||||
int[] maximumNumberForks = new int[1];
|
||||
int[] maximumTrunkSegments = new int[1];
|
||||
int[] maximumBranchSegments = new int[1];
|
||||
float[] maxBranchSegmentFalloffFactor = new float[1];
|
||||
int[] minimumSegmentToSpawnLeaves = new int[1];
|
||||
float[] minBranchHeightToStartSpawningLeaves = new float[1];
|
||||
float[] maxBranchHeightToStartSpawningLeaves = new float[1];
|
||||
float[] leafIncrement = new float[1];
|
||||
int[] minLeavesToSpawnPerPoint = new int[1];
|
||||
int[] maxLeavesToSpawnPerPoint = new int[1];
|
||||
float[] leafDistanceFromCenter = new float[1];
|
||||
float[] peelVariance = new float[1];
|
||||
float[] peelMinimum = new float[1];
|
||||
float[] swaySigmoidFactor = new float[1];
|
||||
int[] minimumSwayTime = new int[1];
|
||||
int[] swayTimeVariance = new int[1];
|
||||
float[] yawVariance = new float[1];
|
||||
float[] yawMinimum = new float[1];
|
||||
float[] minimumScalarToGenerateSwayTree = new float[1];
|
||||
float[] maximumScalarToGenerateSwayTree = new float[1];
|
||||
if(detailViewEntity != null && InstancedActor.getInstancedActor(detailViewEntity) != null){
|
||||
// InstancedActor actor = InstancedActor.getInstancedActor(detailViewEntity);
|
||||
CommonEntityType commonEntityData = CommonEntityUtils.getCommonData(detailViewEntity);
|
||||
|
||||
//procedural model
|
||||
if(commonEntityData.getGraphicsTemplate().getProceduralModel() != null && ImGui.collapsingHeader("Procedural Model")){
|
||||
ProceduralModel proceduralModel = commonEntityData.getGraphicsTemplate().getProceduralModel();
|
||||
if(ImGui.button("Regenerate")){
|
||||
ImGuiEntityActorTab.regenerateModel(detailViewEntity,proceduralModel);
|
||||
}
|
||||
if(proceduralModel.getTreeModel() != null && ImGui.collapsingHeader("Tree Model")){
|
||||
TreeModel treeModel = proceduralModel.getTreeModel();
|
||||
|
||||
|
||||
if(ImGui.collapsingHeader("Trunk")){
|
||||
maximumTrunkSegments[0] = treeModel.getTrunkModel().getMaximumTrunkSegments();
|
||||
if(ImGui.sliderInt("maximumTrunkSegments", maximumTrunkSegments, 1, 8)){
|
||||
treeModel.getTrunkModel().setMaximumTrunkSegments(maximumTrunkSegments[0]);
|
||||
ImGuiEntityActorTab.regenerateModel(detailViewEntity,proceduralModel);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(ImGui.collapsingHeader("Branches")){
|
||||
ProceduralTreeBranchModel branchModel = treeModel.getBranchModel();
|
||||
limbScalarFalloffFactor[0] = branchModel.getLimbScalarFalloffFactor();
|
||||
if(ImGui.sliderFloat("limbScalarFalloffFactor", limbScalarFalloffFactor, 0.01f, 1f)){
|
||||
branchModel.setLimbScalarFalloffFactor(limbScalarFalloffFactor[0]);
|
||||
ImGuiEntityActorTab.regenerateModel(detailViewEntity,proceduralModel);
|
||||
}
|
||||
|
||||
minimumLimbScalar[0] = branchModel.getMinimumLimbScalar();
|
||||
if(ImGui.sliderFloat("minimumLimbScalar", minimumLimbScalar, 0.01f, 1f)){
|
||||
branchModel.setLimbScalarFalloffFactor(minimumLimbScalar[0]);
|
||||
ImGuiEntityActorTab.regenerateModel(detailViewEntity,proceduralModel);
|
||||
}
|
||||
|
||||
maximumLimbDispersion[0] = branchModel.getMaximumLimbDispersion();
|
||||
if(ImGui.sliderFloat("maximumLimbDispersion", maximumLimbDispersion, 0.01f, 1f)){
|
||||
branchModel.setMaximumLimbDispersion(maximumLimbDispersion[0]);
|
||||
ImGuiEntityActorTab.regenerateModel(detailViewEntity,proceduralModel);
|
||||
}
|
||||
|
||||
minimumLimbDispersion[0] = branchModel.getMinimumLimbDispersion();
|
||||
if(ImGui.sliderFloat("minimumLimbDispersion", minimumLimbDispersion, 0.01f, 1f)){
|
||||
branchModel.setMinimumLimbDispersion(minimumLimbDispersion[0]);
|
||||
ImGuiEntityActorTab.regenerateModel(detailViewEntity,proceduralModel);
|
||||
}
|
||||
|
||||
minimumNumberForks[0] = branchModel.getMinimumNumberForks();
|
||||
if(ImGui.sliderInt("minimumNumberForks", minimumNumberForks, 1, 8)){
|
||||
branchModel.setMinimumNumberForks(minimumNumberForks[0]);
|
||||
ImGuiEntityActorTab.regenerateModel(detailViewEntity,proceduralModel);
|
||||
}
|
||||
|
||||
maximumNumberForks[0] = branchModel.getMaximumNumberForks();
|
||||
if(ImGui.sliderInt("maximumNumberForks", maximumNumberForks, 1, 8)){
|
||||
branchModel.setMaximumNumberForks(maximumNumberForks[0]);
|
||||
ImGuiEntityActorTab.regenerateModel(detailViewEntity,proceduralModel);
|
||||
}
|
||||
|
||||
maximumBranchSegments[0] = branchModel.getMaximumBranchSegments();
|
||||
if(ImGui.sliderInt("maximumBranchSegments", maximumBranchSegments, 1, 8)){
|
||||
branchModel.setMaximumBranchSegments(maximumBranchSegments[0]);
|
||||
ImGuiEntityActorTab.regenerateModel(detailViewEntity,proceduralModel);
|
||||
}
|
||||
|
||||
maxBranchSegmentFalloffFactor[0] = branchModel.getMaxBranchSegmentFalloffFactor();
|
||||
if(ImGui.sliderFloat("maxBranchSegmentFalloffFactor", maxBranchSegmentFalloffFactor, 0.01f, 1f)){
|
||||
branchModel.setMaxBranchSegmentFalloffFactor(maxBranchSegmentFalloffFactor[0]);
|
||||
ImGuiEntityActorTab.regenerateModel(detailViewEntity,proceduralModel);
|
||||
}
|
||||
}
|
||||
|
||||
if(ImGui.collapsingHeader("Branch Sway")){
|
||||
peelVariance[0] = (float)treeModel.getPeelVariance();
|
||||
if(ImGui.sliderFloat("peelVariance", peelVariance, 0.01f, 3f)){
|
||||
treeModel.setPeelVariance(peelVariance[0]);
|
||||
ImGuiEntityActorTab.regenerateModel(detailViewEntity,proceduralModel);
|
||||
}
|
||||
|
||||
peelMinimum[0] = (float)treeModel.getPeelMinimum();
|
||||
if(ImGui.sliderFloat("peelMinimum", peelMinimum, 0.01f, 3f)){
|
||||
treeModel.setPeelMinimum(peelMinimum[0]);
|
||||
ImGuiEntityActorTab.regenerateModel(detailViewEntity,proceduralModel);
|
||||
}
|
||||
|
||||
swaySigmoidFactor[0] = (float)treeModel.getSwaySigmoidFactor();
|
||||
if(ImGui.sliderFloat("swaySigmoidFactor", swaySigmoidFactor, 0.01f, 3f)){
|
||||
treeModel.setSwaySigmoidFactor(swaySigmoidFactor[0]);
|
||||
ImGuiEntityActorTab.regenerateModel(detailViewEntity,proceduralModel);
|
||||
}
|
||||
|
||||
minimumSwayTime[0] = treeModel.getMinimumSwayTime();
|
||||
if(ImGui.sliderInt("minimumSwayTime", minimumSwayTime, 1, 1000)){
|
||||
treeModel.setMinimumSwayTime(minimumSwayTime[0]);
|
||||
ImGuiEntityActorTab.regenerateModel(detailViewEntity,proceduralModel);
|
||||
}
|
||||
|
||||
swayTimeVariance[0] = treeModel.getSwayTimeVariance();
|
||||
if(ImGui.sliderInt("swayTimeVariance", swayTimeVariance, 1, 1000)){
|
||||
treeModel.setSwayTimeVariance(swayTimeVariance[0]);
|
||||
ImGuiEntityActorTab.regenerateModel(detailViewEntity,proceduralModel);
|
||||
}
|
||||
|
||||
yawVariance[0] = (float)treeModel.getYawVariance();
|
||||
if(ImGui.sliderFloat("yawVariance", yawVariance, 0.01f, 3f)){
|
||||
treeModel.setYawVariance(yawVariance[0]);
|
||||
ImGuiEntityActorTab.regenerateModel(detailViewEntity,proceduralModel);
|
||||
}
|
||||
|
||||
yawMinimum[0] = (float)treeModel.getYawMinimum();
|
||||
if(ImGui.sliderFloat("yawMinimum", yawMinimum, 0.01f, 3f)){
|
||||
treeModel.setYawMinimum(yawMinimum[0]);
|
||||
ImGuiEntityActorTab.regenerateModel(detailViewEntity,proceduralModel);
|
||||
}
|
||||
|
||||
minimumScalarToGenerateSwayTree[0] = (float)treeModel.getMinimumScalarToGenerateSwayTree();
|
||||
if(ImGui.sliderFloat("minimumScalarToGenerateSwayTree", minimumScalarToGenerateSwayTree, 0.01f, 3f)){
|
||||
treeModel.setMinimumScalarToGenerateSwayTree(minimumScalarToGenerateSwayTree[0]);
|
||||
ImGuiEntityActorTab.regenerateModel(detailViewEntity,proceduralModel);
|
||||
}
|
||||
|
||||
maximumScalarToGenerateSwayTree[0] = (float)treeModel.getMaximumScalarToGenerateSwayTree();
|
||||
if(ImGui.sliderFloat("maximumScalarToGenerateSwayTree", maximumScalarToGenerateSwayTree, 0.01f, 3f)){
|
||||
treeModel.setMaximumScalarToGenerateSwayTree(maximumScalarToGenerateSwayTree[0]);
|
||||
ImGuiEntityActorTab.regenerateModel(detailViewEntity,proceduralModel);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if(ImGui.collapsingHeader("Leaves")){
|
||||
ProceduralTreeBranchModel branchModel = treeModel.getBranchModel();
|
||||
|
||||
minimumSegmentToSpawnLeaves[0] = branchModel.getMinimumSegmentToSpawnLeaves();
|
||||
if(ImGui.sliderInt("minimumSegmentToSpawnLeaves", minimumSegmentToSpawnLeaves, 1, 8)){
|
||||
branchModel.setMinimumSegmentToSpawnLeaves(minimumSegmentToSpawnLeaves[0]);
|
||||
ImGuiEntityActorTab.regenerateModel(detailViewEntity,proceduralModel);
|
||||
}
|
||||
|
||||
|
||||
minBranchHeightToStartSpawningLeaves[0] = treeModel.getMinBranchHeightToStartSpawningLeaves();
|
||||
if(ImGui.sliderFloat("minBranchHeightToStartSpawningLeaves", minBranchHeightToStartSpawningLeaves, 0.01f, 5f)){
|
||||
treeModel.setMinBranchHeightToStartSpawningLeaves(minBranchHeightToStartSpawningLeaves[0]);
|
||||
ImGuiEntityActorTab.regenerateModel(detailViewEntity,proceduralModel);
|
||||
}
|
||||
|
||||
|
||||
maxBranchHeightToStartSpawningLeaves[0] = treeModel.getMaxBranchHeightToStartSpawningLeaves();
|
||||
if(ImGui.sliderFloat("maxBranchHeightToStartSpawningLeaves", maxBranchHeightToStartSpawningLeaves, 0.01f, 5f)){
|
||||
treeModel.setMaxBranchHeightToStartSpawningLeaves(maxBranchHeightToStartSpawningLeaves[0]);
|
||||
ImGuiEntityActorTab.regenerateModel(detailViewEntity,proceduralModel);
|
||||
}
|
||||
|
||||
|
||||
leafIncrement[0] = treeModel.getLeafIncrement();
|
||||
if(ImGui.sliderFloat("leafIncrement", leafIncrement, 0.01f, 1f)){
|
||||
treeModel.setLeafIncrement(leafIncrement[0]);
|
||||
ImGuiEntityActorTab.regenerateModel(detailViewEntity,proceduralModel);
|
||||
}
|
||||
|
||||
minLeavesToSpawnPerPoint[0] = treeModel.getMinLeavesToSpawnPerPoint();
|
||||
if(ImGui.sliderInt("minLeavesToSpawnPerPoint", minLeavesToSpawnPerPoint, 1, 8)){
|
||||
treeModel.setMinLeavesToSpawnPerPoint(minLeavesToSpawnPerPoint[0]);
|
||||
ImGuiEntityActorTab.regenerateModel(detailViewEntity,proceduralModel);
|
||||
}
|
||||
|
||||
maxLeavesToSpawnPerPoint[0] = treeModel.getMaxLeavesToSpawnPerPoint();
|
||||
if(ImGui.sliderInt("maxLeavesToSpawnPerPoint", maxLeavesToSpawnPerPoint, 1, 8)){
|
||||
treeModel.setMaxLeavesToSpawnPerPoint(maxLeavesToSpawnPerPoint[0]);
|
||||
ImGuiEntityActorTab.regenerateModel(detailViewEntity,proceduralModel);
|
||||
}
|
||||
|
||||
leafDistanceFromCenter[0] = treeModel.getLeafDistanceFromCenter();
|
||||
if(ImGui.sliderFloat("leafDistanceFromCenter", leafDistanceFromCenter, 0.01f, 3f)){
|
||||
treeModel.setLeafDistanceFromCenter(leafDistanceFromCenter[0]);
|
||||
ImGuiEntityActorTab.regenerateModel(detailViewEntity,proceduralModel);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
ImGui.unindent();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Regenerates the procedural model for the entity
|
||||
* @param detailViewEntity The entity
|
||||
* @param proceduralModel The procedural model
|
||||
*/
|
||||
private static void regenerateModel(Entity detailViewEntity, ProceduralModel proceduralModel){
|
||||
if(proceduralModel.getTreeModel() != null){
|
||||
for(Entity child : AttachUtils.getChildrenList(detailViewEntity)){
|
||||
ClientEntityUtils.destroyEntity(child);
|
||||
}
|
||||
AttachUtils.getChildrenList(detailViewEntity).clear();
|
||||
ProceduralTree.setProceduralActor(
|
||||
detailViewEntity,
|
||||
proceduralModel.getTreeModel(),
|
||||
new Random()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,68 @@
|
||||
package electrosphere.client.ui.menu.debug.entity.tabs;
|
||||
|
||||
import electrosphere.data.common.CommonEntityType;
|
||||
import electrosphere.data.grident.GridAlignedData;
|
||||
import electrosphere.entity.Entity;
|
||||
import electrosphere.entity.types.common.CommonEntityUtils;
|
||||
import imgui.ImGui;
|
||||
|
||||
/**
|
||||
* Furniture data
|
||||
*/
|
||||
public class ImGuiEntityFurnitureTab {
|
||||
|
||||
/**
|
||||
* Minimum dimension for grid alignment
|
||||
*/
|
||||
static final int GRID_ALIGN_MIN = 1;
|
||||
|
||||
/**
|
||||
* Maximum dimension for grid alignment
|
||||
*/
|
||||
static final int GRID_ALIGN_MAX = 10;
|
||||
|
||||
/**
|
||||
* Holds width value
|
||||
*/
|
||||
static int[] widthHolder = new int[1];
|
||||
|
||||
/**
|
||||
* Holds height value
|
||||
*/
|
||||
static int[] heightHolder = new int[1];
|
||||
|
||||
/**
|
||||
* Holds length value
|
||||
*/
|
||||
static int[] lengthHolder = new int[1];
|
||||
|
||||
/**
|
||||
* Furniture data view
|
||||
*/
|
||||
public static void drawFurnitureTab(boolean show, Entity detailViewEntity){
|
||||
if(detailViewEntity == null){
|
||||
return;
|
||||
}
|
||||
if(CommonEntityUtils.getCommonData(detailViewEntity) == null){
|
||||
return;
|
||||
}
|
||||
CommonEntityType type = CommonEntityUtils.getCommonData(detailViewEntity);
|
||||
if(show && ImGui.collapsingHeader("Furniture Data")){
|
||||
ImGui.indent();
|
||||
if(type.getGridAlignedData() != null){
|
||||
GridAlignedData gridAlignedData = type.getGridAlignedData();
|
||||
if(ImGui.sliderInt("Width",widthHolder,GRID_ALIGN_MIN,GRID_ALIGN_MAX)){
|
||||
gridAlignedData.setWidth(widthHolder[0]);
|
||||
}
|
||||
if(ImGui.sliderInt("Height",heightHolder,GRID_ALIGN_MIN,GRID_ALIGN_MAX)){
|
||||
gridAlignedData.setHeight(heightHolder[0]);
|
||||
}
|
||||
if(ImGui.sliderInt("Length",lengthHolder,GRID_ALIGN_MIN,GRID_ALIGN_MAX)){
|
||||
gridAlignedData.setLength(lengthHolder[0]);
|
||||
}
|
||||
}
|
||||
ImGui.unindent();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,259 +0,0 @@
|
||||
package electrosphere.client.ui.menu.debug.entity.tabs;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import electrosphere.data.common.CommonEntityType;
|
||||
import electrosphere.data.foliage.ProceduralTreeBranchModel;
|
||||
import electrosphere.data.foliage.TreeModel;
|
||||
import electrosphere.data.graphics.ProceduralModel;
|
||||
import electrosphere.entity.ClientEntityUtils;
|
||||
import electrosphere.entity.Entity;
|
||||
import electrosphere.entity.state.attach.AttachUtils;
|
||||
import electrosphere.entity.types.common.CommonEntityUtils;
|
||||
import electrosphere.entity.types.tree.ProceduralTree;
|
||||
import electrosphere.renderer.actor.instance.InstancedActor;
|
||||
import imgui.ImGui;
|
||||
|
||||
/**
|
||||
* The actor tab on the entity detail view
|
||||
*/
|
||||
public class ImGuiEntityInstancedActorTab {
|
||||
|
||||
/**
|
||||
* Client scene entity view
|
||||
*/
|
||||
public static void drawInstancedActorView(boolean show, Entity detailViewEntity){
|
||||
if(show && ImGui.collapsingHeader("Instanced Actor Details")){
|
||||
ImGui.indent();
|
||||
float[] limbScalarFalloffFactor = new float[1];
|
||||
float[] minimumLimbScalar = new float[1];
|
||||
float[] maximumLimbDispersion = new float[1];
|
||||
float[] minimumLimbDispersion = new float[1];
|
||||
int[] minimumNumberForks = new int[1];
|
||||
int[] maximumNumberForks = new int[1];
|
||||
int[] maximumTrunkSegments = new int[1];
|
||||
int[] maximumBranchSegments = new int[1];
|
||||
float[] maxBranchSegmentFalloffFactor = new float[1];
|
||||
int[] minimumSegmentToSpawnLeaves = new int[1];
|
||||
float[] minBranchHeightToStartSpawningLeaves = new float[1];
|
||||
float[] maxBranchHeightToStartSpawningLeaves = new float[1];
|
||||
float[] leafIncrement = new float[1];
|
||||
int[] minLeavesToSpawnPerPoint = new int[1];
|
||||
int[] maxLeavesToSpawnPerPoint = new int[1];
|
||||
float[] leafDistanceFromCenter = new float[1];
|
||||
float[] peelVariance = new float[1];
|
||||
float[] peelMinimum = new float[1];
|
||||
float[] swaySigmoidFactor = new float[1];
|
||||
int[] minimumSwayTime = new int[1];
|
||||
int[] swayTimeVariance = new int[1];
|
||||
float[] yawVariance = new float[1];
|
||||
float[] yawMinimum = new float[1];
|
||||
float[] minimumScalarToGenerateSwayTree = new float[1];
|
||||
float[] maximumScalarToGenerateSwayTree = new float[1];
|
||||
if(detailViewEntity != null && InstancedActor.getInstancedActor(detailViewEntity) != null){
|
||||
// InstancedActor actor = InstancedActor.getInstancedActor(detailViewEntity);
|
||||
CommonEntityType commonEntityData = CommonEntityUtils.getCommonData(detailViewEntity);
|
||||
|
||||
//procedural model
|
||||
if(commonEntityData.getGraphicsTemplate().getProceduralModel() != null && ImGui.collapsingHeader("Procedural Model")){
|
||||
ProceduralModel proceduralModel = commonEntityData.getGraphicsTemplate().getProceduralModel();
|
||||
if(ImGui.button("Regenerate")){
|
||||
ImGuiEntityInstancedActorTab.regenerateModel(detailViewEntity,proceduralModel);
|
||||
}
|
||||
if(proceduralModel.getTreeModel() != null && ImGui.collapsingHeader("Tree Model")){
|
||||
TreeModel treeModel = proceduralModel.getTreeModel();
|
||||
|
||||
|
||||
if(ImGui.collapsingHeader("Trunk")){
|
||||
maximumTrunkSegments[0] = treeModel.getTrunkModel().getMaximumTrunkSegments();
|
||||
if(ImGui.sliderInt("maximumTrunkSegments", maximumTrunkSegments, 1, 8)){
|
||||
treeModel.getTrunkModel().setMaximumTrunkSegments(maximumTrunkSegments[0]);
|
||||
ImGuiEntityInstancedActorTab.regenerateModel(detailViewEntity,proceduralModel);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(ImGui.collapsingHeader("Branches")){
|
||||
ProceduralTreeBranchModel branchModel = treeModel.getBranchModel();
|
||||
limbScalarFalloffFactor[0] = branchModel.getLimbScalarFalloffFactor();
|
||||
if(ImGui.sliderFloat("limbScalarFalloffFactor", limbScalarFalloffFactor, 0.01f, 1f)){
|
||||
branchModel.setLimbScalarFalloffFactor(limbScalarFalloffFactor[0]);
|
||||
ImGuiEntityInstancedActorTab.regenerateModel(detailViewEntity,proceduralModel);
|
||||
}
|
||||
|
||||
minimumLimbScalar[0] = branchModel.getMinimumLimbScalar();
|
||||
if(ImGui.sliderFloat("minimumLimbScalar", minimumLimbScalar, 0.01f, 1f)){
|
||||
branchModel.setLimbScalarFalloffFactor(minimumLimbScalar[0]);
|
||||
ImGuiEntityInstancedActorTab.regenerateModel(detailViewEntity,proceduralModel);
|
||||
}
|
||||
|
||||
maximumLimbDispersion[0] = branchModel.getMaximumLimbDispersion();
|
||||
if(ImGui.sliderFloat("maximumLimbDispersion", maximumLimbDispersion, 0.01f, 1f)){
|
||||
branchModel.setMaximumLimbDispersion(maximumLimbDispersion[0]);
|
||||
ImGuiEntityInstancedActorTab.regenerateModel(detailViewEntity,proceduralModel);
|
||||
}
|
||||
|
||||
minimumLimbDispersion[0] = branchModel.getMinimumLimbDispersion();
|
||||
if(ImGui.sliderFloat("minimumLimbDispersion", minimumLimbDispersion, 0.01f, 1f)){
|
||||
branchModel.setMinimumLimbDispersion(minimumLimbDispersion[0]);
|
||||
ImGuiEntityInstancedActorTab.regenerateModel(detailViewEntity,proceduralModel);
|
||||
}
|
||||
|
||||
minimumNumberForks[0] = branchModel.getMinimumNumberForks();
|
||||
if(ImGui.sliderInt("minimumNumberForks", minimumNumberForks, 1, 8)){
|
||||
branchModel.setMinimumNumberForks(minimumNumberForks[0]);
|
||||
ImGuiEntityInstancedActorTab.regenerateModel(detailViewEntity,proceduralModel);
|
||||
}
|
||||
|
||||
maximumNumberForks[0] = branchModel.getMaximumNumberForks();
|
||||
if(ImGui.sliderInt("maximumNumberForks", maximumNumberForks, 1, 8)){
|
||||
branchModel.setMaximumNumberForks(maximumNumberForks[0]);
|
||||
ImGuiEntityInstancedActorTab.regenerateModel(detailViewEntity,proceduralModel);
|
||||
}
|
||||
|
||||
maximumBranchSegments[0] = branchModel.getMaximumBranchSegments();
|
||||
if(ImGui.sliderInt("maximumBranchSegments", maximumBranchSegments, 1, 8)){
|
||||
branchModel.setMaximumBranchSegments(maximumBranchSegments[0]);
|
||||
ImGuiEntityInstancedActorTab.regenerateModel(detailViewEntity,proceduralModel);
|
||||
}
|
||||
|
||||
maxBranchSegmentFalloffFactor[0] = branchModel.getMaxBranchSegmentFalloffFactor();
|
||||
if(ImGui.sliderFloat("maxBranchSegmentFalloffFactor", maxBranchSegmentFalloffFactor, 0.01f, 1f)){
|
||||
branchModel.setMaxBranchSegmentFalloffFactor(maxBranchSegmentFalloffFactor[0]);
|
||||
ImGuiEntityInstancedActorTab.regenerateModel(detailViewEntity,proceduralModel);
|
||||
}
|
||||
}
|
||||
|
||||
if(ImGui.collapsingHeader("Branch Sway")){
|
||||
peelVariance[0] = (float)treeModel.getPeelVariance();
|
||||
if(ImGui.sliderFloat("peelVariance", peelVariance, 0.01f, 3f)){
|
||||
treeModel.setPeelVariance(peelVariance[0]);
|
||||
ImGuiEntityInstancedActorTab.regenerateModel(detailViewEntity,proceduralModel);
|
||||
}
|
||||
|
||||
peelMinimum[0] = (float)treeModel.getPeelMinimum();
|
||||
if(ImGui.sliderFloat("peelMinimum", peelMinimum, 0.01f, 3f)){
|
||||
treeModel.setPeelMinimum(peelMinimum[0]);
|
||||
ImGuiEntityInstancedActorTab.regenerateModel(detailViewEntity,proceduralModel);
|
||||
}
|
||||
|
||||
swaySigmoidFactor[0] = (float)treeModel.getSwaySigmoidFactor();
|
||||
if(ImGui.sliderFloat("swaySigmoidFactor", swaySigmoidFactor, 0.01f, 3f)){
|
||||
treeModel.setSwaySigmoidFactor(swaySigmoidFactor[0]);
|
||||
ImGuiEntityInstancedActorTab.regenerateModel(detailViewEntity,proceduralModel);
|
||||
}
|
||||
|
||||
minimumSwayTime[0] = treeModel.getMinimumSwayTime();
|
||||
if(ImGui.sliderInt("minimumSwayTime", minimumSwayTime, 1, 1000)){
|
||||
treeModel.setMinimumSwayTime(minimumSwayTime[0]);
|
||||
ImGuiEntityInstancedActorTab.regenerateModel(detailViewEntity,proceduralModel);
|
||||
}
|
||||
|
||||
swayTimeVariance[0] = treeModel.getSwayTimeVariance();
|
||||
if(ImGui.sliderInt("swayTimeVariance", swayTimeVariance, 1, 1000)){
|
||||
treeModel.setSwayTimeVariance(swayTimeVariance[0]);
|
||||
ImGuiEntityInstancedActorTab.regenerateModel(detailViewEntity,proceduralModel);
|
||||
}
|
||||
|
||||
yawVariance[0] = (float)treeModel.getYawVariance();
|
||||
if(ImGui.sliderFloat("yawVariance", yawVariance, 0.01f, 3f)){
|
||||
treeModel.setYawVariance(yawVariance[0]);
|
||||
ImGuiEntityInstancedActorTab.regenerateModel(detailViewEntity,proceduralModel);
|
||||
}
|
||||
|
||||
yawMinimum[0] = (float)treeModel.getYawMinimum();
|
||||
if(ImGui.sliderFloat("yawMinimum", yawMinimum, 0.01f, 3f)){
|
||||
treeModel.setYawMinimum(yawMinimum[0]);
|
||||
ImGuiEntityInstancedActorTab.regenerateModel(detailViewEntity,proceduralModel);
|
||||
}
|
||||
|
||||
minimumScalarToGenerateSwayTree[0] = (float)treeModel.getMinimumScalarToGenerateSwayTree();
|
||||
if(ImGui.sliderFloat("minimumScalarToGenerateSwayTree", minimumScalarToGenerateSwayTree, 0.01f, 3f)){
|
||||
treeModel.setMinimumScalarToGenerateSwayTree(minimumScalarToGenerateSwayTree[0]);
|
||||
ImGuiEntityInstancedActorTab.regenerateModel(detailViewEntity,proceduralModel);
|
||||
}
|
||||
|
||||
maximumScalarToGenerateSwayTree[0] = (float)treeModel.getMaximumScalarToGenerateSwayTree();
|
||||
if(ImGui.sliderFloat("maximumScalarToGenerateSwayTree", maximumScalarToGenerateSwayTree, 0.01f, 3f)){
|
||||
treeModel.setMaximumScalarToGenerateSwayTree(maximumScalarToGenerateSwayTree[0]);
|
||||
ImGuiEntityInstancedActorTab.regenerateModel(detailViewEntity,proceduralModel);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if(ImGui.collapsingHeader("Leaves")){
|
||||
ProceduralTreeBranchModel branchModel = treeModel.getBranchModel();
|
||||
|
||||
minimumSegmentToSpawnLeaves[0] = branchModel.getMinimumSegmentToSpawnLeaves();
|
||||
if(ImGui.sliderInt("minimumSegmentToSpawnLeaves", minimumSegmentToSpawnLeaves, 1, 8)){
|
||||
branchModel.setMinimumSegmentToSpawnLeaves(minimumSegmentToSpawnLeaves[0]);
|
||||
ImGuiEntityInstancedActorTab.regenerateModel(detailViewEntity,proceduralModel);
|
||||
}
|
||||
|
||||
|
||||
minBranchHeightToStartSpawningLeaves[0] = treeModel.getMinBranchHeightToStartSpawningLeaves();
|
||||
if(ImGui.sliderFloat("minBranchHeightToStartSpawningLeaves", minBranchHeightToStartSpawningLeaves, 0.01f, 5f)){
|
||||
treeModel.setMinBranchHeightToStartSpawningLeaves(minBranchHeightToStartSpawningLeaves[0]);
|
||||
ImGuiEntityInstancedActorTab.regenerateModel(detailViewEntity,proceduralModel);
|
||||
}
|
||||
|
||||
|
||||
maxBranchHeightToStartSpawningLeaves[0] = treeModel.getMaxBranchHeightToStartSpawningLeaves();
|
||||
if(ImGui.sliderFloat("maxBranchHeightToStartSpawningLeaves", maxBranchHeightToStartSpawningLeaves, 0.01f, 5f)){
|
||||
treeModel.setMaxBranchHeightToStartSpawningLeaves(maxBranchHeightToStartSpawningLeaves[0]);
|
||||
ImGuiEntityInstancedActorTab.regenerateModel(detailViewEntity,proceduralModel);
|
||||
}
|
||||
|
||||
|
||||
leafIncrement[0] = treeModel.getLeafIncrement();
|
||||
if(ImGui.sliderFloat("leafIncrement", leafIncrement, 0.01f, 1f)){
|
||||
treeModel.setLeafIncrement(leafIncrement[0]);
|
||||
ImGuiEntityInstancedActorTab.regenerateModel(detailViewEntity,proceduralModel);
|
||||
}
|
||||
|
||||
minLeavesToSpawnPerPoint[0] = treeModel.getMinLeavesToSpawnPerPoint();
|
||||
if(ImGui.sliderInt("minLeavesToSpawnPerPoint", minLeavesToSpawnPerPoint, 1, 8)){
|
||||
treeModel.setMinLeavesToSpawnPerPoint(minLeavesToSpawnPerPoint[0]);
|
||||
ImGuiEntityInstancedActorTab.regenerateModel(detailViewEntity,proceduralModel);
|
||||
}
|
||||
|
||||
maxLeavesToSpawnPerPoint[0] = treeModel.getMaxLeavesToSpawnPerPoint();
|
||||
if(ImGui.sliderInt("maxLeavesToSpawnPerPoint", maxLeavesToSpawnPerPoint, 1, 8)){
|
||||
treeModel.setMaxLeavesToSpawnPerPoint(maxLeavesToSpawnPerPoint[0]);
|
||||
ImGuiEntityInstancedActorTab.regenerateModel(detailViewEntity,proceduralModel);
|
||||
}
|
||||
|
||||
leafDistanceFromCenter[0] = treeModel.getLeafDistanceFromCenter();
|
||||
if(ImGui.sliderFloat("leafDistanceFromCenter", leafDistanceFromCenter, 0.01f, 3f)){
|
||||
treeModel.setLeafDistanceFromCenter(leafDistanceFromCenter[0]);
|
||||
ImGuiEntityInstancedActorTab.regenerateModel(detailViewEntity,proceduralModel);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
ImGui.unindent();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Regenerates the procedural model for the entity
|
||||
* @param detailViewEntity The entity
|
||||
* @param proceduralModel The procedural model
|
||||
*/
|
||||
private static void regenerateModel(Entity detailViewEntity, ProceduralModel proceduralModel){
|
||||
if(proceduralModel.getTreeModel() != null){
|
||||
for(Entity child : AttachUtils.getChildrenList(detailViewEntity)){
|
||||
ClientEntityUtils.destroyEntity(child);
|
||||
}
|
||||
AttachUtils.getChildrenList(detailViewEntity).clear();
|
||||
ProceduralTree.setProceduralActor(
|
||||
detailViewEntity,
|
||||
proceduralModel.getTreeModel(),
|
||||
new Random()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,6 +1,7 @@
|
||||
package electrosphere.client.ui.menu.debug.entity.tabs;
|
||||
|
||||
import electrosphere.entity.Entity;
|
||||
import electrosphere.entity.state.equip.ClientToolbarState;
|
||||
import electrosphere.entity.state.inventory.InventoryUtils;
|
||||
import electrosphere.entity.state.inventory.UnrelationalInventoryState;
|
||||
import electrosphere.entity.types.item.ItemUtils;
|
||||
@ -32,4 +33,19 @@ public class ImGuiEntityInventoryTab {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Client scene entity view
|
||||
*/
|
||||
public static void drawToolbarTab(boolean show, Entity detailViewEntity){
|
||||
if(show && ImGui.collapsingHeader("Toolbar Data")){
|
||||
ClientToolbarState clientToolbarState = ClientToolbarState.getClientToolbarState(detailViewEntity);
|
||||
ImGui.indent();
|
||||
if(detailViewEntity != null && clientToolbarState != null){
|
||||
ImGui.text("Selected slot: " + clientToolbarState.getSelectedSlot());
|
||||
ImGui.text("Selected item: " + clientToolbarState.getCurrentPrimaryItem());
|
||||
}
|
||||
ImGui.unindent();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,27 +0,0 @@
|
||||
package electrosphere.client.ui.menu.debug.entity.tabs;
|
||||
|
||||
import electrosphere.entity.Entity;
|
||||
import electrosphere.entity.state.equip.ClientToolbarState;
|
||||
import imgui.ImGui;
|
||||
|
||||
/**
|
||||
* Debug menu for toolbar state
|
||||
*/
|
||||
public class ImGuiEntityToolbarTab {
|
||||
|
||||
/**
|
||||
* Client scene entity view
|
||||
*/
|
||||
public static void drawToolbarTab(boolean show, Entity detailViewEntity){
|
||||
if(show && ImGui.collapsingHeader("Toolbar Data")){
|
||||
ClientToolbarState clientToolbarState = ClientToolbarState.getClientToolbarState(detailViewEntity);
|
||||
ImGui.indent();
|
||||
if(detailViewEntity != null && clientToolbarState != null){
|
||||
ImGui.text("Selected slot: " + clientToolbarState.getSelectedSlot());
|
||||
ImGui.text("Selected item: " + clientToolbarState.getCurrentPrimaryItem());
|
||||
}
|
||||
ImGui.unindent();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -44,4 +44,30 @@ public class GridAlignedData {
|
||||
return height;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the width of the grid alignment data
|
||||
* @param width The width
|
||||
*/
|
||||
public void setWidth(Integer width) {
|
||||
this.width = width;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the length of the grid alignment data
|
||||
* @param length The length
|
||||
*/
|
||||
public void setLength(Integer length) {
|
||||
this.length = length;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the height of the grid alignment data
|
||||
* @param height The height
|
||||
*/
|
||||
public void setHeight(Integer height) {
|
||||
this.height = height;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -251,7 +251,7 @@ public class DebugContentPipeline implements RenderPipeline {
|
||||
}
|
||||
Vector3d position = EntityUtils.getPosition(entity);
|
||||
//calculate camera-modified vector3d
|
||||
Vector3d cameraModifiedPosition = new Vector3d(position).add(0,gridAlignedData.getLength() * BlockChunkData.BLOCK_SIZE_MULTIPLIER / 2.0f,0).sub(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
|
||||
Vector3d cameraModifiedPosition = new Vector3d(position).add(0,gridAlignedData.getHeight() * BlockChunkData.BLOCK_SIZE_MULTIPLIER / 2.0f,0).sub(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
|
||||
modelTransformMatrix.identity();
|
||||
modelTransformMatrix.translate(cameraModifiedPosition);
|
||||
modelTransformMatrix.rotate(EntityUtils.getRotation(entity));
|
||||
|
||||
Loading…
Reference in New Issue
Block a user