* Fixed crash in TestCinematic
* Fixed crash in LightList.sort() * Removed usage of Arrays.copyOf() in BitmapFont, so Android can run it * Formatted OGLESShaderRenderer git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7668 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
This commit is contained in:
parent
a6300ba55b
commit
c727d3e006
engine/src
android/com/jme3/renderer/android
core/com/jme3
lwjgl-ogl/com/jme3/renderer/lwjgl
niftygui/com/jme3/niftygui
test-data/Interface/Nifty
test/jme3test/animation
File diff suppressed because it is too large
Load Diff
@ -204,8 +204,15 @@ public class BitmapFont implements Savable {
|
|||||||
charSet.merge(newFont.charSet);
|
charSet.merge(newFont.charSet);
|
||||||
final int size1 = this.pages.length;
|
final int size1 = this.pages.length;
|
||||||
final int size2 = newFont.pages.length;
|
final int size2 = newFont.pages.length;
|
||||||
this.pages = Arrays.copyOf(this.pages, size1+size2);
|
|
||||||
System.arraycopy(newFont.pages, 0, this.pages, size1, size2);
|
Material[] tmp = new Material[size1+size2];
|
||||||
|
System.arraycopy(this.pages, 0, tmp, 0, size1);
|
||||||
|
System.arraycopy(newFont.pages, 0, tmp, size1, size2);
|
||||||
|
|
||||||
|
this.pages = tmp;
|
||||||
|
|
||||||
|
// this.pages = Arrays.copyOf(this.pages, size1+size2);
|
||||||
|
// System.arraycopy(newFont.pages, 0, this.pages, size1, size2);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setStyle(int style) {
|
public void setStyle(int style) {
|
||||||
|
@ -223,7 +223,7 @@ public final class LightList implements Iterable<Light>, Savable, Cloneable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// now merge sort tlist into list
|
// now merge sort tlist into list
|
||||||
SortUtil.msort(tlist, list, 0, listSize, c);
|
SortUtil.msort(tlist, list, 0, listSize - 1, c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,7 +69,6 @@ import com.jme3.util.BufferUtils;
|
|||||||
import com.jme3.util.IntMap;
|
import com.jme3.util.IntMap;
|
||||||
import com.jme3.util.IntMap.Entry;
|
import com.jme3.util.IntMap.Entry;
|
||||||
import com.jme3.util.ListMap;
|
import com.jme3.util.ListMap;
|
||||||
import java.io.File;
|
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
import java.nio.DoubleBuffer;
|
import java.nio.DoubleBuffer;
|
||||||
import java.nio.FloatBuffer;
|
import java.nio.FloatBuffer;
|
||||||
@ -2069,7 +2068,7 @@ public class LwjglRenderer implements Renderer {
|
|||||||
|
|
||||||
int programId = context.boundShaderProgram;
|
int programId = context.boundShaderProgram;
|
||||||
if (programId > 0) {
|
if (programId > 0) {
|
||||||
Attribute attrib = boundShader.getAttribute(vb.getBufferType().name());
|
Attribute attrib = boundShader.getAttribute(vb.getBufferType());
|
||||||
int loc = attrib.getLocation();
|
int loc = attrib.getLocation();
|
||||||
if (loc == -1) {
|
if (loc == -1) {
|
||||||
return; // not defined
|
return; // not defined
|
||||||
|
@ -35,6 +35,7 @@ package com.jme3.niftygui;
|
|||||||
import com.jme3.asset.AssetInfo;
|
import com.jme3.asset.AssetInfo;
|
||||||
import com.jme3.asset.AssetKey;
|
import com.jme3.asset.AssetKey;
|
||||||
import com.jme3.asset.AssetManager;
|
import com.jme3.asset.AssetManager;
|
||||||
|
import com.jme3.asset.AssetNotFoundException;
|
||||||
import com.jme3.audio.AudioRenderer;
|
import com.jme3.audio.AudioRenderer;
|
||||||
import com.jme3.input.InputManager;
|
import com.jme3.input.InputManager;
|
||||||
import com.jme3.post.SceneProcessor;
|
import com.jme3.post.SceneProcessor;
|
||||||
@ -71,7 +72,11 @@ public class NiftyJmeDisplay implements SceneProcessor {
|
|||||||
public InputStream getResourceAsStream(String path) {
|
public InputStream getResourceAsStream(String path) {
|
||||||
AssetKey<Object> key = new AssetKey<Object>(path);
|
AssetKey<Object> key = new AssetKey<Object>(path);
|
||||||
AssetInfo info = assetManager.locateAsset(key);
|
AssetInfo info = assetManager.locateAsset(key);
|
||||||
return info.openStream();
|
if (info != null){
|
||||||
|
return info.openStream();
|
||||||
|
}else{
|
||||||
|
throw new AssetNotFoundException(path);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public URL getResource(String path) {
|
public URL getResource(String path) {
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
<screen id="start" controller="de.lessvoid.nifty.examples.helloworld.HelloWorldStartScreen">
|
<screen id="start" controller="de.lessvoid.nifty.examples.helloworld.HelloWorldStartScreen">
|
||||||
<layer id="layer" backgroundColor="#0000" childLayout="center">
|
<layer id="layer" backgroundColor="#0000" childLayout="center">
|
||||||
<panel id="panel" width="100%" backgroundColor="#0000" childLayout="center" visibleToMouse="true" >
|
<panel id="panel" width="100%" backgroundColor="#0000" childLayout="center" visibleToMouse="true" >
|
||||||
<text id="text" font="aurulent-sans-17.fnt" color="#000f" text="" align="center" valign="bottom" />
|
<text id="text" font="aurulent-sans-16.fnt" color="#000f" text="" align="center" valign="bottom" />
|
||||||
</panel>
|
</panel>
|
||||||
</layer>
|
</layer>
|
||||||
</screen>
|
</screen>
|
@ -56,6 +56,7 @@ import com.jme3.math.FastMath;
|
|||||||
import com.jme3.math.Vector3f;
|
import com.jme3.math.Vector3f;
|
||||||
import com.jme3.post.FilterPostProcessor;
|
import com.jme3.post.FilterPostProcessor;
|
||||||
import com.jme3.post.filters.FadeFilter;
|
import com.jme3.post.filters.FadeFilter;
|
||||||
|
import com.jme3.renderer.Caps;
|
||||||
import com.jme3.renderer.queue.RenderQueue.ShadowMode;
|
import com.jme3.renderer.queue.RenderQueue.ShadowMode;
|
||||||
import com.jme3.scene.CameraNode;
|
import com.jme3.scene.CameraNode;
|
||||||
import com.jme3.scene.Geometry;
|
import com.jme3.scene.Geometry;
|
||||||
@ -94,7 +95,7 @@ public class TestCinematic extends SimpleApplication {
|
|||||||
createScene();
|
createScene();
|
||||||
|
|
||||||
cinematic = new Cinematic(rootNode, 20);
|
cinematic = new Cinematic(rootNode, 20);
|
||||||
cinematic.bindUi("jme3test/animation/subtitle.xml");
|
cinematic.bindUi("Interface/Nifty/CinematicTest.xml");
|
||||||
stateManager.attach(cinematic);
|
stateManager.attach(cinematic);
|
||||||
|
|
||||||
createCameraMotion();
|
createCameraMotion();
|
||||||
@ -158,7 +159,6 @@ public class TestCinematic extends SimpleApplication {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPause() {
|
public void onPause() {
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -175,9 +175,9 @@ public class TestCinematic extends SimpleApplication {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void onStop(CinematicEvent cinematic) {
|
public void onStop(CinematicEvent cinematic) {
|
||||||
chaseCam.setEnabled(true);
|
chaseCam.setEnabled(true);
|
||||||
fade.setValue(1);
|
fade.setValue(1);
|
||||||
System.out.println("stop");
|
System.out.println("stop");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -215,7 +215,6 @@ public class TestCinematic extends SimpleApplication {
|
|||||||
model.setShadowMode(ShadowMode.CastAndReceive);
|
model.setShadowMode(ShadowMode.CastAndReceive);
|
||||||
rootNode.attachChild(model);
|
rootNode.attachChild(model);
|
||||||
|
|
||||||
|
|
||||||
Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
|
Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
|
||||||
mat.setColor("Color", ColorRGBA.Cyan);
|
mat.setColor("Color", ColorRGBA.Cyan);
|
||||||
|
|
||||||
@ -225,8 +224,6 @@ public class TestCinematic extends SimpleApplication {
|
|||||||
teapot.setShadowMode(ShadowMode.CastAndReceive);
|
teapot.setShadowMode(ShadowMode.CastAndReceive);
|
||||||
rootNode.attachChild(teapot);
|
rootNode.attachChild(teapot);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Material matSoil = new Material(assetManager, "Common/MatDefs/Light/Lighting.j3md");
|
Material matSoil = new Material(assetManager, "Common/MatDefs/Light/Lighting.j3md");
|
||||||
matSoil.setBoolean("UseMaterialColors", true);
|
matSoil.setBoolean("UseMaterialColors", true);
|
||||||
matSoil.setColor("Ambient", ColorRGBA.Gray);
|
matSoil.setColor("Ambient", ColorRGBA.Gray);
|
||||||
@ -242,24 +239,22 @@ public class TestCinematic extends SimpleApplication {
|
|||||||
light.setColor(ColorRGBA.White.mult(1.5f));
|
light.setColor(ColorRGBA.White.mult(1.5f));
|
||||||
rootNode.addLight(light);
|
rootNode.addLight(light);
|
||||||
|
|
||||||
PssmShadowRenderer pssm = new PssmShadowRenderer(assetManager, 512, 1);
|
|
||||||
pssm.setDirection(new Vector3f(0, -1, -1).normalizeLocal());
|
|
||||||
pssm.setShadowIntensity(0.4f);
|
|
||||||
viewPort.addProcessor(pssm);
|
|
||||||
|
|
||||||
fpp = new FilterPostProcessor(assetManager);
|
fpp = new FilterPostProcessor(assetManager);
|
||||||
//fpp.setNumSamples(4);
|
|
||||||
fade = new FadeFilter();
|
fade = new FadeFilter();
|
||||||
fpp.addFilter(fade);
|
fpp.addFilter(fade);
|
||||||
viewPort.addProcessor(fpp);
|
|
||||||
|
if (renderer.getCaps().contains(Caps.GLSL100)){
|
||||||
|
PssmShadowRenderer pssm = new PssmShadowRenderer(assetManager, 512, 1);
|
||||||
|
pssm.setDirection(new Vector3f(0, -1, -1).normalizeLocal());
|
||||||
|
pssm.setShadowIntensity(0.4f);
|
||||||
|
viewPort.addProcessor(pssm);
|
||||||
|
viewPort.addProcessor(fpp);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initInputs() {
|
private void initInputs() {
|
||||||
inputManager.addMapping("togglePause", new KeyTrigger(keyInput.KEY_RETURN));
|
inputManager.addMapping("togglePause", new KeyTrigger(keyInput.KEY_RETURN));
|
||||||
|
|
||||||
ActionListener acl = new ActionListener() {
|
ActionListener acl = new ActionListener() {
|
||||||
|
|
||||||
public void onAction(String name, boolean keyPressed, float tpf) {
|
public void onAction(String name, boolean keyPressed, float tpf) {
|
||||||
if (name.equals("togglePause") && keyPressed) {
|
if (name.equals("togglePause") && keyPressed) {
|
||||||
if (cinematic.getPlayState() == PlayState.Playing) {
|
if (cinematic.getPlayState() == PlayState.Playing) {
|
||||||
@ -271,8 +266,6 @@ public class TestCinematic extends SimpleApplication {
|
|||||||
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
inputManager.addListener(acl, "togglePause");
|
inputManager.addListener(acl, "togglePause");
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user