Compare commits

..

No commits in common. "9dc6235e4a45d0e5dfa99152e6cddd8a1d4ef982" and "0961b42e26e27eb20b9796bf16302e086a252227" have entirely different histories.

14 changed files with 14 additions and 145 deletions

View File

@ -1304,11 +1304,6 @@ Disable client fluid draw cell loading gate
Properly differentiate local/world bone attach point calculation
Floating origin implementation for collision engine
Improve initial asset loading performance
PoseModel creation for basic shape types
Procedural block item types
(01/25/2025)
Update flush method in tests to account for faster loading

View File

@ -165,7 +165,7 @@ public class ClientFluidManager {
lock.lock();
for(FluidChunkGenQueueItem queueItem : fluidChunkGenerationQueue){
Model fluidModel = FluidChunkModelGeneration.generateFluidModel(queueItem.getData());
Globals.assetManager.registerModelWithPath(fluidModel, queueItem.getPromisedHash());
Globals.assetManager.registerModelToSpecificString(fluidModel, queueItem.getPromisedHash());
}
fluidChunkGenerationQueue.clear();
lock.unlock();

View File

@ -353,7 +353,7 @@ public class ClientTerrainManager {
lock.acquireUninterruptibly();
for(TerrainChunkGenQueueItem queueItem : terrainChunkGenerationQueue){
Model terrainModel = TransvoxelModelGeneration.generateTerrainModel(queueItem.getData(), queueItem.getAtlas());
Globals.assetManager.registerModelWithPath(terrainModel, queueItem.getPromisedHash());
Globals.assetManager.registerModelToSpecificString(terrainModel, queueItem.getPromisedHash());
if(queueItem.notifyTarget != null){
queueItem.notifyTarget.alertToGeneration();
}

View File

@ -83,7 +83,6 @@ import electrosphere.server.datacell.EntityDataCellMapper;
import electrosphere.server.datacell.RealmManager;
import electrosphere.server.db.DatabaseController;
import electrosphere.server.pathfinding.NavMeshManager;
import electrosphere.server.poseactor.PoseModel;
import electrosphere.server.saves.Save;
import electrosphere.server.simulation.MacroSimulation;
import electrosphere.server.simulation.MicroSimulation;
@ -643,9 +642,9 @@ public class Globals {
//create font manager
fontManager = new FontManager();
fontManager.loadFonts();
assetManager.registerModelWithPath(RenderUtils.createBitmapCharacter(), AssetDataStrings.BITMAP_CHARACTER_MODEL);
assetManager.registerModelToSpecificString(RenderUtils.createBitmapCharacter(), AssetDataStrings.BITMAP_CHARACTER_MODEL);
//particle billboard model
assetManager.registerModelWithPath(RenderUtils.createParticleModel(), AssetDataStrings.MODEL_PARTICLE);
assetManager.registerModelToSpecificString(RenderUtils.createParticleModel(), AssetDataStrings.MODEL_PARTICLE);
//initialize required windows
WindowUtils.initBaseWindows();
//init default shaderProgram
@ -656,9 +655,9 @@ public class Globals {
//init fluid shader program
FluidChunkModelGeneration.fluidChunkShaderProgram = VisualShader.loadSpecificShader("/Shaders/entities/fluid2/fluid2.vs", "/Shaders/entities/fluid2/fluid2.fs");
//init models
assetManager.registerModelWithPath(RenderUtils.createUnitsphere(), AssetDataStrings.UNITSPHERE);
assetManager.registerModelWithPath(RenderUtils.createUnitCylinder(), AssetDataStrings.UNITCYLINDER);
assetManager.registerModelWithPath(RenderUtils.createUnitCube(), AssetDataStrings.UNITCUBE);
assetManager.registerModelToSpecificString(RenderUtils.createUnitsphere(), AssetDataStrings.UNITSPHERE);
assetManager.registerModelToSpecificString(RenderUtils.createUnitCylinder(), AssetDataStrings.UNITCYLINDER);
assetManager.registerModelToSpecificString(RenderUtils.createUnitCube(), AssetDataStrings.UNITCUBE);
assetManager.addModelPathToQueue("Models/basic/geometry/SmallCube.fbx");
assetManager.addModelPathToQueue("Models/basic/geometry/unitcapsule.glb");
assetManager.addModelPathToQueue("Models/basic/geometry/unitplane.fbx");
@ -667,13 +666,6 @@ public class Globals {
assetManager.addShaderToQueue("Shaders/core/plane/plane.vs", "Shaders/core/plane/plane.fs");
solidPlaneModelID = assetManager.registerModel(RenderUtils.createInWindowPanel("Shaders/ui/plainBox/plainBox.vs", "Shaders/ui/plainBox/plainBox.fs"));
//init pose models for basic shapes
PoseModel emptyPoseModel = PoseModel.createEmpty();
assetManager.registerPoseModelWithPath(emptyPoseModel, AssetDataStrings.POSE_EMPTY);
assetManager.registerPoseModelWithPath(emptyPoseModel, AssetDataStrings.UNITSPHERE);
assetManager.registerPoseModelWithPath(emptyPoseModel, AssetDataStrings.UNITCYLINDER);
assetManager.registerPoseModelWithPath(emptyPoseModel, AssetDataStrings.UNITCUBE);
//image panel
ImagePanel.imagePanelModelPath = assetManager.registerModel(RenderUtils.createPlaneModel("Shaders/core/imagepanel/imagepanel.vs", "Shaders/core/imagepanel/imagepanel.fs"));

View File

@ -23,7 +23,6 @@ public class AssetDataStrings {
public static final String UNITCUBE = "unitCube";
public static final String MODEL_PARTICLE = "particleModel";
public static final String TEXTURE_PARTICLE = "particleTexture";
public static final String POSE_EMPTY = "poseEmpty";
/**
* UI textures

View File

@ -265,6 +265,10 @@ public class AssetManager {
modelsLoadedIntoMemory.put(path, m);
}
public void registerModelToSpecificString(Model m, String s){
modelsLoadedIntoMemory.put(s,m);
}
public void deregisterModelPath(String path){
modelsLoadedIntoMemory.remove(path);
}
@ -338,16 +342,6 @@ public class AssetManager {
return rVal;
}
/**
* Registers a (presumably generated in code) pose model to a given path in the asset manager
* Used particularly if you have a specific path you want to relate to a specific pose model (eg basic shapes)
* @param m The pose model to register
* @param path The path to register the pose model to
*/
public void registerPoseModelWithPath(PoseModel m, String path){
poseModelsLoadedIntoMemory.put(path, m);
}

View File

@ -102,9 +102,8 @@ public class Config {
config.biomeMap = BiomeTypeMap.loadBiomeFile("Data/game/biomes.json");
config.samplerDefinitions = SamplerFile.readSamplerDefinitionFiles("Data/game/voxel");
//create procedural item types
//create furniture items
ItemDataMap.loadSpawnItems(config.itemMap, config.objectTypeLoader);
ItemDataMap.generateBlockItems(config.itemMap, config.blockData);
//validate
ConfigValidator.valdiate(config);

View File

@ -2,12 +2,8 @@ package electrosphere.game.data.item;
import java.util.Arrays;
import electrosphere.engine.assetmanager.AssetDataStrings;
import electrosphere.game.data.block.BlockType;
import electrosphere.game.data.common.CommonEntityType;
import electrosphere.game.data.common.item.SpawnItemDescription;
import electrosphere.game.data.graphics.GraphicsTemplate;
import electrosphere.game.data.graphics.NonproceduralModel;
/**
* Data on a given item
@ -88,7 +84,7 @@ public class Item extends CommonEntityType {
if(description.getGraphicsTemplate() != null){
rVal.setGraphicsTemplate(description.getGraphicsTemplate());
} else {
throw new Error("Need to implement handling for when no graphics template is provided!");
throw new Error("Need to implement handling for when no graphics template is providedd!");
}
@ -104,42 +100,6 @@ public class Item extends CommonEntityType {
return rVal;
}
/**
* Creates item data from a block type
* @param description The block type
* @return The item data
*/
public static Item createBlockItem(BlockType blockType){
Item rVal = new Item();
rVal.setId(blockType.getName());
if(blockType.getTexture() != null){
rVal.iconPath = blockType.getTexture();
} else {
rVal.iconPath = Item.DEFAULT_ITEM_ICON_PATH;
}
NonproceduralModel modelData = new NonproceduralModel();
modelData.setPath(AssetDataStrings.UNITCUBE);
GraphicsTemplate blockItemGraphicsTemplate = new GraphicsTemplate();
blockItemGraphicsTemplate.setModel(modelData);
rVal.setGraphicsTemplate(blockItemGraphicsTemplate);
//set usage
ItemUsage usage = new ItemUsage();
usage.setBlockId(blockType.getId());
rVal.setSecondaryUsage(usage);
//attach common tokens
rVal.setTokens(Arrays.asList(DEFAULT_TOKENS));
return rVal;
}
/**
* the idle animation for the item
* @return

View File

@ -9,8 +9,6 @@ import java.util.Set;
import electrosphere.entity.Entity;
import electrosphere.entity.types.item.ItemUtils;
import electrosphere.game.data.block.BlockData;
import electrosphere.game.data.block.BlockType;
import electrosphere.game.data.common.CommonEntityMap;
import electrosphere.game.data.common.CommonEntityType;
import electrosphere.util.FileUtils;
@ -132,17 +130,4 @@ public class ItemDataMap {
}
}
/**
* Loads all block types as items
* @param itemDataMap The item data map
* @param blockData The data on all block types
*/
public static void generateBlockItems(ItemDataMap itemDataMap, BlockData blockData){
for(BlockType blockType : blockData.getTypes()){
Item spawnItem = Item.createBlockItem(blockType);
//create spawn items
itemDataMap.putType(spawnItem.getId(), spawnItem);
}
}
}

View File

@ -10,11 +10,6 @@ public class ItemUsage {
*/
String spawnEntityId;
/**
* If defined, this item will place the block type on use
*/
Integer blockId;
/**
* Gets the spawn entity id of the item usage
* @return The spawn entity id
@ -31,24 +26,6 @@ public class ItemUsage {
this.spawnEntityId = spawnEntityId;
}
/**
* Gets the block type id of the item usage
* @return The block type id
*/
public Integer getBlockId() {
return blockId;
}
/**
* Sets the block type id of the item usage
* @param spawnEntityId The block type id
*/
public void setBlockId(Integer blockId) {
this.blockId = blockId;
}
}

View File

@ -13,7 +13,6 @@ import electrosphere.game.data.creature.type.CreatureData;
import electrosphere.game.data.creature.type.block.BlockVariant;
import electrosphere.game.data.item.Item;
import electrosphere.game.data.item.ItemUsage;
import electrosphere.logger.LoggerInterface;
import electrosphere.net.parser.net.message.InventoryMessage;
import electrosphere.net.server.ServerConnectionHandler;
import electrosphere.server.datacell.Realm;
@ -87,10 +86,6 @@ public class PlayerActions {
Vector3d spawnPos = new Vector3d(message.getviewTargetX(),message.getviewTargetY(),message.getviewTargetZ());
CommonEntityUtils.serverSpawnBasicObject(playerRealm, spawnPos, secondaryUsage.getSpawnEntityId());
}
if(secondaryUsage.getBlockId() != null){
Vector3d spawnPos = new Vector3d(message.getviewTargetX(),message.getviewTargetY(),message.getviewTargetZ());
LoggerInterface.loggerEngine.WARNING("Spawn block type " + secondaryUsage.getBlockId() + " at " + spawnPos);
}
}

View File

@ -40,12 +40,6 @@ public class PoseModel {
Map<String, Animation> animMap;
/**
* Private constructor for static creation methods
*/
private PoseModel(){
}
/**
* Constructor
* @param path Path on disk to this posemodel
@ -110,21 +104,6 @@ public class PoseModel {
}
}
/**
* Constructor
* @param path Path on disk to this posemodel
* @param scene The AI Scene parsed from the file on disk
*/
public static PoseModel createEmpty(){
PoseModel rVal = new PoseModel();
rVal.bones = new ArrayList<Bone>();
rVal.boneMap = new HashMap<String, Bone>();
rVal.nodeMap = new HashMap<String, AnimNode>();
rVal.animations = new ArrayList<Animation>();
rVal.animMap = new HashMap<String, Animation>();
return rVal;
}
/**
* Applies an animation to a certain set of bones

View File

@ -16,11 +16,6 @@ public class EngineInit {
//The maximum number of frames to wait before failing the startup routine
public static final int MAX_FRAMES_TO_WAIT = 100;
/**
* Max time in milliseconds to wait while flushing
*/
public static final int MAX_TIME_TO_WAIT = 3000;
/**
* Initializes the engine
*/

View File

@ -95,7 +95,6 @@ public class TestEngineUtils {
//
//wait for client to be fully init'd
int frames = 0;
long startTime = System.currentTimeMillis();
while(Globals.threadManager.isLoading()){
TestEngineUtils.simulateFrames(1);
try {
@ -104,7 +103,7 @@ public class TestEngineUtils {
e.printStackTrace();
}
frames++;
if(frames > EngineInit.MAX_FRAMES_TO_WAIT && System.currentTimeMillis() - startTime > EngineInit.MAX_TIME_TO_WAIT){
if(frames > EngineInit.MAX_FRAMES_TO_WAIT){
String errorMessage = "Failed to setup connected test scene!\n" +
"Still running threads are:\n"
;