[DEV] add basic voxel example ==> display only 1 chunk ==> need to upgrade it ...

This commit is contained in:
Edouard DUPIN 2020-05-21 13:09:34 +02:00
parent 2aee7077a9
commit 8afc38178a
417 changed files with 2029 additions and 42 deletions

View File

@ -8,12 +8,13 @@ import org.atriaSoft.gale.Log;
import org.atriaSoft.gale.context.Context;
public abstract class Resource {
protected static String NO_NAME_RESOURCE = "---";
protected static int MAXRESOURCELEVEL = 5;
private static int idGenerated = 10;
protected long uid = -1; //!< unique ID definition
protected int count = 1;
protected int resourceLevel = MAXRESOURCELEVEL-1; //!< Level of the resource ==> for update priority [0..5] 0 must be update first.
protected String name; //!< name of the resource ...
protected String name = NO_NAME_RESOURCE; //!< name of the resource ...
protected boolean resourceHasBeenInit = false; //!< Know if the init function has bben called
protected List<String> listType = new ArrayList<String>();
/**

View File

@ -161,10 +161,18 @@ public class ResourceManager {
public Resource localKeep(String filename) {
Log.verbose("KEEP (DEFAULT) : file : '" + filename + "' in " + this.resourceList.size() + " resources");
for (Resource it : this.resourceList) {
if (it != null) {
if (it.getName() == filename) {
return it;
}
if (it == null) {
continue;
}
if (it.getName() == null) {
continue;
}
//Log.verbose("compare : " + filename + " ==???== " + it.getName());
if (it.getName().contentEquals(Resource.NO_NAME_RESOURCE)) {
continue;
}
if (it.getName().contentEquals(filename)) {
return it;
}
}
return null;

View File

@ -176,7 +176,7 @@ public class ResourceTexture extends Resource {
}
GL13.glActiveTexture(textureIdBinding[idTexture]);
GL11.glBindTexture(GL11.GL_TEXTURE_2D, this.texId);
if (dataColorSpace == TextureColorMode.rgba) {
if (dataColorSpace == TextureColorMode.rgb) {
OpenGL.enable(OpenGL.Flag.flag_cullFace);
OpenGL.enable(OpenGL.Flag.flag_back);
}
@ -185,7 +185,7 @@ public class ResourceTexture extends Resource {
if (this.loaded == false) {
return;
}
if (dataColorSpace == TextureColorMode.rgba) {
if (dataColorSpace == TextureColorMode.rgb) {
OpenGL.disable(OpenGL.Flag.flag_cullFace);
OpenGL.disable(OpenGL.Flag.flag_back);
}

View File

@ -17,6 +17,7 @@ import org.atriaSoft.gale.key.KeyType;
import org.atriaSoft.gameEngine.camera.Camera;
import org.atriaSoft.gameEngine.engines.EngineRender;
import org.atriaSoft.gameEngine.engines.EngineAI;
import org.atriaSoft.gameEngine.engines.EngineDynamicMeshs;
import org.atriaSoft.gameEngine.engines.EngineLight;
import org.atriaSoft.gameEngine.engines.EngineParticle;
import org.atriaSoft.gameEngine.engines.EnginePhysics;
@ -26,7 +27,7 @@ public class Environement {
public Signal<Float> signalPlayTimeChange = new Signal<Float>();
private GameStatus propertyStatus = GameStatus.gameStop; // !< the display is running (not in pause)
public float propertyRatio = 1.0f; // !< Speed ratio
protected List<Engine> engine = new ArrayList<Engine>(); // !< EGE sub engine interface (like physique, rendering,
protected List<Engine> engines = new ArrayList<Engine>(); // !< EGE sub engine interface (like physique, rendering,
// audio, ...).
private List<Entity> listEntity = new ArrayList<Entity>(); // !< List of all entity added in the Game
List<ControlInterface> controls = new ArrayList<ControlInterface>();
@ -42,6 +43,7 @@ public class Environement {
// we add the 4 classical engines (the order is used to the global rendering cycle ...
addEngine(new EnginePhysics(this));
addEngine(new EngineAI(this));
addEngine(new EngineDynamicMeshs(this));
addEngine(new EngineRender(this));
addEngine(new EngineParticle(this));
addEngine(new EngineLight(this));
@ -81,31 +83,31 @@ public class Environement {
return;
}
// check if not exist
for (Engine it : engine) {
for (Engine it : engines) {
if (it.getType().contains(ref.getType())) {
it = ref;
return;
}
}
// add it at the end ...
engine.add(ref);
engines.add(ref);
}
public void rmEngine(Engine ref) {
engine.remove(ref);
engines.remove(ref);
}
public void rmEngine(String type) {
for (Engine it : engine) {
for (Engine it : engines) {
if (it.getType().contains(type)) {
engine.remove(it);
engines.remove(it);
return;
}
}
}
public Engine getEngine(String type) {
for (Engine it : engine) {
for (Engine it : engines) {
if (it.getType().contains(type)) {
return it;
}
@ -115,7 +117,7 @@ public class Environement {
}
public void engineComponentRemove(Component ref) {
for (Engine it: engine) {
for (Engine it: engines) {
if (it.getType().contentEquals(ref.getType())) {
it.componentRemove(ref);
return;
@ -124,7 +126,7 @@ public class Environement {
}
public void engineComponentAdd(Component ref) {
for (Engine it: engine) {
for (Engine it: engines) {
if (it.getType().contentEquals(ref.getType())) {
it.componentAdd(ref);
return;
@ -140,7 +142,7 @@ public class Environement {
return;
}
OpenGL.setCameraMatrix(camera.getConvertionMatrix());
for (Engine it: engine) {
for (Engine it: engines) {
//Log.verbose(" render: " + it.getType());
it.render(deltaMilli, camera);
}
@ -408,6 +410,8 @@ public class Environement {
EventTime event = new EventTime(lastCallTime, lastCallTime-startTime, lastCallTime-lastUpdate, lastCallTime-lastUpdate);
for (ControlInterface elem : controls) {
elem.periodicCall(event);
}for (Engine engine : engines) {
engine.update((lastCallTime-lastUpdate)/100);
}
}
}

View File

@ -0,0 +1,65 @@
package org.atriaSoft.gameEngine.components;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import org.atriaSoft.etk.Uri;
import org.atriaSoft.gameEngine.Component;
import org.atriaSoft.gameEngine.engines.EngineDynamicMeshs;
import org.atriaSoft.gameEngine.resource.ResourceStaticMesh;
import org.atriaSoft.gameEngine.resource.ResourceStaticMeshObj;
public class ComponentDynamicMeshs extends Component {
protected Map<String, ResourceStaticMesh> meshs = new HashMap<String, ResourceStaticMesh>();
@Override
public String getType() {
// TODO Auto-generated method stub
return EngineDynamicMeshs.ENGINE_NAME;
}
public ComponentDynamicMeshs() {
}
public Set<String> getKeys() {
return meshs.keySet();
}
public void setMesh(String name, ResourceStaticMesh mesh) {
this.meshs.put(name, mesh);
}
public ResourceStaticMesh getMesh(String name) {
return meshs.get(name);
}
public void bindForRendering(String name) {
ResourceStaticMesh mesh = meshs.get(name);
if (mesh == null) {
return;
}
mesh.bindForRendering();
}
public void unBindForRendering(String name) {
ResourceStaticMesh mesh = meshs.get(name);
if (mesh == null) {
return;
}
mesh.unBindForRendering();
}
public void render(String name) {
ResourceStaticMesh mesh = meshs.get(name);
if (mesh == null) {
return;
}
mesh.render();
}
public void update(float timeStep) {}
}

View File

@ -0,0 +1,16 @@
package org.atriaSoft.gameEngine.components;
import org.atriaSoft.gameEngine.Component;
import org.atriaSoft.gameEngine.engines.EngineMap;
public class ComponentMap extends Component {
@Override
public String getType() {
// TODO Auto-generated method stub
return EngineMap.ENGINE_NAME;
}
public void update(float timeStep) {};
}

View File

@ -0,0 +1,31 @@
package org.atriaSoft.gameEngine.components;
import java.util.HashMap;
import java.util.Map;
import org.atriaSoft.gameEngine.Component;
import org.atriaSoft.gameEngine.Material;
public class ComponentMaterials extends Component {
// the material is not a resource, it can change in time... with AI or selection...
private Map<String, Material> materials = new HashMap<String, Material>();
public ComponentMaterials(Material material) {
super();
}
public ComponentMaterials() {
super();
}
@Override
public String getType() {
return "materials";
}
public Material getMaterial(String name) {
return materials.get(name);
}
public void setMaterial(String name, Material material) {
this.materials.put(name, material);
}
}

View File

@ -18,4 +18,6 @@ public abstract class ComponentRender extends Component {
return this.propertyDebugNormal;
}
public abstract void render();
public void update(float timeStep) {};
}

View File

@ -0,0 +1,115 @@
package org.atriaSoft.gameEngine.components;
import java.util.Set;
import org.atriaSoft.etk.Uri;
import org.atriaSoft.etk.math.Matrix4f;
import org.atriaSoft.etk.math.Vector3f;
import org.atriaSoft.gale.backend3d.OpenGL;
import org.atriaSoft.gale.resource.ResourceProgram;
import org.atriaSoft.gameEngine.Component;
import org.atriaSoft.gameEngine.Light;
import org.atriaSoft.gameEngine.Material;
import org.atriaSoft.gameEngine.engines.EngineLight;
public class ComponentRenderTexturedMaterialsDynamicMeshs extends ComponentRender {
private static final int numberOfLight = 8;
ComponentDynamicMeshs meshs = null;
ComponentTextures textures = null;
ComponentMaterials materials = null;
ComponentPosition position = null;
ResourceProgram program = null;
EngineLight lightEngine;
private int GLMatrixTransformation;
private int GLMatrixProjection;
private int GLMatrixView;
private int GLambientFactor;
private int GLdiffuseFactor;
private int GLspecularFactor;
private int GLshininess;
private GlLightIndex[] GLlights;
public ComponentRenderTexturedMaterialsDynamicMeshs(Uri vertexShader, Uri fragmentShader, EngineLight lightEngine) {
this.lightEngine = lightEngine;
this.program = ResourceProgram.create(vertexShader, fragmentShader);
if (this.program != null) {
this.GLMatrixTransformation = this.program.getUniform("in_matrixTransformation");
this.GLMatrixProjection = this.program.getUniform("in_matrixProjection");
this.GLMatrixView = this.program.getUniform("in_matrixView");
this.GLambientFactor = this.program.getUniform("in_material.ambientFactor");
this.GLdiffuseFactor = this.program.getUniform("in_material.diffuseFactor");
this.GLspecularFactor = this.program.getUniform("in_material.specularFactor");
this.GLshininess = this.program.getUniform("in_material.shininess");
this.GLlights = new GlLightIndex[numberOfLight];
for (int iii=0; iii<numberOfLight; iii++) {
int color = this.program.getUniform("in_lights[" + iii + "].color");
int position = this.program.getUniform("in_lights[" + iii + "].position");
int attenuation = this.program.getUniform("in_lights[" + iii + "].attenuation");
this.GLlights[iii] = new GlLightIndex(color, position, attenuation);
}
}
}
@Override
public void addFriendComponent(Component component) {
if (component.getType().contentEquals("dynamic-meshs")) {
meshs = (ComponentDynamicMeshs)component;
}
if (component.getType().contentEquals("textures")) {
textures = (ComponentTextures)component;
}
if (component.getType().contentEquals("materials")) {
materials = (ComponentMaterials)component;
}
if (component.getType().contentEquals("position")) {
position = (ComponentPosition)component;
}
}
@Override
public void removeFriendComponent(Component component) {
// nothing to do.
}
@Override
public void render() {
this.program.use();
Light[] lights = this.lightEngine.getNearest(position.getTransform().getPosition());
Matrix4f projectionMatrix = OpenGL.getMatrix();
Matrix4f viewMatrix = OpenGL.getCameraMatrix();
Matrix4f transformationMatrix = position.getTransform().getOpenGLMatrix();
Set<String> keys = this.meshs.getKeys();
for (int iii=0; iii<numberOfLight; iii++) {
if (lights[iii] != null) {
this.program.uniformVector(this.GLlights[iii].GLposition, lights[iii].getPositionDelta());
this.program.uniformVector(this.GLlights[iii].GLcolor, lights[iii].getColor());
this.program.uniformVector(this.GLlights[iii].GLattenuation, lights[iii].getAttenuation());
} else {
this.program.uniformVector(this.GLlights[iii].GLposition, new Vector3f(0,0,0));
this.program.uniformVector(this.GLlights[iii].GLcolor, new Vector3f(0,0,0));
this.program.uniformVector(this.GLlights[iii].GLattenuation, new Vector3f(1,0,0));
}
}
this.program.uniformMatrix(this.GLMatrixView, viewMatrix);
this.program.uniformMatrix(this.GLMatrixProjection, projectionMatrix);
// Change the position for each element with the same pipeline you need to render ...
this.program.uniformMatrix(this.GLMatrixTransformation, transformationMatrix);
for (String key : keys) {
this.meshs.bindForRendering(key);
this.textures.bindForRendering(key);
Material mat = this.materials.getMaterial(key);
this.program.uniformVector(GLambientFactor, mat.getAmbientFactor());
this.program.uniformVector(GLdiffuseFactor, mat.getDiffuseFactor());
this.program.uniformVector(GLspecularFactor, mat.getSpecularFactor());
this.program.uniformFloat(GLshininess, mat.getShininess());
// update of flags is done asynchronously ==> need update before drawing...
OpenGL.updateAllFlags();
// Request the draw all the elements:
this.meshs.render(key);
this.textures.unBindForRendering(key);
this.meshs.unBindForRendering(key);
}
this.program.unUse();
}
}

View File

@ -9,16 +9,6 @@ import org.atriaSoft.gameEngine.Component;
import org.atriaSoft.gameEngine.Light;
import org.atriaSoft.gameEngine.Material;
import org.atriaSoft.gameEngine.engines.EngineLight;
class GlLightIndex {
int GLcolor;
int GLposition;
int GLattenuation;
public GlLightIndex(int gLcolor, int gLposition, int gLattenuation) {
GLcolor = gLcolor;
GLposition = gLposition;
GLattenuation = gLattenuation;
}
}
public class ComponentRenderTexturedMaterialsStaticMesh extends ComponentRender {
private static final int numberOfLight = 8;
ComponentStaticMesh mesh = null;

View File

@ -0,0 +1,115 @@
package org.atriaSoft.gameEngine.components;
import java.util.Set;
import org.atriaSoft.etk.Uri;
import org.atriaSoft.etk.math.Matrix4f;
import org.atriaSoft.etk.math.Vector3f;
import org.atriaSoft.gale.backend3d.OpenGL;
import org.atriaSoft.gale.resource.ResourceProgram;
import org.atriaSoft.gameEngine.Component;
import org.atriaSoft.gameEngine.Light;
import org.atriaSoft.gameEngine.Material;
import org.atriaSoft.gameEngine.engines.EngineLight;
public class ComponentRenderTexturedMaterialsStaticMeshs extends ComponentRender {
private static final int numberOfLight = 8;
ComponentStaticMeshs meshs = null;
ComponentTextures textures = null;
ComponentMaterials materials = null;
ComponentPosition position = null;
ResourceProgram program = null;
EngineLight lightEngine;
private int GLMatrixTransformation;
private int GLMatrixProjection;
private int GLMatrixView;
private int GLambientFactor;
private int GLdiffuseFactor;
private int GLspecularFactor;
private int GLshininess;
private GlLightIndex[] GLlights;
public ComponentRenderTexturedMaterialsStaticMeshs(Uri vertexShader, Uri fragmentShader, EngineLight lightEngine) {
this.lightEngine = lightEngine;
this.program = ResourceProgram.create(vertexShader, fragmentShader);
if (this.program != null) {
this.GLMatrixTransformation = this.program.getUniform("in_matrixTransformation");
this.GLMatrixProjection = this.program.getUniform("in_matrixProjection");
this.GLMatrixView = this.program.getUniform("in_matrixView");
this.GLambientFactor = this.program.getUniform("in_material.ambientFactor");
this.GLdiffuseFactor = this.program.getUniform("in_material.diffuseFactor");
this.GLspecularFactor = this.program.getUniform("in_material.specularFactor");
this.GLshininess = this.program.getUniform("in_material.shininess");
this.GLlights = new GlLightIndex[numberOfLight];
for (int iii=0; iii<numberOfLight; iii++) {
int color = this.program.getUniform("in_lights[" + iii + "].color");
int position = this.program.getUniform("in_lights[" + iii + "].position");
int attenuation = this.program.getUniform("in_lights[" + iii + "].attenuation");
this.GLlights[iii] = new GlLightIndex(color, position, attenuation);
}
}
}
@Override
public void addFriendComponent(Component component) {
if (component.getType().contentEquals("static-meshs")) {
meshs = (ComponentStaticMeshs)component;
}
if (component.getType().contentEquals("textures")) {
textures = (ComponentTextures)component;
}
if (component.getType().contentEquals("materials")) {
materials = (ComponentMaterials)component;
}
if (component.getType().contentEquals("position")) {
position = (ComponentPosition)component;
}
}
@Override
public void removeFriendComponent(Component component) {
// nothing to do.
}
@Override
public void render() {
this.program.use();
Light[] lights = this.lightEngine.getNearest(position.getTransform().getPosition());
Matrix4f projectionMatrix = OpenGL.getMatrix();
Matrix4f viewMatrix = OpenGL.getCameraMatrix();
Matrix4f transformationMatrix = position.getTransform().getOpenGLMatrix();
Set<String> keys = this.meshs.getKeys();
for (int iii=0; iii<numberOfLight; iii++) {
if (lights[iii] != null) {
this.program.uniformVector(this.GLlights[iii].GLposition, lights[iii].getPositionDelta());
this.program.uniformVector(this.GLlights[iii].GLcolor, lights[iii].getColor());
this.program.uniformVector(this.GLlights[iii].GLattenuation, lights[iii].getAttenuation());
} else {
this.program.uniformVector(this.GLlights[iii].GLposition, new Vector3f(0,0,0));
this.program.uniformVector(this.GLlights[iii].GLcolor, new Vector3f(0,0,0));
this.program.uniformVector(this.GLlights[iii].GLattenuation, new Vector3f(1,0,0));
}
}
this.program.uniformMatrix(this.GLMatrixView, viewMatrix);
this.program.uniformMatrix(this.GLMatrixProjection, projectionMatrix);
// Change the position for each element with the same pipeline you need to render ...
this.program.uniformMatrix(this.GLMatrixTransformation, transformationMatrix);
for (String key : keys) {
this.meshs.bindForRendering(key);
this.textures.bindForRendering(key);
Material mat = this.materials.getMaterial(key);
this.program.uniformVector(GLambientFactor, mat.getAmbientFactor());
this.program.uniformVector(GLdiffuseFactor, mat.getDiffuseFactor());
this.program.uniformVector(GLspecularFactor, mat.getSpecularFactor());
this.program.uniformFloat(GLshininess, mat.getShininess());
// update of flags is done asynchronously ==> need update before drawing...
OpenGL.updateAllFlags();
// Request the draw all the elements:
this.meshs.render(key);
this.textures.unBindForRendering(key);
this.meshs.unBindForRendering(key);
}
this.program.unUse();
}
}

View File

@ -0,0 +1,67 @@
package org.atriaSoft.gameEngine.components;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import org.atriaSoft.etk.Uri;
import org.atriaSoft.gameEngine.Log;
import org.atriaSoft.gameEngine.Component;
import org.atriaSoft.gameEngine.resource.ResourceStaticMesh;
import org.atriaSoft.gameEngine.resource.ResourceStaticMeshObj;
public class ComponentStaticMeshs extends Component {
private Map<String, ResourceStaticMesh> meshs = new HashMap<String, ResourceStaticMesh>();
@Override
public String getType() {
// TODO Auto-generated method stub
return "static-meshs";
}
public ComponentStaticMeshs(Uri meshUrl) {
// TODO : load Mesh
Log.critical("Can not Load the Mesh for now ... " + meshUrl);
ResourceStaticMeshObj mesh = ResourceStaticMeshObj.create(meshUrl);
setMesh("default", mesh);
}
public ComponentStaticMeshs() {
// nothing to do ...
}
public Set<String> getKeys() {
return meshs.keySet();
}
public void setMesh(String name, ResourceStaticMesh mesh) {
this.meshs.put(name, mesh);
}
public ResourceStaticMesh getMesh(String name) {
return meshs.get(name);
}
public void bindForRendering(String name) {
ResourceStaticMesh mesh = meshs.get(name);
if (mesh == null) {
return;
}
mesh.bindForRendering();
}
public void unBindForRendering(String name) {
ResourceStaticMesh mesh = meshs.get(name);
if (mesh == null) {
return;
}
mesh.unBindForRendering();
}
public void render(String name) {
ResourceStaticMesh mesh = meshs.get(name);
if (mesh == null) {
return;
}
mesh.render();
}
}

View File

@ -0,0 +1,40 @@
package org.atriaSoft.gameEngine.components;
import java.util.HashMap;
import java.util.Map;
import org.atriaSoft.etk.Uri;
import org.atriaSoft.gale.resource.ResourceTexture;
import org.atriaSoft.gale.test.sample2.Log;
import org.atriaSoft.gameEngine.Component;
import org.atriaSoft.gameEngine.Material;
public class ComponentTextures extends Component {
private Map<String, ResourceTexture> textures = new HashMap<String, ResourceTexture>();
@Override
public String getType() {
// TODO Auto-generated method stub
return "textures";
}
public ComponentTextures() {
}
public void setTexture(String name, Uri textureName) {
ResourceTexture texture = ResourceTexture.createFromPng(textureName);
if (texture == null) {
Log.error("can not instanciate Texture ...");
return;
}
textures.put(name, texture);
}
public void bindForRendering(String name) {
this.textures.get(name).bindForRendering(0);
}
public void unBindForRendering(String name) {
this.textures.get(name).unBindForRendering();
}
}

View File

@ -0,0 +1,12 @@
package org.atriaSoft.gameEngine.components;
public class GlLightIndex {
int GLcolor;
int GLposition;
int GLattenuation;
public GlLightIndex(int gLcolor, int gLposition, int gLattenuation) {
GLcolor = gLcolor;
GLposition = gLposition;
GLattenuation = gLattenuation;
}
}

View File

@ -13,7 +13,7 @@ public class EngineAI extends Engine {
public static final String ENGINE_NAME = "ia";
private float accumulator = 0;
private static float TIME_STEP = 5.0f;
private Vector<ComponentAI> components;
private Vector<ComponentAI> components = new Vector<ComponentAI>();
public EngineAI(Environement env) {
super(env);
// TODO Auto-generated constructor stub
@ -38,7 +38,7 @@ public class EngineAI extends Engine {
accumulator += (float)deltaMili*0.0001f;
// While there is enough accumulated time to take one or several physics steps
while (accumulator >= TIME_STEP) {
Log.warning("Generate for " + accumulator + " / " + TIME_STEP + " for:" + components.size());
//Log.warning("AI: Generate for " + accumulator + " / " + TIME_STEP + " for:" + components.size());
// call every object to usdate their constant forces applyed
for (ComponentAI it: components) {
it.update(TIME_STEP);

View File

@ -0,0 +1,69 @@
package org.atriaSoft.gameEngine.engines;
import java.util.Vector;
import org.atriaSoft.gameEngine.Component;
import org.atriaSoft.gameEngine.Engine;
import org.atriaSoft.gameEngine.Environement;
import org.atriaSoft.gameEngine.camera.Camera;
import org.atriaSoft.gameEngine.components.ComponentDynamicMeshs;
public class EngineDynamicMeshs extends Engine {
public static final String ENGINE_NAME = "dynamic-meshs";
private static float TIME_STEP = 5.0f;
private float accumulator = TIME_STEP;
private Vector<ComponentDynamicMeshs> components = new Vector<ComponentDynamicMeshs>();
public EngineDynamicMeshs(Environement env) {
super(env);
// TODO Auto-generated constructor stub
}
@Override
public void componentRemove(Component ref) {
components.remove(ref);
}
@Override
public void componentAdd(Component ref) {
if (ref instanceof ComponentDynamicMeshs == true) {
components.add((ComponentDynamicMeshs)ref);
return;
}
}
@Override
public void update(long deltaMili) {
//Log.warning("engine update : " + deltaMili + " " + accumulator + " >= " + TIME_STEP);
// Add the time difference in the accumulator
accumulator += (float)deltaMili*0.0001f;
// While there is enough accumulated time to take one or several physics steps
while (accumulator >= TIME_STEP) {
//Log.warning("Generate for " + accumulator + " / " + TIME_STEP + " for:" + components.size());
// call every object to usdate their constant forces applyed
for (ComponentDynamicMeshs it: components) {
it.update(TIME_STEP);
}
// Decrease the accumulated time
accumulator -= TIME_STEP;
}
}
@Override
public void render(long deltaMili, Camera camera) {
// nothing to do ...
}
@Override
public void renderDebug(long deltaMili, Camera camera) {
// nothing to do ...
}
@Override
public String getType() {
// TODO Auto-generated method stub
return ENGINE_NAME;
}
}

View File

@ -0,0 +1,71 @@
package org.atriaSoft.gameEngine.engines;
import java.util.Vector;
import org.atriaSoft.etk.math.Vector3f;
import org.atriaSoft.gameEngine.Component;
import org.atriaSoft.gameEngine.Engine;
import org.atriaSoft.gameEngine.Environement;
import org.atriaSoft.gameEngine.Light;
import org.atriaSoft.gameEngine.Log;
import org.atriaSoft.gameEngine.camera.Camera;
import org.atriaSoft.gameEngine.components.ComponentAI;
import org.atriaSoft.gameEngine.components.ComponentMap;
public class EngineMap extends Engine {
public static final String ENGINE_NAME = "map";
private float accumulator = 0;
private static float TIME_STEP = 5.0f;
private Vector<ComponentMap> components = new Vector<ComponentMap>();
public EngineMap(Environement env) {
super(env);
// TODO Auto-generated constructor stub
}
@Override
public void componentRemove(Component ref) {
components.remove(ref);
}
@Override
public void componentAdd(Component ref) {
if (ref instanceof ComponentMap == true) {
components.add((ComponentMap)ref);
return;
}
}
@Override
public void update(long deltaMili) {
// Add the time difference in the accumulator
accumulator += (float)deltaMili*0.0001f;
// While there is enough accumulated time to take one or several physics steps
while (accumulator >= TIME_STEP) {
// Log.warning("MAP: Generate for " + accumulator + " / " + TIME_STEP + " for:" + components.size());
// call every object to update their constant forces applied
for (ComponentMap it: components) {
it.update(TIME_STEP);
}
// Decrease the accumulated time
accumulator -= TIME_STEP;
}
}
@Override
public void render(long deltaMili, Camera camera) {
// nothing to do ...
}
@Override
public void renderDebug(long deltaMili, Camera camera) {
// nothing to do ...
}
@Override
public String getType() {
// TODO Auto-generated method stub
return ENGINE_NAME;
}
}

View File

@ -7,6 +7,7 @@ import org.atriaSoft.gameEngine.Component;
import org.atriaSoft.gameEngine.Engine;
import org.atriaSoft.gameEngine.Environement;
import org.atriaSoft.gameEngine.camera.Camera;
import org.atriaSoft.gameEngine.components.ComponentAI;
import org.atriaSoft.gameEngine.components.ComponentRender;
class ResultNearestElement {
@ -16,6 +17,8 @@ class ResultNearestElement {
public class EngineRender extends Engine {
public static final String ENGINE_NAME = "render";
private float accumulator = 0;
private static float TIME_STEP = 5.0f;
private Vector<ComponentRender> components = new Vector<ComponentRender>();
private Vector<ResultNearestElement> displayElementOrdered = new Vector<ResultNearestElement>();
//private ResourceColored3DObject debugDrawProperty;
@ -39,7 +42,18 @@ public class EngineRender extends Engine {
@Override
public void update(long deltaMili) {
// TODO Auto-generated method stub
// Add the time difference in the accumulator
accumulator += (float)deltaMili*0.0001f;
// While there is enough accumulated time to take one or several physics steps
while (accumulator >= TIME_STEP) {
// Log.warning("RENDER: Generate for " + accumulator + " / " + TIME_STEP + " for:" + components.size());
// call every object to usdate their constant forces applyed
for (ComponentRender it: components) {
it.update(TIME_STEP);
}
// Decrease the accumulated time
accumulator -= TIME_STEP;
}
}

View File

@ -0,0 +1,212 @@
package org.atriaSoft.gameEngine.map;
import org.atriaSoft.etk.math.Vector2f;
import org.atriaSoft.etk.math.Vector3f;
import org.atriaSoft.etk.math.Vector3i;
import org.atriaSoft.gale.backend3d.OpenGL.RenderMode;
import org.atriaSoft.gale.test.sample2.Log;
import org.atriaSoft.gameEngine.components.ComponentDynamicMeshs;
import org.atriaSoft.gameEngine.resource.ResourceListTexturedMesh;
public class ComponentDynamicMeshsVoxelMap extends ComponentDynamicMeshs {
private VoxelChunk chunk;
ResourceListTexturedMesh unbreakable = ResourceListTexturedMesh.create(RenderMode.triangle);
ResourceListTexturedMesh stone = ResourceListTexturedMesh.create(RenderMode.triangle);
ResourceListTexturedMesh dirt = ResourceListTexturedMesh.create(RenderMode.triangle);
ResourceListTexturedMesh grass = ResourceListTexturedMesh.create(RenderMode.triangle);
public ComponentDynamicMeshsVoxelMap(VoxelChunk chunk) {
super();
this.chunk = chunk;
this.setMesh("unbreakable", unbreakable);
this.setMesh("stone", stone);
this.setMesh("dirt", dirt);
this.setMesh("grass", grass);
}
private void drawPlane(Vector3i base, int xxx, int yyy, int zzz, int type) {
//Log.warning("Add plane Z : " + (base.x + xxx) + ", " + (base.y + yyy) + ", " + (base.z + zzz));
Vector3f v1 = new Vector3f(base.x + xxx , base.y + yyy , base.z + zzz);
Vector3f v2 = new Vector3f(base.x + xxx , base.y + yyy+1, base.z + zzz);
Vector3f v3 = new Vector3f(base.x + xxx+1, base.y + yyy+1, base.z + zzz);
Vector3f v4 = new Vector3f(base.x + xxx+1, base.y + yyy , base.z + zzz);
Vector2f t1 = new Vector2f(0, 0);
Vector2f t2 = new Vector2f(0, 1);
Vector2f t3 = new Vector2f(1, 1);
Vector2f t4 = new Vector2f(1, 0);
Vector3f n1 = new Vector3f(0, 0, -1);
if (type == VoxelType.NATIVE_UNBREAKABLE) {
unbreakable.addQuad(v1, v2, v3, v4, t1, t2, t3, t4, n1);
} else if (type == VoxelType.NATIVE_DIRT) {
dirt.addQuad(v1, v2, v3, v4, t1, t2, t3, t4, n1);
} else if (type == VoxelType.NATIVE_STONE) {
stone.addQuad(v1, v2, v3, v4, t1, t2, t3, t4, n1);
} else if (type == VoxelType.NATIVE_GRASS) {
grass.addQuad(v1, v2, v3, v4, t1, t2, t3, t4, n1);
}
}
private void drawPlane_anti(Vector3i base, int xxx, int yyy, int zzz, int type) {
//Log.warning("Add plane Z : " + (base.x + xxx) + ", " + (base.y + yyy) + ", " + (base.z + zzz));
Vector3f v1 = new Vector3f(base.x + xxx , base.y + yyy , base.z + zzz);
Vector3f v2 = new Vector3f(base.x + xxx , base.y + yyy+1, base.z + zzz);
Vector3f v3 = new Vector3f(base.x + xxx+1, base.y + yyy+1, base.z + zzz);
Vector3f v4 = new Vector3f(base.x + xxx+1, base.y + yyy , base.z + zzz);
Vector2f t1 = new Vector2f(0, 0);
Vector2f t2 = new Vector2f(0, 1);
Vector2f t3 = new Vector2f(1, 1);
Vector2f t4 = new Vector2f(1, 0);
Vector3f n1 = new Vector3f(0, 0, 1);
if (type == VoxelType.NATIVE_UNBREAKABLE) {
unbreakable.addQuad(v1, v4, v3, v2, t1, t4, t3, t2, n1);
} else if (type == VoxelType.NATIVE_DIRT) {
dirt.addQuad(v1, v4, v3, v2, t1, t4, t3, t2, n1);
} else if (type == VoxelType.NATIVE_STONE) {
stone.addQuad(v1, v4, v3, v2, t1, t4, t3, t2, n1);
} else if (type == VoxelType.NATIVE_GRASS) {
grass.addQuad(v1, v4, v3, v2, t1, t4, t3, t2, n1);
}
}
private void drawPlaneVerticalX(Vector3i base, int xxx, int yyy, int zzz, int type) {
//Log.warning("Add plane X : " + (base.x + xxx) + ", " + (base.y + yyy) + ", " + (base.z + zzz));
Vector3f v1 = new Vector3f(base.x + xxx , base.y + yyy , base.z + zzz);
Vector3f v2 = new Vector3f(base.x + xxx , base.y + yyy , base.z + zzz+1);
Vector3f v3 = new Vector3f(base.x + xxx , base.y + yyy+1, base.z + zzz+1);
Vector3f v4 = new Vector3f(base.x + xxx , base.y + yyy+1, base.z + zzz);
Vector2f t1 = new Vector2f(0, 0);
Vector2f t2 = new Vector2f(0, 1);
Vector2f t3 = new Vector2f(1, 1);
Vector2f t4 = new Vector2f(1, 0);
Vector3f n1 = new Vector3f(-1, 0, 0);
if (type == VoxelType.NATIVE_UNBREAKABLE) {
unbreakable.addQuad(v1, v2, v3, v4, t1, t2, t3, t4, n1);
} else if (type == VoxelType.NATIVE_DIRT) {
dirt.addQuad(v1, v2, v3, v4, t1, t2, t3, t4, n1);
} else if (type == VoxelType.NATIVE_STONE) {
stone.addQuad(v1, v2, v3, v4, t1, t2, t3, t4, n1);
} else if (type == VoxelType.NATIVE_GRASS) {
grass.addQuad(v1, v2, v3, v4, t1, t2, t3, t4, n1);
}
}
private void drawPlaneVerticalX_anti(Vector3i base, int xxx, int yyy, int zzz, int type) {
//Log.warning("Add plane X : " + (base.x + xxx) + ", " + (base.y + yyy) + ", " + (base.z + zzz));
Vector3f v1 = new Vector3f(base.x + xxx , base.y + yyy , base.z + zzz);
Vector3f v2 = new Vector3f(base.x + xxx , base.y + yyy , base.z + zzz+1);
Vector3f v3 = new Vector3f(base.x + xxx , base.y + yyy+1, base.z + zzz+1);
Vector3f v4 = new Vector3f(base.x + xxx , base.y + yyy+1, base.z + zzz);
Vector2f t1 = new Vector2f(0, 0);
Vector2f t2 = new Vector2f(0, 1);
Vector2f t3 = new Vector2f(1, 1);
Vector2f t4 = new Vector2f(1, 0);
Vector3f n1 = new Vector3f(1, 0, 0);
if (type == VoxelType.NATIVE_UNBREAKABLE) {
unbreakable.addQuad(v1, v4, v3, v2, t1, t4, t3, t2, n1);
} else if (type == VoxelType.NATIVE_DIRT) {
dirt.addQuad(v1, v4, v3, v2, t1, t4, t3, t2, n1);
} else if (type == VoxelType.NATIVE_STONE) {
stone.addQuad(v1, v4, v3, v2, t1, t4, t3, t2, n1);
} else if (type == VoxelType.NATIVE_GRASS) {
grass.addQuad(v1, v4, v3, v2, t1, t4, t3, t2, n1);
}
}
private void drawPlaneVerticalY(Vector3i base, int xxx, int yyy, int zzz, int type) {
//Log.warning("Add plane Y : " + (base.x + xxx) + ", " + (base.y + yyy) + ", " + (base.z + zzz));
Vector3f v1 = new Vector3f(base.x + xxx , base.y + yyy , base.z + zzz);
Vector3f v2 = new Vector3f(base.x + xxx , base.y + yyy , base.z + zzz+1);
Vector3f v3 = new Vector3f(base.x + xxx+1, base.y + yyy , base.z + zzz+1);
Vector3f v4 = new Vector3f(base.x + xxx+1, base.y + yyy , base.z + zzz);
Vector2f t1 = new Vector2f(0, 0);
Vector2f t2 = new Vector2f(0, 1);
Vector2f t3 = new Vector2f(1, 1);
Vector2f t4 = new Vector2f(1, 0);
Vector3f n1 = new Vector3f(0, 1, 0);
if (type == VoxelType.NATIVE_UNBREAKABLE) {
unbreakable.addQuad(v1, v2, v3, v4, t1, t2, t3, t4, n1);
} else if (type == VoxelType.NATIVE_DIRT) {
dirt.addQuad(v1, v2, v3, v4, t1, t2, t3, t4, n1);
} else if (type == VoxelType.NATIVE_STONE) {
stone.addQuad(v1, v2, v3, v4, t1, t2, t3, t4, n1);
} else if (type == VoxelType.NATIVE_GRASS) {
grass.addQuad(v1, v2, v3, v4, t1, t2, t3, t4, n1);
}
}
private void drawPlaneVerticalY_anti(Vector3i base, int xxx, int yyy, int zzz, int type) {
//Log.warning("Add plane Y : " + (base.x + xxx) + ", " + (base.y + yyy) + ", " + (base.z + zzz));
Vector3f v1 = new Vector3f(base.x + xxx , base.y + yyy , base.z + zzz);
Vector3f v2 = new Vector3f(base.x + xxx , base.y + yyy , base.z + zzz+1);
Vector3f v3 = new Vector3f(base.x + xxx+1, base.y + yyy , base.z + zzz+1);
Vector3f v4 = new Vector3f(base.x + xxx+1, base.y + yyy , base.z + zzz);
Vector2f t1 = new Vector2f(0, 0);
Vector2f t2 = new Vector2f(0, 1);
Vector2f t3 = new Vector2f(1, 1);
Vector2f t4 = new Vector2f(1, 0);
Vector3f n1 = new Vector3f(0, -1, 0);
if (type == VoxelType.NATIVE_UNBREAKABLE) {
unbreakable.addQuad(v1, v4, v3, v2, t1, t4, t3, t2, n1);
} else if (type == VoxelType.NATIVE_DIRT) {
dirt.addQuad(v1, v4, v3, v2, t1, t4, t3, t2, n1);
} else if (type == VoxelType.NATIVE_STONE) {
stone.addQuad(v1, v4, v3, v2, t1, t4, t3, t2, n1);
} else if (type == VoxelType.NATIVE_GRASS) {
grass.addQuad(v1, v4, v3, v2, t1, t4, t3, t2, n1);
}
}
@Override
public void update(float timeStep) {
Log.warning("update : " + timeStep);
if (chunk.haveChange() == false) {
return;
}
Log.warning(" ==> YES");
Voxel[][][] data = chunk.getData();
unbreakable.clear();
stone.clear();
dirt.clear();
grass.clear();
for (int xxx=0; xxx < VoxelChunk.VOXEL_CHUNK_SIZE; xxx++) {
for (int yyy=0; yyy < VoxelChunk.VOXEL_CHUNK_SIZE; yyy++) {
for (int zzz=0; zzz < VoxelChunk.VOXEL_CHUNK_SIZE; zzz++) {
Voxel current = data[xxx][yyy][zzz];
if (current.active == false) {
continue;
}
Voxel bottom = chunk.getVoxel(xxx, yyy, zzz-1);
if (bottom == null || bottom.active == false) {
drawPlane(chunk.getPosition(), xxx, yyy, zzz, current.type);
}
Voxel up = chunk.getVoxel(xxx, yyy, zzz+1);
if (up == null || up.active == false) {
drawPlane_anti(chunk.getPosition(), xxx, yyy, zzz+1, current.type);
}
Voxel left = chunk.getVoxel(xxx-1, yyy, zzz);
if (left == null || left.active == false) {
drawPlaneVerticalX(chunk.getPosition(), xxx, yyy, zzz, current.type);
}
Voxel right = chunk.getVoxel(xxx+1, yyy, zzz);
if (right == null || right.active == false) {
drawPlaneVerticalX_anti(chunk.getPosition(), xxx+1, yyy, zzz, current.type);
}
Voxel front = chunk.getVoxel(xxx, yyy-1, zzz);
if (front == null || front.active == false) {
drawPlaneVerticalY_anti(chunk.getPosition(), xxx, yyy, zzz, current.type);
}
Voxel back = chunk.getVoxel(xxx, yyy+1, zzz);
if (back == null || back.active == false) {
drawPlaneVerticalY(chunk.getPosition(), xxx, yyy+1, zzz, current.type);
}
}
}
}
unbreakable.flush();
stone.flush();
dirt.flush();
grass.flush();
}
@Override
public void render(String name) {
//Log.warning("Render : " + name);
super.render(name);
}
}

View File

@ -0,0 +1,19 @@
package org.atriaSoft.gameEngine.map;
import org.atriaSoft.etk.Uri;
import org.atriaSoft.gameEngine.components.ComponentRenderTexturedMaterialsStaticMeshs;
import org.atriaSoft.gameEngine.engines.EngineLight;
public class ComponentRenderVoxelMesh extends ComponentRenderTexturedMaterialsStaticMeshs {
public ComponentRenderVoxelMesh(Uri vertexShader, Uri fragmentShader, EngineLight lightEngine, VoxelChunk chunk) {
super(vertexShader, fragmentShader, lightEngine);
// TODO Auto-generated constructor stub
}
@Override
public void update(float timeStep) {
}
}

View File

@ -0,0 +1,77 @@
package org.atriaSoft.gameEngine.map;
import java.util.ArrayList;
import java.util.List;
import org.atriaSoft.etk.Uri;
import org.atriaSoft.etk.math.Transform3D;
import org.atriaSoft.etk.math.Vector3i;
import org.atriaSoft.etk.math.Vector3f;
import org.atriaSoft.gameEngine.Entity;
import org.atriaSoft.gameEngine.Environement;
import org.atriaSoft.gameEngine.Light;
import org.atriaSoft.gameEngine.Material;
import org.atriaSoft.gameEngine.components.ComponentLight;
import org.atriaSoft.gameEngine.components.ComponentLightSun;
import org.atriaSoft.gameEngine.components.ComponentMaterials;
import org.atriaSoft.gameEngine.components.ComponentPosition;
import org.atriaSoft.gameEngine.components.ComponentRenderTexturedMaterialsDynamicMeshs;
import org.atriaSoft.gameEngine.components.ComponentRenderTexturedMaterialsStaticMeshs;
import org.atriaSoft.gameEngine.components.ComponentRenderTexturedStaticMesh;
import org.atriaSoft.gameEngine.components.ComponentStaticMesh;
import org.atriaSoft.gameEngine.components.ComponentStaticMeshs;
import org.atriaSoft.gameEngine.components.ComponentTexture;
import org.atriaSoft.gameEngine.components.ComponentTextures;
import org.atriaSoft.gameEngine.engines.EngineLight;
import org.atriaSoft.gameEngine.engines.EngineMap;
public class MapVoxel extends EngineMap {
//List<VoxelChunk> listOfChunks = new ArrayList<VoxelChunk>();
ComponentTextures textures;
public MapVoxel(Environement env){
super(env);
// for basic test ... after generate dynamic ...
textures = new ComponentTextures();
}
public void init() {
textures.setTexture("stone", new Uri("DATA", "blocks/stone.png"));
textures.setTexture("grass", new Uri("DATA", "blocks/dirt_podzol_top.png"));
textures.setTexture("dirt", new Uri("DATA", "blocks/dirt.png"));
textures.setTexture("watter", new Uri("DATA", "blocks/water_static.png"));
textures.setTexture("unbreakable", new Uri("DATA", "blocks/stone_diorite.png"));
// addNewChunk(new Vector3i(-1,-1, 0));
// addNewChunk(new Vector3i(-1, 0, 0));
// addNewChunk(new Vector3i(-1, 1, 0));
// addNewChunk(new Vector3i( 0,-1, 0));
addNewChunk(new Vector3i( 0, 0, 0));
// addNewChunk(new Vector3i( 0, 1, 0));
// addNewChunk(new Vector3i( 1,-1, 0));
// addNewChunk(new Vector3i( 1, 0, 0));
// addNewChunk(new Vector3i( 1, 1, 0));
}
private void addNewChunk(Vector3i position) {
// simple sun to have a global light ...
Entity tmpEntity = new Entity(this.env);
tmpEntity.addComponent(new ComponentPosition(new Transform3D(new Vector3f(position.x,position.y,0))));
VoxelChunk tmpVoxelChunk = new VoxelChunk(this, position);
tmpEntity.addComponent(tmpVoxelChunk);
ComponentDynamicMeshsVoxelMap mesh = new ComponentDynamicMeshsVoxelMap(tmpVoxelChunk);
tmpEntity.addComponent(mesh);
tmpEntity.addComponent(textures);
ComponentMaterials materials = new ComponentMaterials();
materials.setMaterial("stone", new Material());
materials.setMaterial("grass", new Material());
materials.setMaterial("dirt", new Material());
materials.setMaterial("watter", new Material());
materials.setMaterial("unbreakable", new Material());
tmpEntity.addComponent(materials);
tmpEntity.addComponent(new ComponentRenderTexturedMaterialsDynamicMeshs(
new Uri("DATA", "basicMaterial.vert"),
new Uri("DATA", "basicMaterial.frag"),
(EngineLight)env.getEngine(EngineLight.ENGINE_NAME)));
this.env.addEntity(tmpEntity);
}
}

View File

@ -0,0 +1,11 @@
package org.atriaSoft.gameEngine.map;
public class Voxel {
public int type = VoxelType.NATIVE_UNKNOWN;
public boolean active = true;
public Voxel(int type, boolean active) {
this.type = type;
this.active = active;
}
}

View File

@ -0,0 +1,75 @@
package org.atriaSoft.gameEngine.map;
import org.atriaSoft.etk.math.Vector2i;
import org.atriaSoft.etk.math.Vector3i;
import org.atriaSoft.gameEngine.components.ComponentMap;
// This chunk in designed in 2D no upper chunk, and no lower chunk...
public class VoxelChunk extends ComponentMap {
public final static int VOXEL_CHUNK_SIZE = 32;
private Voxel[][][] data = new Voxel[VOXEL_CHUNK_SIZE][VOXEL_CHUNK_SIZE][VOXEL_CHUNK_SIZE];
private final Vector3i position;
//private VoxelChunk[] neibours = new VoxelChunk[8];
private final MapVoxel globalMap;
private boolean haveChange = false;
public VoxelChunk(MapVoxel globalMap, Vector3i position) {
this.globalMap = globalMap;
this.position = position;
basicFill();
haveChange = true;
}
// this is a default fill tho have a usable map ==> only 3 layers ...
private void basicFill() {
for (int xxx=0; xxx < VOXEL_CHUNK_SIZE; xxx++) {
for (int yyy=0; yyy < VOXEL_CHUNK_SIZE; yyy++) {
for (int zzz=0; zzz < VOXEL_CHUNK_SIZE; zzz++) {
if(zzz < 1) {
data[xxx][yyy][zzz] = new Voxel(VoxelType.NATIVE_UNBREAKABLE, true);
} else if(zzz < 8) {
data[xxx][yyy][zzz] = new Voxel(VoxelType.NATIVE_STONE, true);
} else if(zzz < 12) {
data[xxx][yyy][zzz] = new Voxel(VoxelType.NATIVE_DIRT, true);
} else if(zzz < 13) {
data[xxx][yyy][zzz] = new Voxel(VoxelType.NATIVE_GRASS, true);
} else {
data[xxx][yyy][zzz] = new Voxel(VoxelType.NATIVE_UNKNOWN, false);
}
}
}
}
}
public Voxel[][][] getData() {
return data;
}
public boolean haveChange() {
boolean tmp = haveChange;
haveChange = false;
return tmp;
}
public Voxel getVoxel(int xxx, int yyy, int zzz) {
// TODO Auto-generated method stub
if (xxx < 0) {
return null;
}if (xxx >= VOXEL_CHUNK_SIZE) {
return null;
}
if (yyy < 0) {
return null;
}if (yyy >= VOXEL_CHUNK_SIZE) {
return null;
}
if (zzz < 0) {
return null;
}if (zzz >= VOXEL_CHUNK_SIZE) {
return null;
}
return data[xxx][yyy][zzz];
}
public Vector3i getPosition() {
return position;
}
}

View File

@ -0,0 +1,15 @@
package org.atriaSoft.gameEngine.map;
public class VoxelType {
public static final int NATIVE_UNKNOWN = 0;
public static final int NATIVE_BASIC_ID = 10000;
public static final int NATIVE_UNBREAKABLE = NATIVE_BASIC_ID;
public static final int NATIVE_DIRT = NATIVE_BASIC_ID + 1;
public static final int NATIVE_GRASS = NATIVE_BASIC_ID + 2;
public static final int NATIVE_STONE = NATIVE_BASIC_ID + 3;
public static final int NATIVE_SAND = NATIVE_BASIC_ID + 4;
public static final int NATIVE_WOOD = NATIVE_BASIC_ID + 101;
public static final int NATIVE_LEAF = NATIVE_BASIC_ID + 102;
public static final int NATIVE_WATTER = NATIVE_BASIC_ID + 201;
public static final int NATIVE_MAGMA = NATIVE_BASIC_ID + 202;
}

View File

@ -0,0 +1,111 @@
package org.atriaSoft.gameEngine.resource;
import java.util.ArrayList;
import java.util.List;
import org.atriaSoft.etk.Uri;
import org.atriaSoft.etk.math.Vector3f;
import org.atriaSoft.etk.math.Vector2f;
import org.atriaSoft.gale.Log;
import org.atriaSoft.gale.backend3d.OpenGL.RenderMode;
import org.atriaSoft.gale.resource.Resource;
import org.atriaSoft.gale.resource.ResourceVirtualArrayObject;
public class ResourceListTexturedMesh extends ResourceStaticMesh {
protected List<Vector3f> vertices = new ArrayList<Vector3f>();
protected List<Vector2f> textureCoords = new ArrayList<Vector2f>();
protected List<Vector3f> normals = new ArrayList<Vector3f>();
protected List<Integer> indices = new ArrayList<Integer>();
protected ResourceListTexturedMesh(Uri uriFile) {
super(uriFile);
addResourceType("ResourceListTexturedMesh");
}
protected ResourceListTexturedMesh(RenderMode mode) {
super(mode);
addResourceType("ResourceListTexturedMesh");
}
private float[] toFloatArray(List<Float> values) {
float[] out = new float[values.size()];
for (int iii=0; iii<values.size(); iii++) {
out[iii] = values.get(iii);
}
return out;
}
private int[] toIntArray(List<Integer> values) {
int[] out = new int[values.size()];
for (int iii=0; iii<values.size(); iii++) {
out[iii] = values.get(iii);
}
return out;
}
private float[] toFloatV3(List<Vector3f> values) {
float[] out = new float[values.size()*3];
for (int iii=0; iii<values.size(); iii++) {
Vector3f tmp = values.get(iii);
out[iii*3] = tmp.x;
out[iii*3+1] = tmp.y;
out[iii*3+2] = tmp.z;
}
return out;
}
private float[] toFloatV2(List<Vector2f> values) {
float[] out = new float[values.size()*2];
for (int iii=0; iii<values.size(); iii++) {
Vector2f tmp = values.get(iii);
out[iii*2] = tmp.x;
out[iii*2+1] = tmp.y;
}
return out;
}
/**
* @brief Send the data to the graphic card.
*/
public void flush() {
// request to the manager to be call at the next update ...
vao = ResourceVirtualArrayObject.create(toFloatV3(this.vertices), toFloatV2(this.textureCoords), toFloatV3(this.normals), toIntArray(this.indices));
vao.flush();
}
public void addTriangle(Vector3f v1, Vector3f v2, Vector3f v3, Vector2f t1, Vector2f t2, Vector2f t3, Vector3f n1, Vector3f n2, Vector3f n3) {
vertices.add(v1);
vertices.add(v2);
vertices.add(v3);
textureCoords.add(t1);
textureCoords.add(t2);
textureCoords.add(t3);
normals.add(n1);
normals.add(n2);
normals.add(n3);
indices.add(vertices.size()-3);
indices.add(vertices.size()-2);
indices.add(vertices.size()-1);
}
public void addQuad(Vector3f v1, Vector3f v2, Vector3f v3, Vector3f v4, Vector2f t1, Vector2f t2, Vector2f t3, Vector2f t4, Vector3f n1, Vector3f n2, Vector3f n3, Vector3f n4) {
addTriangle(v1, v2, v3, t1, t2, t3, n1, n2, n3);
addTriangle(v1, v3, v4, t1, t3, t4, n1, n3, n4);
}
public void addQuad(Vector3f v1, Vector3f v2, Vector3f v3, Vector3f v4, Vector2f t1, Vector2f t2, Vector2f t3, Vector2f t4, Vector3f n1) {
addTriangle(v1, v2, v3, t1, t2, t3, n1, n1, n1);
addTriangle(v1, v3, v4, t1, t3, t4, n1, n1, n1);
}
public void clear() {
vertices.clear();
textureCoords.clear();
normals.clear();
indices.clear();
}
public static ResourceListTexturedMesh create(RenderMode mode) {
ResourceListTexturedMesh resource = new ResourceListTexturedMesh(mode);
if (resource.resourceHasBeenCorectlyInit() == false) {
Log.critical("resource Is not correctly init: ResourceVirtualBufferObject");
}
getManager().localAdd(resource);
return resource;
}
}

