Remove tests from jme3-android.

Android specific tests are to be included in jme3-android-examples.  Non-Android specific tests are imported from jme3-examples.
define_list_fix
iwgeric 9 years ago
parent c320c919a5
commit b53de6aedc
  1. 20
      jme3-android/src/main/java/com/jme3/app/R.java
  2. 29
      jme3-android/src/main/java/jme3test/android/AndroidManifest.xml
  3. 25
      jme3-android/src/main/java/jme3test/android/DemoAndroidHarness.java
  4. 72
      jme3-android/src/main/java/jme3test/android/DemoLaunchAdapter.java
  5. 38
      jme3-android/src/main/java/jme3test/android/DemoLaunchEntry.java
  6. 131
      jme3-android/src/main/java/jme3test/android/DemoMainActivity.java
  7. 46
      jme3-android/src/main/java/jme3test/android/R.java
  8. 40
      jme3-android/src/main/java/jme3test/android/SimpleSoundTest.java
  9. 150
      jme3-android/src/main/java/jme3test/android/SimpleTexturedTest.java
  10. 97
      jme3-android/src/main/java/jme3test/android/TestAmbient.java
  11. 95
      jme3-android/src/main/java/jme3test/android/TestBumpModel.java
  12. 102
      jme3-android/src/main/java/jme3test/android/TestMovingParticle.java
  13. 99
      jme3-android/src/main/java/jme3test/android/TestNormalMapping.java
  14. 70
      jme3-android/src/main/java/jme3test/android/TestSkyLoadingLagoon.java
  15. 68
      jme3-android/src/main/java/jme3test/android/TestSkyLoadingPrimitives.java
  16. 44
      jme3-android/src/main/java/jme3test/android/TestUnshadedModel.java
  17. 31
      jme3-android/src/main/resources/res/layout/about.xml
  18. 25
      jme3-android/src/main/resources/res/layout/tests.xml
  19. 12
      jme3-android/src/main/resources/res/menu/options.xml
  20. 6
      jme3-android/src/main/resources/res/values/strings.xml

@ -1,20 +0,0 @@
/* AUTO-GENERATED FILE. DO NOT MODIFY.
*
* This class was automatically generated by the
* aapt tool from the resource data it found. It
* should not be modified by hand.
*/
package com.jme3.app;
public final class R {
public static final class attr {
}
public static final class layout {
public static final int main=0x7f020000;
}
public static final class string {
public static final int app_name=0x7f030000;
public static final int jme3_appclass=0x7f030001;
}
}

@ -1,29 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.jme3.androiddemo"
android:versionCode="6"
android:versionName="1.2.2">
<uses-sdk android:targetSdkVersion="8" android:minSdkVersion="8" />
<!-- Tell the system that you need ES 2.0. -->
<uses-feature android:glEsVersion="0x00020000" android:required="true" />
<!-- Tell the system that you need distinct touches (for the zoom gesture). -->
<uses-feature android:name="android.hardware.touchscreen.multitouch.distinct" android:required="true" />
<application android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:name=".DemoMainActivity"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".DemoAndroidHarness"
android:label="@string/app_name">
</activity>
</application>
</manifest>

@ -1,25 +0,0 @@
package jme3test.android;
import android.content.pm.ActivityInfo;
import android.os.Bundle;
import com.jme3.app.AndroidHarness;
public class DemoAndroidHarness extends AndroidHarness
{
@Override
public void onCreate(Bundle savedInstanceState)
{
// Set the application class to run
// First Extract the bundle from intent
Bundle bundle = getIntent().getExtras();
//Next extract the values using the key as
appClass = bundle.getString("APPCLASSNAME");
exitDialogTitle = "Close Demo?";
exitDialogMessage = "Press Yes";
super.onCreate(savedInstanceState);
}
}

