Android: removed old apk code and added source of the curent beta1 demo apk.
Source is in: jme3test.android, only java classes and the android manifest.xml, not buildable without your own android project git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@8239 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
This commit is contained in:
parent
3402f51824
commit
7d315f04d9
@ -75,8 +75,25 @@ public class AndroidConfigChooser implements EGLConfigChooser
|
||||
|
||||
if (type == ConfigType.BEST)
|
||||
{
|
||||
ComponentSizeChooser compChooser = new ComponentSizeChooser(8, 8, 8, 8, 16, 0);
|
||||
ComponentSizeChooser compChooser = new ComponentSizeChooser(8, 8, 8, 8, 32, 0);
|
||||
choosenConfig = compChooser.chooseConfig(egl, display);
|
||||
|
||||
if (choosenConfig == null)
|
||||
{
|
||||
compChooser = new ComponentSizeChooser(8, 8, 8, 0, 32, 0);
|
||||
choosenConfig = compChooser.chooseConfig(egl, display);
|
||||
if (choosenConfig == null)
|
||||
{
|
||||
compChooser = new ComponentSizeChooser(8, 8, 8, 8, 16, 0);
|
||||
choosenConfig = compChooser.chooseConfig(egl, display);
|
||||
if (choosenConfig == null)
|
||||
{
|
||||
compChooser = new ComponentSizeChooser(8, 8, 8, 0, 16, 0);
|
||||
choosenConfig = compChooser.chooseConfig(egl, display);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
logger.info("JME3 using best EGL configuration available here: ");
|
||||
}
|
||||
else
|
||||
@ -103,10 +120,11 @@ public class AndroidConfigChooser implements EGLConfigChooser
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private int getPixelFormat(EGLConfig conf, EGLDisplay display, EGL10 egl)
|
||||
{
|
||||
int[] value = new int[1];
|
||||
int result = PixelFormat.RGB_565;
|
||||
int result = PixelFormat.RGB_565;
|
||||
|
||||
egl.eglGetConfigAttrib(display, conf, EGL10.EGL_RED_SIZE, value);
|
||||
if (value[0] == 8)
|
||||
@ -129,7 +147,8 @@ public class AndroidConfigChooser implements EGLConfigChooser
|
||||
logger.info("Using PixelFormat " + result);
|
||||
}
|
||||
|
||||
return result;
|
||||
//return result; TODO Test pixelformat
|
||||
return PixelFormat.TRANSPARENT;
|
||||
}
|
||||
|
||||
private int getOpenGLVersion(EGLConfig conf, EGLDisplay display, EGL10 egl)
|
||||
@ -181,30 +200,6 @@ public class AndroidConfigChooser implements EGLConfigChooser
|
||||
egl.eglGetConfigAttrib(display, conf, EGL10.EGL_SURFACE_TYPE, value);
|
||||
logger.info(String.format("EGL_SURFACE_TYPE = %d", value[0] ) );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// Getter - Setter
|
||||
|
||||
public EGLConfig getBestConfig()
|
||||
{
|
||||
return bestConfig;
|
||||
}
|
||||
|
||||
public void setBestConfig(EGLConfig bestConfig)
|
||||
{
|
||||
this.bestConfig = bestConfig;
|
||||
}
|
||||
public EGLConfig getFastestConfig()
|
||||
{
|
||||
return fastestConfig;
|
||||
}
|
||||
|
||||
public void setFastestConfig(EGLConfig fastestConfig)
|
||||
{
|
||||
this.fastestConfig = fastestConfig;
|
||||
}
|
||||
|
||||
public int getClientOpenGLESVersion()
|
||||
{
|
||||
@ -225,8 +220,11 @@ public class AndroidConfigChooser implements EGLConfigChooser
|
||||
|
||||
private abstract class BaseConfigChooser implements EGLConfigChooser
|
||||
{
|
||||
private boolean bClientOpenGLESVersionSet;
|
||||
|
||||
public BaseConfigChooser(int[] configSpec)
|
||||
{
|
||||
bClientOpenGLESVersionSet = false;
|
||||
mConfigSpec = filterConfigSpec(configSpec);
|
||||
}
|
||||
|
||||
@ -240,9 +238,11 @@ public class AndroidConfigChooser implements EGLConfigChooser
|
||||
|
||||
int numConfigs = num_config[0];
|
||||
|
||||
if (numConfigs <= 0) {
|
||||
throw new IllegalArgumentException(
|
||||
"No configs match configSpec");
|
||||
if (numConfigs <= 0)
|
||||
{
|
||||
//throw new IllegalArgumentException("No configs match configSpec");
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
EGLConfig[] configs = new EGLConfig[numConfigs];
|
||||
@ -251,9 +251,9 @@ public class AndroidConfigChooser implements EGLConfigChooser
|
||||
throw new IllegalArgumentException("eglChooseConfig#2 failed");
|
||||
}
|
||||
EGLConfig config = chooseConfig(egl, display, configs);
|
||||
if (config == null) {
|
||||
throw new IllegalArgumentException("No config chosen");
|
||||
}
|
||||
//if (config == null) {
|
||||
// throw new IllegalArgumentException("No config chosen");
|
||||
//}
|
||||
return config;
|
||||
}
|
||||
|
||||
@ -264,7 +264,7 @@ public class AndroidConfigChooser implements EGLConfigChooser
|
||||
|
||||
private int[] filterConfigSpec(int[] configSpec)
|
||||
{
|
||||
if (clientOpenGLESVersion != 2) {
|
||||
if (bClientOpenGLESVersionSet == true) {
|
||||
return configSpec;
|
||||
}
|
||||
/* We know none of the subclasses define EGL_RENDERABLE_TYPE.
|
||||
@ -276,6 +276,9 @@ public class AndroidConfigChooser implements EGLConfigChooser
|
||||
newConfigSpec[len-1] = EGL10.EGL_RENDERABLE_TYPE;
|
||||
newConfigSpec[len] = 4; /* EGL_OPENGL_ES2_BIT */
|
||||
newConfigSpec[len+1] = EGL10.EGL_NONE;
|
||||
|
||||
bClientOpenGLESVersionSet = true;
|
||||
|
||||
return newConfigSpec;
|
||||
}
|
||||
}
|
||||
|
@ -1,65 +0,0 @@
|
||||
package jme3test.android;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
|
||||
import android.content.Intent;
|
||||
|
||||
import android.view.View;
|
||||
import android.view.MenuInflater;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.MotionEvent;
|
||||
|
||||
import android.widget.TextView;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.TableLayout;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TableRow;
|
||||
|
||||
import android.hardware.SensorManager;
|
||||
//import android.hardware.SensorListener;
|
||||
|
||||
import jme3test.android.AndroidActivity;
|
||||
|
||||
import java.net.URI;
|
||||
|
||||
public class AboutActivity extends Activity {
|
||||
|
||||
private static final java.util.logging.Logger logger = java.util.logging.Logger.getLogger(AboutActivity.class.getName());
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
logger.info("onCreate(" + savedInstanceState + ")");
|
||||
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
//setContentView(R.layout.about);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
logger.info("onDestroy()");
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStart() {
|
||||
super.onStart();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStop() {
|
||||
super.onStop();
|
||||
}
|
||||
}
|
@ -1,149 +0,0 @@
|
||||
|
||||
/*
|
||||
*
|
||||
* Android Activity for OpenGL ES2 based tests
|
||||
* requires Android 2.2+
|
||||
*
|
||||
* created: Mon Nov 8 00:08:07 EST 2010
|
||||
*/
|
||||
package jme3test.android;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.res.Resources;
|
||||
import android.opengl.GLSurfaceView;
|
||||
import android.os.Bundle;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
|
||||
import com.jme3.system.AppSettings;
|
||||
import com.jme3.system.JmeSystem;
|
||||
import com.jme3.system.android.OGLESContext;
|
||||
|
||||
import com.jme3.app.Application;
|
||||
import com.jme3.app.SimpleApplication;
|
||||
|
||||
public class AndroidActivity extends Activity {
|
||||
|
||||
private final static java.util.logging.Logger logger = java.util.logging.Logger.getLogger(AndroidActivity.class.getName());
|
||||
private OGLESContext ctx;
|
||||
private GLSurfaceView view;
|
||||
private boolean useVA = false;
|
||||
private boolean verboseLogging = false;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
JmeSystem.setResources(getResources());
|
||||
|
||||
requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
|
||||
WindowManager.LayoutParams.FLAG_FULLSCREEN);
|
||||
|
||||
AppSettings settings = new AppSettings(true);
|
||||
|
||||
String testClassName = getIntent().getStringExtra(AndroidActivity.class.getName() + ".TEST_CLASS_NAME");
|
||||
|
||||
logger.info("test class name: [" + testClassName + "]");
|
||||
|
||||
String appClass = (testClassName != null ? testClassName : "jme3test.android.SimpleTexturedTest");
|
||||
|
||||
useVA = getIntent().getBooleanExtra(AndroidActivity.class.getName() + ".USE_VA", false);
|
||||
|
||||
logger.info("USE_VA -> [" + useVA + "]");
|
||||
|
||||
settings.putBoolean("USE_VA", useVA);
|
||||
|
||||
verboseLogging = getIntent().getBooleanExtra(AndroidActivity.class.getName() + ".VERBOSE_LOGGING", false);
|
||||
|
||||
settings.putBoolean("VERBOSE_LOGGING", verboseLogging);
|
||||
|
||||
Application app = null;
|
||||
|
||||
try {
|
||||
Class<? extends Application> clazz = (Class<? extends Application>) Class.forName(
|
||||
appClass);
|
||||
|
||||
app = clazz.newInstance();
|
||||
/*
|
||||
app = (Application) java.lang.reflect.Proxy.newProxyInstance(
|
||||
this.getClass().getClassLoader(),
|
||||
new Class[] {Class.forName(appClass)},
|
||||
|
||||
new java.lang.reflect.InvocationHandler() {
|
||||
public Object invoke(Object proxy, java.lang.reflect.Method method, Object[] args) throws Throwable {
|
||||
if (
|
||||
method.getName().equals("loadFPSText") ||
|
||||
method.getName().equals("loadStatsView")
|
||||
) {
|
||||
logger.info("ignoring method: [" + method + "]");
|
||||
return null;
|
||||
}
|
||||
|
||||
return method.invoke(proxy, args);
|
||||
}
|
||||
}
|
||||
);
|
||||
*/
|
||||
|
||||
|
||||
if (app instanceof SimpleApplication) {
|
||||
((SimpleApplication) app).setShowSettings(false);
|
||||
}
|
||||
|
||||
logger.info("setting settings ...");
|
||||
app.setSettings(settings);
|
||||
logger.info("setting settings ... done.");
|
||||
|
||||
logger.info("starting app ...");
|
||||
app.start();
|
||||
logger.info("starting app ... done.");
|
||||
|
||||
if (app instanceof SimpleApplication) {
|
||||
((SimpleApplication) app).getGuiNode().detachAllChildren();
|
||||
}
|
||||
|
||||
logger.info("creating context ...");
|
||||
ctx = (OGLESContext) app.getContext();
|
||||
logger.info("creating context ... done.");
|
||||
|
||||
ctx.setSettings(settings);
|
||||
|
||||
logger.info("creating view ...");
|
||||
view = ctx.createView(this);
|
||||
logger.info("creating view ... done.");
|
||||
|
||||
logger.info("setting content view ...");
|
||||
setContentView(view);
|
||||
logger.info("setting content done ...");
|
||||
|
||||
} catch (Throwable exception) {
|
||||
logger.warning("exception: " + exception);
|
||||
exception.printStackTrace(System.err);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
logger.info("onResume ...");
|
||||
super.onResume();
|
||||
logger.info("view.onResume ...");
|
||||
|
||||
view.onResume();
|
||||
|
||||
logger.info("view.onResume ... done.");
|
||||
logger.info("onResume ... done.");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
view.onPause();
|
||||
}
|
||||
// @Override
|
||||
// protected void onDestroy(){
|
||||
// super.onDestroy();
|
||||
// Debug.stopMethodTracing();
|
||||
// }
|
||||
}
|
29
engine/src/android/jme3test/android/AndroidManifest.xml
Normal file
29
engine/src/android/jme3test/android/AndroidManifest.xml
Normal file
@ -0,0 +1,29 @@
|
||||
<?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>
|
55
engine/src/android/jme3test/android/DemoAndroidHarness.java
Normal file
55
engine/src/android/jme3test/android/DemoAndroidHarness.java
Normal file
@ -0,0 +1,55 @@
|
||||
package jme3test.android;
|
||||
|
||||
import android.content.pm.ActivityInfo;
|
||||
import android.os.Bundle;
|
||||
|
||||
import com.jme3.app.AndroidHarness;
|
||||
import com.jme3.system.android.AndroidConfigChooser.ConfigType;
|
||||
|
||||
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");
|
||||
|
||||
|
||||
String eglConfig = bundle.getString("EGLCONFIG");
|
||||
if (eglConfig.equals("Best"))
|
||||
{
|
||||
eglConfigType = ConfigType.BEST;
|
||||
}
|
||||
else if (eglConfig.equals("Legacy"))
|
||||
{
|
||||
eglConfigType = ConfigType.LEGACY;
|
||||
}
|
||||
else
|
||||
{
|
||||
eglConfigType = ConfigType.FASTEST;
|
||||
}
|
||||
|
||||
|
||||
if (bundle.getBoolean("VERBOSE"))
|
||||
{
|
||||
eglConfigVerboseLogging = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
eglConfigVerboseLogging = false;
|
||||
}
|
||||
|
||||
|
||||
exitDialogTitle = "Close Demo?";
|
||||
exitDialogMessage = "Press Yes";
|
||||
|
||||
screenOrientation = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE;
|
||||
|
||||
super.onCreate(savedInstanceState);
|
||||
}
|
||||
|
||||
}
|
73
engine/src/android/jme3test/android/DemoLaunchAdapter.java
Normal file
73
engine/src/android/jme3test/android/DemoLaunchAdapter.java
Normal file
@ -0,0 +1,73 @@
|
||||
package jme3test.android;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.TextView;
|
||||
|
||||
/**
|
||||
* 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
|
||||
}
|
||||
|
||||
}
|
||||
|
38
engine/src/android/jme3test/android/DemoLaunchEntry.java
Normal file
38
engine/src/android/jme3test/android/DemoLaunchEntry.java
Normal file
@ -0,0 +1,38 @@
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
136
engine/src/android/jme3test/android/DemoMainActivity.java
Normal file
136
engine/src/android/jme3test/android/DemoMainActivity.java
Normal file
@ -0,0 +1,136 @@
|
||||
package jme3test.android;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.ActivityInfo;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.AdapterView.OnItemSelectedListener;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.ListView;
|
||||
import android.widget.Spinner;
|
||||
import android.widget.Toast;
|
||||
import android.widget.AdapterView.OnItemClickListener;
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
46
engine/src/android/jme3test/android/R.java
Normal file
46
engine/src/android/jme3test/android/R.java
Normal file
@ -0,0 +1,46 @@
|
||||
/* 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;
|
||||
}
|
||||
}
|
@ -4,8 +4,10 @@
|
||||
*
|
||||
* created: Mon Nov 8 00:08:22 EST 2010
|
||||
*/
|
||||
|
||||
package jme3test.android;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
|
||||
@ -33,95 +35,130 @@ import com.jme3.util.TangentBinormalGenerator;
|
||||
|
||||
import jme3tools.converters.model.ModelConverter;
|
||||
|
||||
import java.awt.font.*;
|
||||
|
||||
|
||||
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;
|
||||
private static final java.util.logging.Logger logger = java.util.logging.Logger.getLogger(SimpleTexturedTest.class.getName());
|
||||
|
||||
@Override
|
||||
public void simpleInitApp() {
|
||||
|
||||
/*
|
||||
* GUI rendering is broken on Android right now and prevents the main view from rendering.
|
||||
* Detaching all children lets the main view to be rendered.
|
||||
*/
|
||||
private Node spheresContainer = new Node("spheres-container");
|
||||
|
||||
guiNode.detachAllChildren();
|
||||
|
||||
Mesh shape = null;
|
||||
private boolean lightingEnabled = true;
|
||||
private boolean texturedEnabled = true;
|
||||
private boolean spheres = true;
|
||||
|
||||
if (spheres) {
|
||||
shape = new Sphere(16, 16, .5f);
|
||||
} else {
|
||||
shape = new Box(Vector3f.ZERO, 0.3f, 0.3f, 0.3f);
|
||||
}
|
||||
@Override
|
||||
public void simpleInitApp() {
|
||||
|
||||
//flyCam.setRotationSpeed(0.01f);
|
||||
|
||||
// ModelConverter.optimize(geom);
|
||||
|
||||
Texture texture = assetManager.loadTexture(new TextureKey("icons/textured.png"));
|
||||
Mesh shapeSphere = null;
|
||||
Mesh shapeBox = null;
|
||||
|
||||
Material material = 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);
|
||||
} else {
|
||||
material = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
|
||||
material.setTexture("ColorMap", texture);
|
||||
}
|
||||
} else {
|
||||
material = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
|
||||
material.setColor("Color", ColorRGBA.Red);
|
||||
}
|
||||
shapeSphere = new Sphere(16, 16, .5f);
|
||||
shapeBox = new Box(Vector3f.ZERO, 0.3f, 0.3f, 0.3f);
|
||||
|
||||
TangentBinormalGenerator.generate(shape);
|
||||
|
||||
for (int y = -1; y < 2; y++) {
|
||||
for (int x = -1; x < 2; x++) {
|
||||
// int x = 0;
|
||||
// int y = 0;
|
||||
Geometry geomClone = new Geometry("geometry-" + y + "-" + x, shape);
|
||||
geomClone.setMaterial(material);
|
||||
geomClone.setLocalTranslation(x, y, 0);
|
||||
// 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.attachChild(geomClone);
|
||||
}
|
||||
}
|
||||
|
||||
spheresContainer.setLocalTranslation(new Vector3f(0, 0, -4f));
|
||||
spheresContainer.setLocalScale(2.0f);
|
||||
spheresContainer.setLocalTranslation(new Vector3f(0, 0, -4f));
|
||||
spheresContainer.setLocalScale(2.0f);
|
||||
|
||||
rootNode.attachChild(spheresContainer);
|
||||
rootNode.attachChild(spheresContainer);
|
||||
|
||||
PointLight pointLight = new PointLight();
|
||||
PointLight pointLight = new PointLight();
|
||||
|
||||
pointLight.setColor(new ColorRGBA(0.7f, 0.7f, 1.0f, 1.0f));
|
||||
pointLight.setColor(new ColorRGBA(0.7f, 0.7f, 1.0f, 1.0f));
|
||||
|
||||
pointLight.setPosition(new Vector3f(0f, 0f, 0f));
|
||||
pointLight.setRadius(8);
|
||||
pointLight.setPosition(new Vector3f(0f, 0f, 0f));
|
||||
pointLight.setRadius(8);
|
||||
|
||||
rootNode.addLight(pointLight);
|
||||
}
|
||||
rootNode.addLight(pointLight);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void simpleUpdate(float tpf) {
|
||||
@Override
|
||||
public void simpleUpdate(float tpf) {
|
||||
|
||||
if (secondCounter == 0) {
|
||||
logger.info("Frames per second: " + timer.getFrameRate());
|
||||
}
|
||||
if (secondCounter == 0)
|
||||
logger.info("Frames per second: " + timer.getFrameRate());
|
||||
|
||||
spheresContainer.rotate(0.2f * tpf, 0.4f * tpf, 0.8f * tpf);
|
||||
}
|
||||
|
||||
spheresContainer.rotate(0.2f * tpf, 0.4f * tpf, 0.8f * tpf);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,40 +0,0 @@
|
||||
package jme3test.android;
|
||||
|
||||
import com.jme3.app.SimpleApplication;
|
||||
import com.jme3.asset.TextureKey;
|
||||
import com.jme3.material.Material;
|
||||
import com.jme3.math.Transform;
|
||||
import com.jme3.scene.Geometry;
|
||||
import com.jme3.scene.shape.Sphere;
|
||||
import com.jme3.texture.Texture;
|
||||
import jme3tools.converters.model.ModelConverter;
|
||||
|
||||
public class Test extends SimpleApplication {
|
||||
|
||||
@Override
|
||||
public void simpleInitApp() {
|
||||
Sphere s = new Sphere(8, 8, .5f);
|
||||
Geometry geom = new Geometry("sphere", s);
|
||||
// ModelConverter.optimize(geom);
|
||||
|
||||
Material mat = new Material(assetManager, "plain_texture.j3md");
|
||||
Texture tex = assetManager.loadTexture(new TextureKey("monkey.j3i"));
|
||||
mat.setTexture("ColorMap", tex);
|
||||
// geom.setMaterial(mat);
|
||||
|
||||
for (int y = -1; y < 2; y++) {
|
||||
for (int x = -1; x < 2; x++) {
|
||||
Geometry geomClone = new Geometry("geom", s);
|
||||
geomClone.setMaterial(mat);
|
||||
geomClone.setLocalTranslation(x, y, 0);
|
||||
|
||||
Transform t = geom.getLocalTransform().clone();
|
||||
Transform t2 = geomClone.getLocalTransform().clone();
|
||||
t.combineWithParent(t2);
|
||||
geomClone.setLocalTransform(t);
|
||||
|
||||
rootNode.attachChild(geomClone);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
106
engine/src/android/jme3test/android/TestAmbient.java
Normal file
106
engine/src/android/jme3test/android/TestAmbient.java
Normal file
@ -0,0 +1,106 @@
|
||||
/*
|
||||
* Copyright (c) 2009-2010 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.app.Activity;
|
||||
import android.media.AudioManager;
|
||||
import android.media.SoundPool;
|
||||
|
||||
import com.jme3.app.SimpleApplication;
|
||||
import com.jme3.asset.DesktopAssetManager;
|
||||
import com.jme3.audio.AudioNode;
|
||||
import com.jme3.audio.Listener;
|
||||
//import com.jme3.audio.PointAudioSource;
|
||||
import com.jme3.math.FastMath;
|
||||
import com.jme3.math.Vector3f;
|
||||
import com.jme3.system.AppSettings;
|
||||
import com.jme3.system.JmeSystem;
|
||||
|
||||
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(audioRenderer, assetManager, "Sound/Environment/Ocean Waves.ogg", true);
|
||||
waves.setPositional(true);
|
||||
|
||||
nature = new AudioNode(audioRenderer, 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)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
96
engine/src/android/jme3test/android/TestBumpModel.java
Normal file
96
engine/src/android/jme3test/android/TestBumpModel.java
Normal file
@ -0,0 +1,96 @@
|
||||
/*
|
||||
* Copyright (c) 2009-2010 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.asset.AssetKey;
|
||||
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());
|
||||
}
|
||||
|
||||
}
|
104
engine/src/android/jme3test/android/TestMovingParticle.java
Normal file
104
engine/src/android/jme3test/android/TestMovingParticle.java
Normal file
@ -0,0 +1,104 @@
|
||||
/*
|
||||
* Copyright (c) 2009-2010 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.effect.shapes.EmitterSphereShape;
|
||||
import com.jme3.input.KeyInput;
|
||||
import com.jme3.input.controls.ActionListener;
|
||||
import com.jme3.input.controls.InputListener;
|
||||
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);
|
||||
}
|
||||
}
|
99
engine/src/android/jme3test/android/TestNormalMapping.java
Normal file
99
engine/src/android/jme3test/android/TestNormalMapping.java
Normal file
@ -0,0 +1,99 @@
|
||||
/*
|
||||
* Copyright (c) 2009-2010 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,35 +0,0 @@
|
||||
package jme3test.android;
|
||||
|
||||
import com.jme3.app.SimpleApplication;
|
||||
import com.jme3.math.Quaternion;
|
||||
import com.jme3.math.Vector3f;
|
||||
import com.jme3.scene.Node;
|
||||
import com.jme3.scene.Spatial;
|
||||
import com.jme3.scene.Spatial.CullHint;
|
||||
|
||||
public class TestSceneLoading extends SimpleApplication {
|
||||
|
||||
private void setState(Spatial s) {
|
||||
s.setCullHint(CullHint.Never);
|
||||
if (s instanceof Node) {
|
||||
Node n = (Node) s;
|
||||
for (int i = 0; i < n.getQuantity(); i++) {
|
||||
Spatial s2 = n.getChild(i);
|
||||
setState(s2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void simpleInitApp() {
|
||||
/* XXX: does not compile */
|
||||
|
||||
/* Spatial scene = inputManager.loadModel("FINAL_LEVEL2.j3o");
|
||||
// setState(scene);
|
||||
rootNode.attachChild(scene);
|
||||
|
||||
cam.setLocation(new Vector3f(-18.059685f, 34.64228f, 4.5048084f));
|
||||
cam.setRotation(new Quaternion(0.22396432f, 0.5235024f, -0.1448922f, 0.8091919f));
|
||||
cam.update();
|
||||
*/
|
||||
}
|
||||
}
|
@ -0,0 +1,71 @@
|
||||
/*
|
||||
* Copyright (c) 2009-2010 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;
|
||||
import com.jme3.util.android.AndroidSkyFactory;
|
||||
|
||||
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 = AndroidSkyFactory.createSky(assetManager, west, east, north, south, up, down);
|
||||
rootNode.attachChild(sky);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,69 @@
|
||||
/*
|
||||
* Copyright (c) 2009-2010 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;
|
||||
import com.jme3.util.android.AndroidSkyFactory;
|
||||
|
||||
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 = AndroidSkyFactory.createSky(assetManager, west, east, north, south, up, down);
|
||||
rootNode.attachChild(sky);
|
||||
}
|
||||
|
||||
}
|
44
engine/src/android/jme3test/android/TestUnshadedModel.java
Normal file
44
engine/src/android/jme3test/android/TestUnshadedModel.java
Normal file
@ -0,0 +1,44 @@
|
||||
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,171 +0,0 @@
|
||||
package jme3test.android;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
|
||||
import android.content.Intent;
|
||||
|
||||
import android.view.View;
|
||||
import android.view.MenuInflater;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.MotionEvent;
|
||||
|
||||
import android.widget.TextView;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.TableLayout;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TableRow;
|
||||
|
||||
import android.hardware.SensorManager;
|
||||
//import android.hardware.SensorListener;
|
||||
|
||||
import jme3test.android.AndroidActivity;
|
||||
|
||||
import java.net.URI;
|
||||
|
||||
public class TestsActivity extends Activity {
|
||||
|
||||
private static final java.util.logging.Logger logger = java.util.logging.Logger.getLogger(TestsActivity.class.getName());
|
||||
|
||||
public static class Test {
|
||||
|
||||
private String name = null;
|
||||
private String className = null;
|
||||
|
||||
public Test(String name, String className) {
|
||||
this.name = name;
|
||||
this.className = className;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public String getClassName() {
|
||||
return className;
|
||||
}
|
||||
}
|
||||
private final static Test[] tests = {
|
||||
new Test("SimpleTextured", "jme3test.android.SimpleTexturedTest"),
|
||||
new Test("light.TestLightRadius", "jme3test.light.TestLightRadius"),
|
||||
new Test("bullet.TestSimplePhysics", "jme3test.bullet.TestSimplePhysics"),
|
||||
new Test("helloworld.HelloJME3", "jme3test.helloworld.HelloJME3"),
|
||||
new Test("helloworld.HelloLoop", "jme3test.helloworld.HelloLoop"),
|
||||
new Test("helloworld.HelloNode", "jme3test.helloworld.HelloNode"),
|
||||
new Test("helloworld.HelloEffects", "jme3test.helloworld.HelloEffects"),
|
||||
new Test("helloworld.HelloTerrain", "jme3test.helloworld.HelloTerrain")
|
||||
};
|
||||
private boolean useVA;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
logger.info("onCreate(" + savedInstanceState + ")");
|
||||
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
//setContentView(R.layout.tests);
|
||||
|
||||
try {
|
||||
|
||||
useVA = true;
|
||||
|
||||
//LinearLayout buttonsContainer = (LinearLayout) findViewById(R.id.buttonsContainer);
|
||||
|
||||
|
||||
for (Test test : tests) {
|
||||
final Button button = new Button(this);
|
||||
final String finalName = test.getName();
|
||||
final String finalClassName = test.getClassName();
|
||||
|
||||
button.setText(test.getName());
|
||||
// button.setTextSize(10.0f);
|
||||
// button.setTextColor(Color.rgb(100, 200, 200));
|
||||
//buttonsContainer.addView(button);
|
||||
|
||||
button.setOnClickListener(
|
||||
new View.OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
Intent intent = new Intent(view.getContext(), AndroidActivity.class);
|
||||
intent.putExtra(AndroidActivity.class.getName() + ".TEST_CLASS_NAME", finalClassName);
|
||||
intent.putExtra(AndroidActivity.class.getName() + ".USE_VA", useVA);
|
||||
startActivityForResult(intent, 0);
|
||||
}
|
||||
});
|
||||
}
|
||||
} catch (Exception exception) {
|
||||
logger.warning("exception: " + exception);
|
||||
exception.printStackTrace(System.err);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
logger.info("onDestroy()");
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStart() {
|
||||
super.onStart();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStop() {
|
||||
super.onStop();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
MenuInflater inflater = getMenuInflater();
|
||||
//inflater.inflate(R.menu.options, menu);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
/*
|
||||
switch (item.getItemId()) {
|
||||
case R.id.about_button:
|
||||
about();
|
||||
return true;
|
||||
case R.id.quit_button:
|
||||
quit();
|
||||
return true;
|
||||
default:
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
*/
|
||||
return false;
|
||||
}
|
||||
|
||||
private void quit() {
|
||||
finish();
|
||||
}
|
||||
|
||||
private void about() {
|
||||
// Intent intent = new Intent(getView().getContext(), AboutActivity.class);
|
||||
try {
|
||||
Intent intent = new Intent();
|
||||
intent.setClassName(
|
||||
"jme3test.android",
|
||||
"jme3test.android.AboutActivity");
|
||||
startActivity(intent);
|
||||
} catch (Exception exception) {
|
||||
logger.warning("exception: " + exception);
|
||||
exception.printStackTrace(System.err);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user