View File

@ -0,0 +1,29 @@
package org.atriaSoft.gameEngine.sample.LoxelEngine;
public class Log {
private static String LIBNAME = "Sample1";
public static void print(String data) {
System.out.println(data);
}
public static void critical(String data) {
System.out.println("[C] " + LIBNAME + " | " + data);
}
public static void error(String data) {
System.out.println("[E] " + LIBNAME + " | " + data);
}
public static void warning(String data) {
System.out.println("[W] " + LIBNAME + " | " + data);
}
public static void info(String data) {
System.out.println("[I] " + LIBNAME + " | " + data);
}
public static void debug(String data) {
System.out.println("[D] " + LIBNAME + " | " + data);
}
public static void verbose(String data) {
System.out.println("[V] " + LIBNAME + " | " + data);
}
public static void todo(String data) {
System.out.println("[TODO] " + LIBNAME + " | " + data);
}
}

View File

@ -0,0 +1,184 @@
package org.atriaSoft.gameEngine.sample.LoxelEngine;
import org.atriaSoft.etk.Color;
import org.atriaSoft.etk.Uri;
import org.atriaSoft.etk.math.Matrix4f;
import org.atriaSoft.etk.math.Quaternion;
import org.atriaSoft.etk.math.Transform3D;
import org.atriaSoft.etk.math.Vector2f;
import org.atriaSoft.etk.math.Vector3f;
import org.atriaSoft.gale.Application;
import org.atriaSoft.gale.backend3d.OpenGL;
import org.atriaSoft.gale.backend3d.OpenGL.Flag;
import org.atriaSoft.gale.context.Context;
import org.atriaSoft.gameEngine.ControlCameraSimple;
import org.atriaSoft.gameEngine.Entity;
import org.atriaSoft.gameEngine.Environement;
import org.atriaSoft.gameEngine.GameStatus;
import org.atriaSoft.gameEngine.Light;
import org.atriaSoft.gameEngine.Material;
import org.atriaSoft.gameEngine.camera.Camera;
import org.atriaSoft.gameEngine.components.ComponentLight;
import org.atriaSoft.gameEngine.components.ComponentLightSun;
import org.atriaSoft.gameEngine.components.ComponentMaterial;
import org.atriaSoft.gameEngine.components.ComponentPosition;
import org.atriaSoft.gameEngine.components.ComponentRenderColoredStaticMesh;
import org.atriaSoft.gameEngine.components.ComponentRenderTexturedMaterialsStaticMesh;
import org.atriaSoft.gameEngine.components.ComponentRenderTexturedStaticMesh;
import org.atriaSoft.gameEngine.components.ComponentStaticMesh;
import org.atriaSoft.gameEngine.components.ComponentTexture;
import org.atriaSoft.gameEngine.engines.EngineLight;
import org.atriaSoft.gameEngine.map.MapVoxel;
import org.atriaSoft.gameEngine.tools.MeshGenerator;
import org.atriaSoft.gale.key.KeyKeyboard;
import org.atriaSoft.gale.key.KeySpecial;
import org.atriaSoft.gale.key.KeyStatus;
import org.atriaSoft.gale.key.KeyType;
public class LoxelApplication extends Application {
private Environement env;
private ComponentPosition objectPosition;
private Quaternion basicRotation = Quaternion.identity();
private Quaternion basicRotation2 = Quaternion.identity();
private boolean creationDone;
private ControlCameraSimple simpleControl;
private Material materialCube;
private ComponentPosition lightPosition;
private float angleLight = 0;
private MapVoxel map;
public LoxelApplication(){
creationDone = false;
}
@Override
public void onCreate(Context _context) {
env = new Environement();
this.canDraw = true;
setSize(new Vector2f(800, 600));
setTitle("Low Poly sample");
map = new MapVoxel(this.env);
this.env.addEngine(map);
map.init();
// simple sun to have a global light ...
Entity sun = new Entity(this.env);
sun.addComponent(new ComponentPosition(new Transform3D(new Vector3f(1000,1000,1000))));
sun.addComponent(new ComponentLightSun(new Light(new Vector3f(0.4f,0.4f,0.4f), new Vector3f(0,0,0), new Vector3f(0.8f,0,0))));
env.addEntity(sun);
// add a cube to show where in the light ...
Entity localLight = new Entity(this.env);
lightPosition = new ComponentPosition(new Transform3D(new Vector3f(-10,-10,0)));
localLight.addComponent(lightPosition);
localLight.addComponent(new ComponentStaticMesh(new Uri("RES", "cube.obj")));
localLight.addComponent(new ComponentTexture(new Uri("RES", "grass.png")));
localLight.addComponent(new ComponentLight(new Light(new Vector3f(0,1,0), new Vector3f(0,0,0), new Vector3f(0.8f,0.03f,0.002f))));
localLight.addComponent(new ComponentRenderTexturedStaticMesh(
new Uri("DATA", "basic.vert"),
new Uri("DATA", "basic.frag")));
env.addEntity(localLight);
Entity gird = new Entity(this.env);
gird.addComponent(new ComponentPosition(new Transform3D(new Vector3f(0,0,0))));
gird.addComponent(new ComponentStaticMesh(MeshGenerator.createGrid(5)));
gird.addComponent(new ComponentRenderColoredStaticMesh(
new Uri("DATA_EGE", "wireColor.vert"),
new Uri("DATA_EGE", "wireColor.frag")));
env.addEntity(gird);
Entity basicTree = new Entity(this.env);
objectPosition = new ComponentPosition(new Transform3D(new Vector3f(0,0,0)));
basicTree.addComponent(objectPosition);
materialCube = new Material();
basicTree.addComponent(new ComponentMaterial(materialCube));
basicTree.addComponent(new ComponentStaticMesh(new Uri("RES", "cube.obj")));
basicTree.addComponent(new ComponentTexture(new Uri("RES", "grass.png")));
basicTree.addComponent(new ComponentRenderTexturedMaterialsStaticMesh(
new Uri("DATA", "basicMaterial.vert"),
new Uri("DATA", "basicMaterial.frag"),
(EngineLight)env.getEngine(EngineLight.ENGINE_NAME)));
env.addEntity(basicTree);
Camera mainView = new Camera();
env.addCamera("default", mainView);
mainView.setPitch((float)Math.PI*-0.25f);
mainView.setPosition(new Vector3f(0,-5,5));
this.simpleControl = new ControlCameraSimple(mainView);
env.addControlInterface(simpleControl);
// start the engine.
env.setPropertyStatus(GameStatus.gameStart);
basicRotation.setEulerAngles(new Vector3f(0.005f,0.005f,0.01f));
basicRotation2.setEulerAngles(new Vector3f(0.003f,0.01f,0.001f));
// ready to let Gale & Ege manage the display
Log.info("==> Init APPL (END)");
creationDone = true;
}
@Override
public void onRegenerateDisplay(Context context) {
//Log.verbose("Regenerate Gale Application");
if (this.creationDone == false) {
return;
}
//materialCube.setAmbientFactor(new Vector3f(1.0f,1.0f,1.0f));
// apply a little rotation to show the element move
//objectPosition.getTransform().applyRotation(basicRotation);
//objectPosition.getTransform().applyRotation(basicRotation2);
angleLight += 0.01;
lightPosition.getTransform().getPosition().x = (float)Math.cos(angleLight) * 7.0f;
lightPosition.getTransform().getPosition().y = (float)Math.sin(angleLight) * 7.0f;
env.periodicCall();
markDrawingIsNeeded();
}
@Override
public void onDraw(Context _context) {
//Log.info("==> appl Draw ...");
Vector2f size = getSize();
if (this.creationDone == false) {
OpenGL.setViewPort(new Vector2f(0,0), size);
Color bgColor = new Color(0.8f, 0.5f, 0.5f, 1.0f);
OpenGL.clearColor(bgColor);
return;
}
// Store openGl context.
OpenGL.push();
// set projection matrix:
Matrix4f tmpProjection = Matrix4f.createMatrixPerspective(3.14f*0.5f, getAspectRatio(), 0.1f, 50000);
OpenGL.setMatrix(tmpProjection);
// set the basic openGL view port: (Draw in all the windows...)
OpenGL.setViewPort(new Vector2f(0,0), size);
// clear background
Color bgColor = new Color(0.0f, 1.0f, 0.0f, 1.0f);
OpenGL.clearColor(bgColor);
// real clear request:
OpenGL.clear(OpenGL.ClearFlag.clearFlag_colorBuffer);
OpenGL.clear(OpenGL.ClearFlag.clearFlag_depthBuffer);
OpenGL.enable(Flag.flag_depthTest);
env.render(20, "default");
// Restore context of matrix
OpenGL.pop();
}
@Override
public void onPointer(KeySpecial special,
KeyType type,
int pointerID,
Vector2f pos,
KeyStatus state) {
env.onPointer(special, type, pointerID, pos, state);
}
@Override
public void onKeyboard(KeySpecial special,
KeyKeyboard type,
Character value,
KeyStatus state) {
env.onKeyboard(special, type, value, state);
}
}