@ -1,72 +0,0 @@
package jme3test.android;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;
import java.util.List;
/**
* The view adapter which gets a list of LaunchEntries and displaqs them
* @author larynx
*
*/
public class DemoLaunchAdapter extends BaseAdapter implements OnClickListener
{
private Context context;
private List<DemoLaunchEntry> listDemos;
public DemoLaunchAdapter(Context context, List<DemoLaunchEntry> listDemos) {
this.context = context;
this.listDemos = listDemos;
}
public int getCount() {
return listDemos.size();
}
public Object getItem(int position) {
return listDemos.get(position);
}
public long getItemId(int position) {
return position;
}
public View getView(int position, View convertView, ViewGroup viewGroup) {
DemoLaunchEntry entry = listDemos.get(position);
if (convertView == null) {
LayoutInflater inflater = (LayoutInflater) context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
convertView = inflater.inflate(R.layout.demo_row, null);
}
TextView tvDemoName = (TextView) convertView.findViewById(R.id.tvDemoName);
tvDemoName.setText(entry.getName());
TextView tvDescription = (TextView) convertView.findViewById(R.id.tvDescription);
tvDescription.setText(entry.getDescription());
return convertView;
}
@Override
public void onClick(View view) {
DemoLaunchEntry entry = (DemoLaunchEntry) view.getTag();
}
private void showDialog(DemoLaunchEntry entry) {
// Create and show your dialog
// Depending on the Dialogs button clicks delete it or do nothing
}
}

@ -1,38 +0,0 @@
package jme3test.android;
/**
* Name (=appClass) and Description of one demo launch inside the main apk
* @author larynx
*
*/
public class DemoLaunchEntry
{
private String name;
private String description;
/**
* @param name
* @param description
*/
public DemoLaunchEntry(String name, String description) {
super();
this.name = name;
this.description = description;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
}

@ -1,131 +0,0 @@
package jme3test.android;
import android.app.Activity;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.os.Bundle;
import android.view.View;
import android.widget.*;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.AdapterView.OnItemSelectedListener;
import java.util.ArrayList;
import java.util.List;
public class DemoMainActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
final Intent myIntent = new Intent(DemoMainActivity.this, DemoAndroidHarness.class);
//Next create the bundle and initialize it
final Bundle bundle = new Bundle();
final Spinner spinnerConfig = (Spinner) findViewById(R.id.spinnerConfig);
ArrayAdapter<CharSequence> adapterDropDownConfig = ArrayAdapter.createFromResource(
this, R.array.eglconfig_array, android.R.layout.simple_spinner_item);
adapterDropDownConfig.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spinnerConfig.setAdapter(adapterDropDownConfig);
spinnerConfig.setOnItemSelectedListener(new OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parent,
View view, int pos, long id) {
Toast.makeText(parent.getContext(), "Set EGLConfig " +
parent.getItemAtPosition(pos).toString(), Toast.LENGTH_LONG).show();
//Add the parameters to bundle as
bundle.putString("EGLCONFIG", parent.getItemAtPosition(pos).toString());
}
public void onNothingSelected(AdapterView parent) {
// Do nothing.
}
});
final Spinner spinnerLogging = (Spinner) findViewById(R.id.spinnerLogging);
ArrayAdapter<CharSequence> adapterDropDownLogging = ArrayAdapter.createFromResource(
this, R.array.logging_array, android.R.layout.simple_spinner_item);
adapterDropDownLogging.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spinnerLogging.setAdapter(adapterDropDownLogging);
spinnerLogging.setOnItemSelectedListener(new OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parent,
View view, int pos, long id) {
Toast.makeText(parent.getContext(), "Set Logging " +
parent.getItemAtPosition(pos).toString(), Toast.LENGTH_LONG).show();
//Add the parameters to bundle as
bundle.putBoolean("VERBOSE", parent.getItemAtPosition(pos).toString().equals("Verbose"));
}
public void onNothingSelected(AdapterView parent) {
// Do nothing.
}
});
ListView list = (ListView) findViewById(R.id.ListView01);
list.setClickable(true);
final List<DemoLaunchEntry> listDemos = new ArrayList<DemoLaunchEntry>();
listDemos.add(new DemoLaunchEntry("jme3test.android.SimpleTexturedTest", "An field of textured boxes rotating"));
listDemos.add(new DemoLaunchEntry("jme3test.android.TestSkyLoadingLagoon", "Sky box demonstration with jpg"));
listDemos.add(new DemoLaunchEntry("jme3test.android.TestSkyLoadingPrimitives", "Sky box demonstration with png"));
listDemos.add(new DemoLaunchEntry("jme3test.android.TestBumpModel", "Shows a bump mapped well with a moving light"));
listDemos.add(new DemoLaunchEntry("jme3test.android.TestNormalMapping", "Shows a normal mapped sphere"));
listDemos.add(new DemoLaunchEntry("jme3test.android.TestUnshadedModel", "Shows an unshaded model of the sphere"));
listDemos.add(new DemoLaunchEntry("jme3test.android.TestMovingParticle", "Demonstrates particle effects"));
listDemos.add(new DemoLaunchEntry("jme3test.android.TestAmbient", "Positional sound - You sit in a dark cave under a waterfall"));
//listDemos.add(new DemoLaunchEntry("jme3test.effect.TestParticleEmitter", ""));
//listDemos.add(new DemoLaunchEntry("jme3test.effect.TestPointSprite", ""));
//listDemos.add(new DemoLaunchEntry("jme3test.light.TestLightRadius", ""));
listDemos.add(new DemoLaunchEntry("jme3test.android.TestMotionPath", "Shows cinematics - see a teapot on its journey - model loading needs a long time - just let it load, looks like freezed"));
//listDemos.add(new DemoLaunchEntry("com.jme3.androiddemo.TestSimpleWater", "Post processors - not working correctly due to missing framebuffer support, looks interresting :)"));
//listDemos.add(new DemoLaunchEntry("jme3test.model.TestHoverTank", ""));
//listDemos.add(new DemoLaunchEntry("jme3test.niftygui.TestNiftyGui", ""));
//listDemos.add(new DemoLaunchEntry("com.jme3.androiddemo.TestNiftyGui", ""));
DemoLaunchAdapter adapterList = new DemoLaunchAdapter(this, listDemos);
list.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> arg0, View view, int position, long index) {
System.out.println("onItemClick");
showToast(listDemos.get(position).getName());
//Add the parameters to bundle as
bundle.putString("APPCLASSNAME", listDemos.get(position).getName());
//Add this bundle to the intent
myIntent.putExtras(bundle);
//Start the JME3 app harness activity
DemoMainActivity.this.startActivity(myIntent);
}
});
list.setAdapter(adapterList);
}
private void showToast(String message) {
Toast.makeText(this, message, Toast.LENGTH_LONG).show();
}
}

@ -1,46 +0,0 @@
/* AUTO-GENERATED FILE. DO NOT MODIFY.
*
* This class was automatically generated by the
* aapt tool from the resource data it found. It
* should not be modified by hand.
*/
package jme3test.android;
public final class R {
public static final class array {
public static final int eglconfig_array=0x7f060000;
public static final int logging_array=0x7f060001;
}
public static final class attr {
}
public static final class drawable {
public static final int icon=0x7f020000;
}
public static final class id {
public static final int LinearLayout01=0x7f070000;
public static final int LinearLayout02=0x7f070002;
public static final int ListView01=0x7f070009;
public static final int TextView01=0x7f070003;
public static final int spinnerConfig=0x7f070006;
public static final int spinnerLogging=0x7f070008;
public static final int tvConfig=0x7f070005;
public static final int tvDemoName=0x7f070001;
public static final int tvDescription=0x7f070004;
public static final int tvLogging=0x7f070007;
}
public static final class layout {
public static final int demo_row=0x7f030000;
public static final int main=0x7f030001;
}
public static final class raw {
public static final int oddbounce=0x7f040000;
}
public static final class string {
public static final int app_name=0x7f050000;
public static final int eglconfig_prompt=0x7f050001;
public static final int eglconfig_text=0x7f050002;
public static final int logging_prompt=0x7f050003;
public static final int logging_text=0x7f050004;
}
}

@ -1,40 +0,0 @@
package jme3test.android;
import com.jme3.app.SimpleApplication;
import com.jme3.audio.AudioNode;
import com.jme3.input.MouseInput;
import com.jme3.input.controls.InputListener;
import com.jme3.input.controls.MouseButtonTrigger;
import com.jme3.math.Vector3f;
public class SimpleSoundTest extends SimpleApplication implements InputListener {
private AudioNode gun;
private AudioNode nature;
@Override
public void simpleInitApp() {
gun = new AudioNode(assetManager, "Sound/Effects/Gun.wav");
gun.setPositional(true);
gun.setLocalTranslation(new Vector3f(0, 0, 0));
gun.setMaxDistance(100);
gun.setRefDistance(5);
nature = new AudioNode(assetManager, "Sound/Environment/Nature.ogg", true);
nature.setVolume(3);
nature.setLooping(true);
nature.play();
inputManager.addMapping("click", new MouseButtonTrigger(MouseInput.BUTTON_LEFT));
inputManager.addListener(this, "click");
rootNode.attachChild(gun);
rootNode.attachChild(nature);
}
public void onAction(String name, boolean isPressed, float tpf) {
if (name.equals("click") && isPressed) {
gun.playInstance();
}
}
}