View File

@ -0,0 +1,17 @@
#version 400 core
#ifdef GL_ES
precision mediump float;
precision mediump int;
#endif
in vec2 io_textureCoords;
uniform sampler2D in_textureBase;
// output:
out vec4 out_Color;
void main(void) {
out_Color = texture(in_textureBase, io_textureCoords);
}

View File

@ -0,0 +1,21 @@
#version 400 core
#ifdef GL_ES
precision mediump float;
precision mediump int;
#endif
// Input:
in vec3 in_position;
in vec2 in_textureCoords;
uniform mat4 in_matrixTransformation;
uniform mat4 in_matrixProjection;
uniform mat4 in_matrixView;
// output:
out vec2 io_textureCoords;
void main(void) {
gl_Position = in_matrixProjection * in_matrixView * in_matrixTransformation * vec4(in_position, 1.0);
io_textureCoords = in_textureCoords;
}

View File

@ -0,0 +1,80 @@
#version 400 core
#ifdef GL_ES
precision mediump float;
precision mediump int;
#endif
struct Light {
vec3 color;
vec3 position;
vec3 attenuation;
};
struct Material {
vec3 ambientFactor;
vec3 diffuseFactor;
vec3 specularFactor;
float shininess;
};
const int MAX_LIGHT_NUMBER = 8;
in vec2 io_textureCoords;
in vec3 io_surfaceNormal;
in vec3 io_toCameraVector;
in vec3 io_toLightVector[MAX_LIGHT_NUMBER];
// FOW: Fog Of War result calculation
in float io_fowVisibility;
// texture properties
uniform sampler2D in_textureBase;
// Material
uniform Material in_material;
// 2 light for suns and other for locals ...
uniform Light in_lights[MAX_LIGHT_NUMBER];
// global color of the sky ... needed to have a better color for the FOW
//uniform vec3 in_sky_color;
const vec3 in_sky_color = vec3(1.0,1.0,1.0);
// output:
out vec4 out_Color;
void main(void) {
// disable transparency elements in the texture ...
// Can be set at the start of the shader ...
vec4 textureColour = texture(in_textureBase, io_textureCoords);
if (textureColour.a < 0.5) {
discard;
}
vec3 unitNormal = normalize(io_surfaceNormal);
vec3 unitVectorToCamera = normalize(io_toCameraVector);
vec3 totalDiffuse = vec3(0.0);
vec3 totalSpecular = vec3(0.0);
for(int iii=0; iii<MAX_LIGHT_NUMBER; iii++) {
float distance = length(io_toLightVector[iii]);
float attenuationFactor = in_lights[iii].attenuation.x + (in_lights[iii].attenuation.y * distance) + (in_lights[iii].attenuation.z * distance * distance);
vec3 unitLightVector = normalize(io_toLightVector[iii]);
float nDot1 = dot(unitNormal, unitLightVector);
float brightness = max(nDot1, 0.0);
vec3 lightDirection = -unitLightVector;
vec3 reflectedLightDirection = reflect(lightDirection, unitNormal);
float specularFactor = dot(reflectedLightDirection, unitVectorToCamera);
specularFactor = max(specularFactor, 0.0);
float damperFactor = pow(specularFactor, in_material.shininess);
vec3 diffuse = (brightness * in_lights[iii].color) / attenuationFactor;;
vec3 finalSpecular = (damperFactor * in_material.specularFactor.x * in_lights[iii].color) / attenuationFactor; // TODO: Remove the x ....
totalDiffuse = totalDiffuse + diffuse;
totalSpecular = totalSpecular + finalSpecular;
}
// the 0.2 represent the ambiant lightning ==> maybe set an uniform for this
totalDiffuse = max(totalDiffuse, 0.3);
out_Color = vec4(totalDiffuse,1.0) * textureColour + vec4(totalSpecular, 1.0);
out_Color = mix(vec4(in_sky_color,1.0), out_Color, io_fowVisibility);
}