@ -1,150 +0,0 @@
/*
* Android 2.2+ SimpleTextured test.
*
* created: Mon Nov 8 00:08:22 EST 2010
*/
package jme3test.android;
import com.jme3.app.SimpleApplication;
import com.jme3.asset.TextureKey;
import com.jme3.light.PointLight;
import com.jme3.material.Material;
import com.jme3.math.ColorRGBA;
import com.jme3.math.Vector3f;
import com.jme3.scene.Geometry;
import com.jme3.scene.Mesh;
import com.jme3.scene.Node;
import com.jme3.scene.shape.Box;
import com.jme3.scene.shape.Sphere;
import com.jme3.texture.Texture;
import com.jme3.util.TangentBinormalGenerator;
public class SimpleTexturedTest extends SimpleApplication {
private static final java.util.logging.Logger logger = java.util.logging.Logger.getLogger(SimpleTexturedTest.class.getName());
private Node spheresContainer = new Node("spheres-container");
private boolean lightingEnabled = true;
private boolean texturedEnabled = true;
private boolean spheres = true;
@Override
public void simpleInitApp() {
//flyCam.setRotationSpeed(0.01f);
Mesh shapeSphere = null;
Mesh shapeBox = null;
shapeSphere = new Sphere(16, 16, .5f);
shapeBox = new Box(0.3f, 0.3f, 0.3f);
// ModelConverter.optimize(geom);
Texture texture = assetManager.loadTexture(new TextureKey("Interface/Logo/Monkey.jpg"));
Texture textureMonkey = assetManager.loadTexture(new TextureKey("Interface/Logo/Monkey.jpg"));
Material material = null;
Material materialMonkey = null;
if (texturedEnabled) {
if (lightingEnabled) {
material = new Material(assetManager, "Common/MatDefs/Light/Lighting.j3md");
material.setBoolean("VertexLighting", true);
material.setFloat("Shininess", 127);
material.setBoolean("LowQuality", true);
material.setTexture("DiffuseMap", texture);
materialMonkey = new Material(assetManager, "Common/MatDefs/Light/Lighting.j3md");
materialMonkey.setBoolean("VertexLighting", true);
materialMonkey.setFloat("Shininess", 127);
materialMonkey.setBoolean("LowQuality", true);
materialMonkey.setTexture("DiffuseMap", textureMonkey);
} else {
material = new Material(assetManager, "Common/MatDefs/Misc/SimpleTextured.j3md");
material.setTexture("ColorMap", texture);
materialMonkey = new Material(assetManager, "Common/MatDefs/Misc/SimpleTextured.j3md");
materialMonkey.setTexture("ColorMap", textureMonkey);
}
} else {
material = new Material(assetManager, "Common/MatDefs/Misc/SolidColor.j3md");
material.setColor("Color", ColorRGBA.Red);
materialMonkey = new Material(assetManager, "Common/MatDefs/Misc/SolidColor.j3md");
materialMonkey.setColor("Color", ColorRGBA.Red);
}
TangentBinormalGenerator.generate(shapeSphere);
TangentBinormalGenerator.generate(shapeBox);
int iFlipper = 0;
for (int y = -1; y < 2; y++) {
for (int x = -1; x < 2; x++){
Geometry geomClone = null;
//iFlipper++;
if (iFlipper % 2 == 0)
{
geomClone = new Geometry("geometry-" + y + "-" + x, shapeBox);
}
else
{
geomClone = new Geometry("geometry-" + y + "-" + x, shapeSphere);
}
if (iFlipper % 3 == 0)
{
geomClone.setMaterial(materialMonkey);
}
else
{
geomClone.setMaterial(material);
}
geomClone.setLocalTranslation(x, y, 0);
// Transform t = geom.getLocalTransform().clone();
// Transform t2 = geomClone.getLocalTransform().clone();
// t.combineWithParent(t2);
// geomClone.setLocalTransform(t);
spheresContainer.attachChild(geomClone);
}
}
spheresContainer.setLocalTranslation(new Vector3f(0, 0, -4f));
spheresContainer.setLocalScale(2.0f);
rootNode.attachChild(spheresContainer);
PointLight pointLight = new PointLight();
pointLight.setColor(new ColorRGBA(0.7f, 0.7f, 1.0f, 1.0f));
pointLight.setPosition(new Vector3f(0f, 0f, 0f));
pointLight.setRadius(8);
rootNode.addLight(pointLight);
}
@Override
public void simpleUpdate(float tpf) {
// secondCounter has been removed from SimpleApplication
//if (secondCounter == 0)
// logger.fine("Frames per second: " + timer.getFrameRate());
spheresContainer.rotate(0.2f * tpf, 0.4f * tpf, 0.8f * tpf);
}
}