View File

@ -0,0 +1,59 @@
#version 400 core
#ifdef GL_ES
precision mediump float;
precision mediump int;
#endif
struct Light {
vec3 color;
vec3 position;
vec3 attenuation;
};
const int MAX_LIGHT_NUMBER = 8;
// Input:
in vec3 in_position;
in vec3 in_normal;
in vec2 in_textureCoords;
// 2 light for suns and other for locals ...
uniform Light in_lights[MAX_LIGHT_NUMBER];
uniform mat4 in_matrixTransformation;
uniform mat4 in_matrixProjection;
uniform mat4 in_matrixView;
//uniform float in_numberOfRows;
//uniform vec2 in_offset;
const float in_numberOfRows = 1;
const vec2 in_offset = vec2(0.0,0.0);
// Configuration of the FOV ==> TODO: Set it in parameter uniform ...
const float c_density = 0.007;
const float c_gradient = 1.5;
// output:
out vec2 io_textureCoords;
out vec3 io_surfaceNormal;
out vec3 io_toCameraVector;
out vec3 io_toLightVector[MAX_LIGHT_NUMBER];
// FOW: Fog Of War result calculation
out float io_fowVisibility;
void main(void) {
vec4 worldPosition = in_matrixTransformation * vec4(in_position, 1.0);
vec4 positionRelativeToCam = in_matrixView * worldPosition;
gl_Position = in_matrixProjection * positionRelativeToCam;
io_textureCoords = (in_textureCoords/in_numberOfRows) + in_offset;
io_surfaceNormal = (in_matrixTransformation * vec4(in_normal, 0.0)).xyz;
for(int iii=0;iii<MAX_LIGHT_NUMBER;iii++) {
io_toLightVector[iii] = in_lights[iii].position - worldPosition.xyz;
}
io_toCameraVector = (inverse(in_matrixView) * vec4(0.0,0.0,0.0,1.0)).xyz - worldPosition.xyz;
float distance = length(positionRelativeToCam.xyz);
io_fowVisibility = exp(-pow((distance*c_density),c_gradient));
io_fowVisibility = clamp(io_fowVisibility, 0.0, 1.0);
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

View File

@ -0,0 +1,6 @@
{
"animation": {
"frametime": 5,
"interpolate": true
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 190 KiB

View File

@ -0,0 +1,72 @@
{
"animation": {
"frametime": 2,
"interpolate": false,
"frames": [
{
"index": 0,
"time": 1
},
{
"index": 1,
"time": 4
},
{
"index": 2,
"time": 1
},
{
"index": 3,
"time": 4
},
{
"index": 4,
"time": 1
},
{
"index": 5,
"time": 4
},
{
"index": 6,
"time": 2
},
{
"index": 7,
"time": 2
},
{
"index": 8,
"time": 2
},
{
"index": 9,
"time": 10
},
{
"index": 10,
"time": 5
},
{
"index": 11,
"time": 1
},
{
"index": 12,
"time": 4
},
{
"index": 13,
"time": 1
},
{
"index": 14,
"time": 10
},
{
"index": 15,
"time": 4
},
]
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

View File

@ -0,0 +1,20 @@
{
"animation": {
"frametime": 2,
"interpolate": true,
"frames": [
{
"index": 0,
"time": 4
},
1,
2,
{
"index": 3,
"time": 3
},
2,
1
]
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

View File

@ -0,0 +1,6 @@
{
"animation": {
"frametime": 10,
"interpolate": true
}
}

Some files were not shown because too many files have changed in this diff Show More