@ -1,97 +0,0 @@
/*
* Copyright (c) 2009-2012 jMonkeyEngine
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* * Neither the name of 'jMonkeyEngine' nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package jme3test.android;
import android.media.SoundPool;
import com.jme3.app.SimpleApplication;
import com.jme3.audio.AudioNode;
import com.jme3.math.Vector3f;
public class TestAmbient extends SimpleApplication {
private AudioNode footsteps, beep;
private AudioNode nature, waves;
SoundPool soundPool;
// private PointAudioSource waves;
private float time = 0;
private float nextTime = 1;
public static void main(String[] args){
TestAmbient test = new TestAmbient();
test.start();
}
@Override
public void simpleInitApp()
{
/*
footsteps = new AudioNode(audioRenderer, assetManager, "Sound/Effects/Foot steps.ogg", true);
footsteps.setPositional(true);
footsteps.setLocalTranslation(new Vector3f(4, -1, 30));
footsteps.setMaxDistance(5);
footsteps.setRefDistance(1);
footsteps.setLooping(true);
beep = new AudioNode(audioRenderer, assetManager, "Sound/Effects/Beep.ogg", true);
beep.setVolume(3);
beep.setLooping(true);
audioRenderer.playSourceInstance(footsteps);
audioRenderer.playSource(beep);
*/
waves = new AudioNode(assetManager, "Sound/Environment/Ocean Waves.ogg", true);
waves.setPositional(true);
nature = new AudioNode(assetManager, "Sound/Environment/Nature.ogg", true);
waves.setLocalTranslation(new Vector3f(4, -1, 30));
waves.setMaxDistance(5);
waves.setRefDistance(1);
nature.setVolume(3);
audioRenderer.playSourceInstance(waves);
audioRenderer.playSource(nature);
}
@Override
public void simpleUpdate(float tpf)
{
}
}

@ -1,95 +0,0 @@
/*
* Copyright (c) 2009-2012 jMonkeyEngine
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* * Neither the name of 'jMonkeyEngine' nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package jme3test.android;
import com.jme3.app.SimpleApplication;
import com.jme3.light.AmbientLight;
import com.jme3.light.DirectionalLight;
import com.jme3.light.PointLight;
import com.jme3.material.Material;
import com.jme3.math.ColorRGBA;
import com.jme3.math.FastMath;
import com.jme3.math.Vector3f;
import com.jme3.scene.Geometry;
import com.jme3.scene.Spatial;
import com.jme3.scene.plugins.ogre.OgreMeshKey;
import com.jme3.scene.shape.Sphere;
import com.jme3.util.TangentBinormalGenerator;
public class TestBumpModel extends SimpleApplication {
float angle;
PointLight pl;
Spatial lightMdl;
public static void main(String[] args){
TestBumpModel app = new TestBumpModel();
app.start();
}
@Override
public void simpleInitApp() {
Spatial signpost = (Spatial) assetManager.loadAsset(new OgreMeshKey("Models/Sign Post/Sign Post.mesh.xml"));
signpost.setMaterial( (Material) assetManager.loadMaterial("Models/Sign Post/Sign Post.j3m"));
TangentBinormalGenerator.generate(signpost);
rootNode.attachChild(signpost);
lightMdl = new Geometry("Light", new Sphere(10, 10, 0.1f));
lightMdl.setMaterial( (Material) assetManager.loadMaterial("Common/Materials/RedColor.j3m"));
rootNode.attachChild(lightMdl);
// flourescent main light
pl = new PointLight();
pl.setColor(new ColorRGBA(0.88f, 0.92f, 0.95f, 1.0f));
rootNode.addLight(pl);
AmbientLight al = new AmbientLight();
al.setColor(new ColorRGBA(0.44f, 0.40f, 0.20f, 1.0f));
rootNode.addLight(al);
DirectionalLight dl = new DirectionalLight();
dl.setDirection(new Vector3f(1,-1,-1).normalizeLocal());
dl.setColor(new ColorRGBA(0.92f, 0.85f, 0.8f, 1.0f));
rootNode.addLight(dl);
}
@Override
public void simpleUpdate(float tpf){
angle += tpf * 0.25f;
angle %= FastMath.TWO_PI;
pl.setPosition(new Vector3f(FastMath.cos(angle) * 6f, 3f, FastMath.sin(angle) * 6f));
lightMdl.setLocalTranslation(pl.getPosition());
}
}

@ -1,102 +0,0 @@
/*
* Copyright (c) 2009-2012 jMonkeyEngine
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* * Neither the name of 'jMonkeyEngine' nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package jme3test.android;
import com.jme3.app.SimpleApplication;
import com.jme3.effect.ParticleEmitter;
import com.jme3.effect.ParticleMesh.Type;
import com.jme3.input.KeyInput;
import com.jme3.input.controls.ActionListener;
import com.jme3.input.controls.KeyTrigger;
import com.jme3.light.AmbientLight;
import com.jme3.material.Material;
import com.jme3.math.ColorRGBA;
import com.jme3.math.FastMath;
import com.jme3.math.Vector3f;
/**
* Particle that moves in a circle.
*
* @author Kirill Vainer
*/
public class TestMovingParticle extends SimpleApplication {
private ParticleEmitter emit;
private float angle = 0;
public static void main(String[] args) {
TestMovingParticle app = new TestMovingParticle();
app.start();
}
@Override
public void simpleInitApp() {
emit = new ParticleEmitter("Emitter", Type.Triangle, 300);
emit.setGravity(0, 0, 0);
emit.setVelocityVariation(1);
emit.setLowLife(1);
emit.setHighLife(1);
emit.setInitialVelocity(new Vector3f(0, .5f, 0));
emit.setImagesX(15);
Material mat = new Material(assetManager, "Common/MatDefs/Misc/Particle.j3md");
mat.setTexture("Texture", assetManager.loadTexture("Effects/Smoke/Smoke.png"));
emit.setMaterial(mat);
rootNode.attachChild(emit);
AmbientLight al = new AmbientLight();
al.setColor(new ColorRGBA(0.84f, 0.80f, 0.80f, 1.0f));
rootNode.addLight(al);
inputManager.addListener(new ActionListener() {
public void onAction(String name, boolean isPressed, float tpf) {
if ("setNum".equals(name) && isPressed) {
emit.setNumParticles(1000);
}
}
}, "setNum");
inputManager.addMapping("setNum", new KeyTrigger(KeyInput.KEY_SPACE));
}
@Override
public void simpleUpdate(float tpf) {
angle += tpf;
angle %= FastMath.TWO_PI;
float x = FastMath.cos(angle) * 2;
float y = FastMath.sin(angle) * 2;
emit.setLocalTranslation(x, 0, y);
}
}

@ -1,99 +0,0 @@
/*
* Copyright (c) 2009-2012 jMonkeyEngine
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* * Neither the name of 'jMonkeyEngine' nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package jme3test.android;
import com.jme3.app.SimpleApplication;
import com.jme3.light.AmbientLight;
import com.jme3.light.DirectionalLight;
import com.jme3.light.PointLight;
import com.jme3.material.Material;
import com.jme3.math.ColorRGBA;
import com.jme3.math.FastMath;
import com.jme3.math.Vector3f;
import com.jme3.scene.Geometry;
import com.jme3.scene.Spatial;
import com.jme3.scene.shape.Sphere;
import com.jme3.util.TangentBinormalGenerator;
public class TestNormalMapping extends SimpleApplication {
float angle;
PointLight pl;
Spatial lightMdl;
public static void main(String[] args){
TestNormalMapping app = new TestNormalMapping();
app.start();
}
@Override
public void simpleInitApp() {
Sphere sphMesh = new Sphere(32, 32, 1);
sphMesh.setTextureMode(Sphere.TextureMode.Projected);
sphMesh.updateGeometry(32, 32, 1, false, false);
TangentBinormalGenerator.generate(sphMesh);
Geometry sphere = new Geometry("Rock Ball", sphMesh);
Material mat = assetManager.loadMaterial("Textures/Terrain/Pond/Pond.j3m");
sphere.setMaterial(mat);
rootNode.attachChild(sphere);
lightMdl = new Geometry("Light", new Sphere(10, 10, 0.1f));
lightMdl.setMaterial(assetManager.loadMaterial("Common/Materials/RedColor.j3m"));
rootNode.attachChild(lightMdl);
pl = new PointLight();
pl.setColor(ColorRGBA.White);
pl.setPosition(new Vector3f(0f, 0f, 4f));
rootNode.addLight(pl);
AmbientLight al = new AmbientLight();
al.setColor(new ColorRGBA(0.44f, 0.40f, 0.20f, 1.0f));
rootNode.addLight(al);
DirectionalLight dl = new DirectionalLight();
dl.setDirection(new Vector3f(1,-1,-1).normalizeLocal());
dl.setColor(new ColorRGBA(0.92f, 0.85f, 0.8f, 1.0f));
rootNode.addLight(dl);
}
@Override
public void simpleUpdate(float tpf){
angle += tpf * 0.25f;
angle %= FastMath.TWO_PI;
pl.setPosition(new Vector3f(FastMath.cos(angle) * 4f, 0.5f, FastMath.sin(angle) * 4f));
lightMdl.setLocalTranslation(pl.getPosition());
}
}

@ -1,70 +0,0 @@
/*
* Copyright (c) 2009-2012 jMonkeyEngine
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* * Neither the name of 'jMonkeyEngine' nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package jme3test.android;
import com.jme3.app.SimpleApplication;
import com.jme3.scene.Spatial;
import com.jme3.texture.Texture;
import com.jme3.util.SkyFactory;
public class TestSkyLoadingLagoon extends SimpleApplication {
public static void main(String[] args){
TestSkyLoadingLagoon app = new TestSkyLoadingLagoon();
app.start();
}
public void simpleInitApp() {
Texture west = assetManager.loadTexture("Textures/Sky/Lagoon/lagoon_west.jpg");
Texture east = assetManager.loadTexture("Textures/Sky/Lagoon/lagoon_east.jpg");
Texture north = assetManager.loadTexture("Textures/Sky/Lagoon/lagoon_north.jpg");
Texture south = assetManager.loadTexture("Textures/Sky/Lagoon/lagoon_south.jpg");
Texture up = assetManager.loadTexture("Textures/Sky/Lagoon/lagoon_up.jpg");
Texture down = assetManager.loadTexture("Textures/Sky/Lagoon/lagoon_down.jpg");
/*
Texture west = assetManager.loadTexture("Textures/Sky/Primitives/primitives_positive_x.png");
Texture east = assetManager.loadTexture("Textures/Sky/Primitives/primitives_negative_x.png");
Texture north = assetManager.loadTexture("Textures/Sky/Primitives/primitives_negative_z.png");
Texture south = assetManager.loadTexture("Textures/Sky/Primitives/primitives_positive_z.png");
Texture up = assetManager.loadTexture("Textures/Sky/Primitives/primitives_positive_y.png");
Texture down = assetManager.loadTexture("Textures/Sky/Primitives/primitives_negative_y.png");
*/
Spatial sky = SkyFactory.createSky(assetManager, west, east, north, south, up, down);
rootNode.attachChild(sky);
}
}

@ -1,68 +0,0 @@
/*
* Copyright (c) 2009-2012 jMonkeyEngine
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* * Neither the name of 'jMonkeyEngine' nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package jme3test.android;
import com.jme3.app.SimpleApplication;
import com.jme3.scene.Spatial;
import com.jme3.texture.Texture;
import com.jme3.util.SkyFactory;
public class TestSkyLoadingPrimitives extends SimpleApplication {
public static void main(String[] args){
TestSkyLoadingPrimitives app = new TestSkyLoadingPrimitives();
app.start();
}
public void simpleInitApp() {
/*
Texture west = assetManager.loadTexture("Textures/Sky/Lagoon/lagoon_west.jpg");
Texture east = assetManager.loadTexture("Textures/Sky/Lagoon/lagoon_east.jpg");
Texture north = assetManager.loadTexture("Textures/Sky/Lagoon/lagoon_north.jpg");
Texture south = assetManager.loadTexture("Textures/Sky/Lagoon/lagoon_south.jpg");
Texture up = assetManager.loadTexture("Textures/Sky/Lagoon/lagoon_up.jpg");
Texture down = assetManager.loadTexture("Textures/Sky/Lagoon/lagoon_down.jpg");
*/
Texture west = assetManager.loadTexture("Textures/Sky/Primitives/primitives_positive_x.png");
Texture east = assetManager.loadTexture("Textures/Sky/Primitives/primitives_negative_x.png");
Texture north = assetManager.loadTexture("Textures/Sky/Primitives/primitives_negative_z.png");
Texture south = assetManager.loadTexture("Textures/Sky/Primitives/primitives_positive_z.png");
Texture up = assetManager.loadTexture("Textures/Sky/Primitives/primitives_positive_y.png");
Texture down = assetManager.loadTexture("Textures/Sky/Primitives/primitives_negative_y.png");
Spatial sky = SkyFactory.createSky(assetManager, west, east, north, south, up, down);
rootNode.attachChild(sky);
}
}

@ -1,44 +0,0 @@
package jme3test.android;
import com.jme3.app.SimpleApplication;
import com.jme3.light.AmbientLight;
import com.jme3.light.PointLight;
import com.jme3.material.Material;
import com.jme3.math.ColorRGBA;
import com.jme3.math.Vector3f;
import com.jme3.scene.Geometry;
import com.jme3.scene.shape.Sphere;
import com.jme3.util.TangentBinormalGenerator;
public class TestUnshadedModel extends SimpleApplication {
public static void main(String[] args){
TestUnshadedModel app = new TestUnshadedModel();
app.start();
}
@Override
public void simpleInitApp() {
Sphere sphMesh = new Sphere(32, 32, 1);
sphMesh.setTextureMode(Sphere.TextureMode.Projected);
sphMesh.updateGeometry(32, 32, 1, false, false);
TangentBinormalGenerator.generate(sphMesh);
Geometry sphere = new Geometry("Rock Ball", sphMesh);
Material mat = assetManager.loadMaterial("Textures/Terrain/Pond/Pond.j3m");
mat.setColor("Ambient", ColorRGBA.DarkGray);
mat.setColor("Diffuse", ColorRGBA.White);
mat.setBoolean("UseMaterialColors", true);
sphere.setMaterial(mat);
rootNode.attachChild(sphere);
PointLight pl = new PointLight();
pl.setColor(ColorRGBA.White);
pl.setPosition(new Vector3f(4f, 0f, 0f));
rootNode.addLight(pl);
AmbientLight al = new AmbientLight();
al.setColor(ColorRGBA.White);
rootNode.addLight(al);
}
}

@ -1,31 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<LinearLayout
android:id="@+id/buttonsContainer"
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="copyright (c) 2009-2010 JMonkeyEngine"
/>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="http://www.jmonkeyengine.org"
/>
</LinearLayout>
</LinearLayout>

@ -1,25 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<LinearLayout
android:id="@+id/buttonsContainer"
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<!--
<Button
android:id="@+id/SimpleTextured"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:text="Simple Textured"
android:layout_weight="1"
/>
-->
</LinearLayout>
</LinearLayout>

@ -1,12 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/about_button"
android:title="@string/about"
/>
<item
android:id="@+id/quit_button"
android:title="@string/quit"
/>
</menu>

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">JMEAndroidTest</string>
<string name="about">About</string>
<string name="quit">Quit</string>
</resources>
Loading…
Cancel
Save