From 33429083ba682bb6d267d4a76d5e51d37a7468a9 Mon Sep 17 00:00:00 2001 From: Etienne Caron Date: Tue, 2 Aug 2016 08:24:28 -0400 Subject: [PATCH] Cleaning up the examples. --- commonLib/build.gradle | 8 +- rajaDemo/build.gradle | 35 ++---- rajaDemo/src/main/AndroidManifest.xml | 4 +- .../raja/BaselineRenderingFragment.java | 99 +++++++++++++++ .../rajademo => raja}/DemoFragment.java | 72 +++++------ .../rajademo => raja}/MainActivity.java | 13 +- .../tangotalk/rajademo/AExampleFragment.java | 119 ------------------ .../tangotalk/rajademo/BasicFragment.java | 57 --------- .../layout/rajawali_surfaceview_fragment.xml | 2 +- .../layout/rajawali_textureview_fragment.xml | 2 +- .../raja/DeviceExtrinsics.java | 2 +- .../{tangotalk => raja}/raja/Pose.java | 2 +- .../raja/ScenePoseCalculator.java | 2 +- .../raja/TouchViewHandler.java | 2 +- .../raja/renderables/FrustumAxes.java | 2 +- .../raja/renderables/Grid.java | 2 +- .../raja/renderables/PointCloud.java | 4 +- .../raja/renderables/Trajectory.java | 2 +- .../raja/renderables/package-info.java | 2 +- .../raja/renderables/primitives/Points.java | 2 +- .../renderables/primitives/package-info.java | 2 +- rajaVrDemo/build.gradle | 9 +- .../com/kanawish/raja/vr/DemoVRRenderer.java | 19 ++- .../kanawish/raja/vr/FakeCrashLibrary.java | 20 --- .../main/java/com/kanawish/raja/vr/VrApp.java | 22 +--- .../vr/renderer/RajaStereoRenderer.java | 5 +- .../org/rajawali3d/vr/surface/RajaVrView.java | 38 +----- tangoRoomEditor/src/main/AndroidManifest.xml | 4 +- .../controlroom/ControlRoomActivity.java | 2 +- .../controlroom/ControlRoomRenderer.java | 5 +- .../controlroom/PlanFittingApplication.java | 2 +- .../src/main/res/layout/activity_main.xml | 2 +- 32 files changed, 195 insertions(+), 368 deletions(-) create mode 100644 rajaDemo/src/main/java/com/kanawish/raja/BaselineRenderingFragment.java rename rajaDemo/src/main/java/com/kanawish/{tangotalk/rajademo => raja}/DemoFragment.java (74%) rename rajaDemo/src/main/java/com/kanawish/{tangotalk/rajademo => raja}/MainActivity.java (65%) delete mode 100644 rajaDemo/src/main/java/com/kanawish/tangotalk/rajademo/AExampleFragment.java delete mode 100644 rajaDemo/src/main/java/com/kanawish/tangotalk/rajademo/BasicFragment.java rename rajaTangoLib/src/main/java/com/kanawish/{tangotalk => raja}/raja/DeviceExtrinsics.java (98%) rename rajaTangoLib/src/main/java/com/kanawish/{tangotalk => raja}/raja/Pose.java (97%) rename rajaTangoLib/src/main/java/com/kanawish/{tangotalk => raja}/raja/ScenePoseCalculator.java (99%) rename rajaTangoLib/src/main/java/com/kanawish/{tangotalk => raja}/raja/TouchViewHandler.java (99%) rename rajaTangoLib/src/main/java/com/kanawish/{tangotalk => raja}/raja/renderables/FrustumAxes.java (98%) rename rajaTangoLib/src/main/java/com/kanawish/{tangotalk => raja}/raja/renderables/Grid.java (97%) rename rajaTangoLib/src/main/java/com/kanawish/{tangotalk => raja}/raja/renderables/PointCloud.java (96%) rename rajaTangoLib/src/main/java/com/kanawish/{tangotalk => raja}/raja/renderables/Trajectory.java (98%) rename rajaTangoLib/src/main/java/com/kanawish/{tangotalk => raja}/raja/renderables/package-info.java (93%) rename rajaTangoLib/src/main/java/com/kanawish/{tangotalk => raja}/raja/renderables/primitives/Points.java (98%) rename rajaTangoLib/src/main/java/com/kanawish/{tangotalk => raja}/raja/renderables/primitives/package-info.java (91%) delete mode 100644 rajaVrDemo/src/main/java/com/kanawish/raja/vr/FakeCrashLibrary.java rename tangoRoomEditor/src/main/java/com/kanawish/{tangotalk => raja}/controlroom/ControlRoomActivity.java (99%) rename tangoRoomEditor/src/main/java/com/kanawish/{tangotalk => raja}/controlroom/ControlRoomRenderer.java (98%) rename tangoRoomEditor/src/main/java/com/kanawish/{tangotalk => raja}/controlroom/PlanFittingApplication.java (83%) diff --git a/commonLib/build.gradle b/commonLib/build.gradle index 7c9bea3..23f7e87 100644 --- a/commonLib/build.gradle +++ b/commonLib/build.gradle @@ -33,18 +33,18 @@ dependencies { compile "io.reactivex:rxjava:$project.rxJavaVersion" // Android Extensions - https://github.com/ReactiveX/RxAndroid/wiki compile "io.reactivex:rxandroid:$project.rxAndroidVersion" - compile "com.jakewharton.rxrelay:rxrelay:1.1.0" + compile "com.jakewharton.rxrelay:rxrelay:1.1.0" // https://github.com/JakeWharton/RxRelay/blob/master/CHANGELOG.md compile "com.jakewharton.rxbinding:rxbinding:$project.rxBindingVersion" compile "com.jakewharton.rxbinding:rxbinding-support-v4:$project.rxBindingVersion" compile "com.jakewharton.rxbinding:rxbinding-appcompat-v7:$project.rxBindingVersion" -// compile 'com.jakewharton.rxbinding:rxbinding-design:0.4.0' -// compile 'com.jakewharton.rxbinding:rxbinding-recyclerview-v7:0.4.0' + compile 'com.jakewharton.rxbinding:rxbinding-design:0.4.0' + compile 'com.jakewharton.rxbinding:rxbinding-recyclerview-v7:0.4.0' // Square Networking compile "com.squareup.okhttp3:okhttp:$project.okhttpVersion" compile "com.squareup.okhttp3:logging-interceptor:$project.okhttpVersion" compile "com.squareup.okhttp3:okhttp-urlconnection:$project.okhttpVersion" -// compile "com.squareup.picasso:picasso:$project.picassoVersion" + compile "com.squareup.picasso:picasso:$project.picassoVersion" compile "com.jakewharton.picasso:picasso2-okhttp3-downloader:$project.picassoOkHttpDownloaderVersion" compile "com.squareup.retrofit2:retrofit:$project.retrofitVersion" compile "com.squareup.retrofit2:adapter-rxjava:$project.retrofitVersion" diff --git a/rajaDemo/build.gradle b/rajaDemo/build.gradle index 499c085..79781bd 100644 --- a/rajaDemo/build.gradle +++ b/rajaDemo/build.gradle @@ -10,13 +10,11 @@ android { targetCompatibility JavaVersion.VERSION_1_8 } defaultConfig { - applicationId "com.kanawish.tangotalk.rajademo" + applicationId "com.kanawish.raja" minSdkVersion 19 targetSdkVersion 24 versionCode 1 versionName "1.0" - - testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } buildTypes { debug { @@ -35,32 +33,13 @@ android { } } -def external_lib_prefix = "../tangoLibs" -repositories { - flatDir { - dirs external_lib_prefix + '/aar' - } -} - dependencies { - compile fileTree(dir: 'libs', include: ['*.jar']) - - compile fileTree(dir: external_lib_prefix + '/jar', include: ['**/*.jar']) - compile (name: 'TangoSupport_Qianru_Java', ext: 'aar') - - compile project(':rajaTangoLib') - - compile 'com.android.support:appcompat-v7:24.0.0' - compile "com.android.support:cardview-v7:$rootProject.supportLibraryVersion" - compile "com.android.support:design:$rootProject.supportLibraryVersion" - compile "com.android.support:recyclerview-v7:$rootProject.supportLibraryVersion" - compile "com.android.support:support-v4:$rootProject.supportLibraryVersion" - compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha3' + compile project(':commonLib') - // APT/Plugin based goodness - apt "com.jakewharton:butterknife-compiler:$project.butterKnifeVersion" - compile "com.jakewharton:butterknife:$project.butterKnifeVersion" - apt "com.google.auto.value:auto-value:$project.autoValueVersion" - apt "com.ryanharter.auto.value:auto-value-gson:$project.autoValueGsonVersion" +// compile 'org.rajawali3d:rajawali:1.0.325@aar' + // Latest version of Rajawali + // see https://github.com/Rajawali/Rajawali + // and https://travis-ci.org/Rajawali/Rajawali/builds + compile 'org.rajawali3d:rajawali:1.1.517-SNAPSHOT@aar' } diff --git a/rajaDemo/src/main/AndroidManifest.xml b/rajaDemo/src/main/AndroidManifest.xml index 8276b28..89d454f 100644 --- a/rajaDemo/src/main/AndroidManifest.xml +++ b/rajaDemo/src/main/AndroidManifest.xml @@ -1,9 +1,9 @@ - + - + diff --git a/rajaDemo/src/main/java/com/kanawish/raja/BaselineRenderingFragment.java b/rajaDemo/src/main/java/com/kanawish/raja/BaselineRenderingFragment.java new file mode 100644 index 0000000..38f00c1 --- /dev/null +++ b/rajaDemo/src/main/java/com/kanawish/raja/BaselineRenderingFragment.java @@ -0,0 +1,99 @@ +package com.kanawish.raja; + +import android.content.Context; +import android.os.Bundle; +import android.support.annotation.CallSuper; +import android.support.annotation.Nullable; +import android.support.v4.app.Fragment; +import android.view.LayoutInflater; +import android.view.MotionEvent; +import android.view.View; +import android.view.ViewGroup; +import android.widget.FrameLayout; + +import com.kanawish.raja.rajademo.R; + +import org.rajawali3d.renderer.ISurfaceRenderer; +import org.rajawali3d.renderer.Renderer; +import org.rajawali3d.view.IDisplay; +import org.rajawali3d.view.ISurface; + +import javax.microedition.khronos.egl.EGLConfig; +import javax.microedition.khronos.opengles.GL10; + +public abstract class BaselineRenderingFragment extends Fragment implements IDisplay, View.OnClickListener { + + protected FrameLayout layout; + + protected ISurface surface; + protected ISurfaceRenderer renderer; + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + } + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { + super.onCreateView(inflater, container, savedInstanceState); + + // Inflate the view + layout = (FrameLayout) inflater.inflate(R.layout.rajawali_textureview_fragment, container, false); + + // Find the TextureView + surface = (ISurface) layout.findViewById(R.id.rajwali_surface); + + // Create the renderer + renderer = createRenderer(); + onBeforeApplyRenderer(); + applyRenderer(); + return layout; + } + + protected void onBeforeApplyRenderer() { + } + + @CallSuper + protected void applyRenderer() { + surface.setSurfaceRenderer(renderer); + } + + @Override + public void onClick(View v) { + switch (v.getId()) { + } + } + + @Override + public void onDestroyView() { + super.onDestroyView(); + + if (layout != null) + layout.removeView((View) surface); + } + + protected static abstract class BaselineRenderer extends Renderer { + + final BaselineRenderingFragment exampleFragment; + + public BaselineRenderer(Context context, @Nullable BaselineRenderingFragment fragment) { + super(context); + exampleFragment = fragment; + } + + @Override + public void onRenderSurfaceCreated(EGLConfig config, GL10 gl, int width, int height) { + super.onRenderSurfaceCreated(config, gl, width, height); + } + + @Override + public void onOffsetsChanged(float xOffset, float yOffset, float xOffsetStep, float yOffsetStep, int xPixelOffset, int yPixelOffset) { + } + + @Override + public void onTouchEvent(MotionEvent event) { + } + + } + +} \ No newline at end of file diff --git a/rajaDemo/src/main/java/com/kanawish/tangotalk/rajademo/DemoFragment.java b/rajaDemo/src/main/java/com/kanawish/raja/DemoFragment.java similarity index 74% rename from rajaDemo/src/main/java/com/kanawish/tangotalk/rajademo/DemoFragment.java rename to rajaDemo/src/main/java/com/kanawish/raja/DemoFragment.java index e563aa9..224a025 100644 --- a/rajaDemo/src/main/java/com/kanawish/tangotalk/rajademo/DemoFragment.java +++ b/rajaDemo/src/main/java/com/kanawish/raja/DemoFragment.java @@ -1,4 +1,4 @@ -package com.kanawish.tangotalk.rajademo; +package com.kanawish.raja; import android.content.Context; import android.os.Bundle; @@ -9,7 +9,8 @@ import android.view.View; import android.view.ViewGroup; import android.widget.LinearLayout; -import android.widget.TextView; + +import com.kanawish.raja.rajademo.R; import org.rajawali3d.Object3D; import org.rajawali3d.animation.Animation; @@ -28,35 +29,27 @@ import org.rajawali3d.postprocessing.PostProcessingManager; import org.rajawali3d.postprocessing.effects.BloomEffect; import org.rajawali3d.postprocessing.passes.BlendPass; -import org.rajawali3d.postprocessing.passes.RenderPass; -public class DemoFragment extends AExampleFragment { +public class DemoFragment extends BaselineRenderingFragment { private PostProcessingManager effectsManager; @Override - public View onCreateView(LayoutInflater inflater, ViewGroup container, - Bundle savedInstanceState) { + public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { super.onCreateView(inflater, container, savedInstanceState); - LinearLayout ll = new LinearLayout(getActivity()); - ll.setOrientation(LinearLayout.VERTICAL); - ll.setGravity(Gravity.BOTTOM); - - TextView label = new TextView(getActivity()); - label.setText(R.string.fbx_fragment_button_model_by); - label.setTextSize(20); - label.setGravity(Gravity.CENTER); - label.setHeight(100); - ll.addView(label); + LinearLayout uiOverlay = new LinearLayout(getActivity()); + uiOverlay.setOrientation(LinearLayout.VERTICAL); + uiOverlay.setGravity(Gravity.BOTTOM); - mLayout.addView(ll); + // TODO: Add ui elements here. + layout.addView(uiOverlay); - return mLayout; + return layout; } @Override - public AExampleRenderer createRenderer() { + public BaselineRenderer createRenderer() { return new FBXRenderer(getActivity(), this); } @@ -64,11 +57,9 @@ public static DemoFragment buildInstance() { return new DemoFragment(); } - private final class FBXRenderer extends AExampleRenderer { - - private DirectionalLight mDirectionalLight; + private final class FBXRenderer extends BaselineRenderer { - public FBXRenderer(Context context, @Nullable AExampleFragment fragment) { + public FBXRenderer(Context context, @Nullable BaselineRenderingFragment fragment) { super(context, fragment); } @@ -81,6 +72,7 @@ protected void initScene() { // For skybox below. getCurrentCamera().setFarPlane(1000); + // Skybox images by Emil Persson, aka Humus. http://www.humus.name humus@comhem.se try { getCurrentScene().setSkybox(R.drawable.posx, R.drawable.negx, @@ -91,38 +83,36 @@ protected void initScene() { getCurrentScene().addChild(buildLandscape()); - getCurrentCamera().setPosition(0,2,4); + getCurrentCamera().setPosition(0,2,8); getCurrentCamera().setLookAt(0,1,-40); getCurrentScene().setFog(new FogMaterialPlugin.FogParams(FogMaterialPlugin.FogType.LINEAR, 0xCCCCCC, 1, 150)); + Material planeMaterial = new Material(); + planeMaterial.enableLighting(true); + planeMaterial.setDiffuseMethod(new DiffuseMethod.Lambert()); + + Material sphereMaterial = new Material(); + sphereMaterial.enableLighting(true); + sphereMaterial.setDiffuseMethod(new DiffuseMethod.Lambert()); + // // -- Create a post processing manager. We can add multiple passes to this. // -/* effectsManager = new PostProcessingManager(this); - RenderPass renderPass = new RenderPass(getCurrentScene(), getCurrentCamera(), 0); - effectsManager.addPass(renderPass); - BloomEffect bloomEffect = new BloomEffect(getCurrentScene(), getCurrentCamera(), getViewportWidth(), getViewportHeight(), 0x111111, 0xffffff, BlendPass.BlendMode.SCREEN); + BloomEffect bloomEffect = new BloomEffect( + getCurrentScene(), getCurrentCamera(), getViewportWidth(), + getViewportHeight(), 0x111111, 0xffffff, BlendPass.BlendMode.SCREEN); effectsManager.addEffect(bloomEffect); - bloomEffect.setRenderToScreen(true); - ShadowEffect shadowEffect = new ShadowEffect(getCurrentScene(), getCurrentCamera(), light, 2048); - shadowEffect.setShadowInfluence(.5f); - effectsManager.addEffect(shadowEffect); - shadowEffect.setRenderToScreen(true); -*/ - } -/* public void onRender(final long ellapsedTime, final double deltaTime) { effectsManager.render(ellapsedTime, deltaTime); } -*/ private Object3D buildLandscape() { LoaderOBJ objParser = new LoaderOBJ(mContext.getResources(), mTextureManager, R.raw.minecart_scene_obj); @@ -157,12 +147,11 @@ private Object3D buildTree() { return o; } - @NonNull private DirectionalLight buildDirectionalLight() { final DirectionalLight directionalLight = new DirectionalLight(); - directionalLight.setPosition(0.20, 1.0, 0.6); - directionalLight.setPower(1.75f); + directionalLight.setPosition(0.20, 5.0, 0.6); + directionalLight.setPower(0.95f); directionalLight.setLookAt(Vector3.ZERO); directionalLight.enableLookAt(); return directionalLight; @@ -174,7 +163,6 @@ private Material buildMaterial(int color) { material.enableLighting(true); material.setColor(color); material.setDiffuseMethod(new DiffuseMethod.Lambert()); -// material.setSpecularMethod(new SpecularMethod.Phong()); return material; } @@ -193,8 +181,6 @@ private Material buildTextureMaterial(int color) { } material.setColorInfluence(0); texture.setInfluence(1.0f); -// material.setColor(color); -// material.setColorInfluence(.5f); return material; } diff --git a/rajaDemo/src/main/java/com/kanawish/tangotalk/rajademo/MainActivity.java b/rajaDemo/src/main/java/com/kanawish/raja/MainActivity.java similarity index 65% rename from rajaDemo/src/main/java/com/kanawish/tangotalk/rajademo/MainActivity.java rename to rajaDemo/src/main/java/com/kanawish/raja/MainActivity.java index 96479bf..344fed8 100644 --- a/rajaDemo/src/main/java/com/kanawish/tangotalk/rajademo/MainActivity.java +++ b/rajaDemo/src/main/java/com/kanawish/raja/MainActivity.java @@ -1,8 +1,10 @@ -package com.kanawish.tangotalk.rajademo; +package com.kanawish.raja; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; +import com.kanawish.raja.rajademo.R; + public class MainActivity extends AppCompatActivity { @Override @@ -10,10 +12,6 @@ protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); -/* - BasicFragment fragment = BasicFragment.buildInstance(); - String name = BasicFragment.class.getName(); -*/ DemoFragment fragment = DemoFragment.buildInstance(); String name = DemoFragment.class.getName(); @@ -21,10 +19,5 @@ protected void onCreate(Bundle savedInstanceState) { .replace(R.id.content_frame, fragment, name) .commit(); - /* - Fragment fragment = (Fragment) aClass.newInstance(); - fragment.setArguments(bundle); - - */ } } diff --git a/rajaDemo/src/main/java/com/kanawish/tangotalk/rajademo/AExampleFragment.java b/rajaDemo/src/main/java/com/kanawish/tangotalk/rajademo/AExampleFragment.java deleted file mode 100644 index f3bc165..0000000 --- a/rajaDemo/src/main/java/com/kanawish/tangotalk/rajademo/AExampleFragment.java +++ /dev/null @@ -1,119 +0,0 @@ -package com.kanawish.tangotalk.rajademo; - -import android.content.Context; -import android.os.Bundle; -import android.support.annotation.CallSuper; -import android.support.annotation.Nullable; -import android.support.v4.app.Fragment; -import android.view.LayoutInflater; -import android.view.MotionEvent; -import android.view.View; -import android.view.ViewGroup; -import android.widget.FrameLayout; -import android.widget.ProgressBar; - -import org.rajawali3d.IRajawaliDisplay; -import org.rajawali3d.renderer.RajawaliRenderer; -import org.rajawali3d.surface.IRajawaliSurface; -import org.rajawali3d.surface.IRajawaliSurfaceRenderer; - -import javax.microedition.khronos.egl.EGLConfig; -import javax.microedition.khronos.opengles.GL10; - -public abstract class AExampleFragment extends Fragment implements IRajawaliDisplay, View.OnClickListener { - - public static final String BUNDLE_EXAMPLE_URL = "BUNDLE_EXAMPLE_URL"; - - protected ProgressBar mProgressBarLoader; -// protected GitHubLogoView mImageViewExampleLink; -// protected String mExampleUrl; - protected FrameLayout mLayout; - protected IRajawaliSurface mRenderSurface; - protected IRajawaliSurfaceRenderer mRenderer; - - @Override - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - -/* - final Bundle bundle = getArguments(); - if (bundle == null || !bundle.containsKey(BUNDLE_EXAMPLE_URL)) { - throw new IllegalArgumentException(getClass().getSimpleName() - + " requires " + BUNDLE_EXAMPLE_URL + " argument at runtime!"); - } - - mExampleUrl = bundle.getString(BUNDLE_EXAMPLE_URL); -*/ - } - - @Override - public int getLayoutID() { - throw new IllegalStateException("Don't call layout ID, assign your own!"); - } - - @Override - public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { - super.onCreateView(inflater, container, savedInstanceState); - - // Inflate the view - mLayout = (FrameLayout) inflater.inflate(R.layout.rajawali_textureview_fragment, container, false); - - // Find the TextureView - mRenderSurface = (IRajawaliSurface) mLayout.findViewById(R.id.rajwali_surface); - - // Create the renderer - mRenderer = createRenderer(); - onBeforeApplyRenderer(); - applyRenderer(); - return mLayout; - } - - protected void onBeforeApplyRenderer() { - } - - @CallSuper - protected void applyRenderer() { - mRenderSurface.setSurfaceRenderer(mRenderer); - } - - @Override - public void onClick(View v) { - switch (v.getId()) { - } - } - - @Override - public void onDestroyView() { - super.onDestroyView(); - - if (mLayout != null) - mLayout.removeView((View) mRenderSurface); - } - - protected static abstract class AExampleRenderer extends RajawaliRenderer { - - final AExampleFragment exampleFragment; - - public AExampleRenderer(Context context, @Nullable AExampleFragment fragment) { - super(context); - exampleFragment = fragment; - } - - @Override - public void onRenderSurfaceCreated(EGLConfig config, GL10 gl, int width, int height) { -// if (exampleFragment != null) exampleFragment.showLoader(); - super.onRenderSurfaceCreated(config, gl, width, height); -// if (exampleFragment != null) exampleFragment.hideLoader(); - } - - @Override - public void onOffsetsChanged(float xOffset, float yOffset, float xOffsetStep, float yOffsetStep, int xPixelOffset, int yPixelOffset) { - } - - @Override - public void onTouchEvent(MotionEvent event) { - } - - } - -} \ No newline at end of file diff --git a/rajaDemo/src/main/java/com/kanawish/tangotalk/rajademo/BasicFragment.java b/rajaDemo/src/main/java/com/kanawish/tangotalk/rajademo/BasicFragment.java deleted file mode 100644 index 96f2321..0000000 --- a/rajaDemo/src/main/java/com/kanawish/tangotalk/rajademo/BasicFragment.java +++ /dev/null @@ -1,57 +0,0 @@ -package com.kanawish.tangotalk.rajademo; - -import android.content.Context; -import android.support.annotation.Nullable; - -import org.rajawali3d.Object3D; -import org.rajawali3d.materials.Material; -import org.rajawali3d.materials.textures.ATexture; -import org.rajawali3d.materials.textures.Texture; -import org.rajawali3d.math.vector.Vector3; -import org.rajawali3d.primitives.Sphere; - -public class BasicFragment extends AExampleFragment { - - public static BasicFragment buildInstance() { - return new BasicFragment(); - } - - @Override - public AExampleRenderer createRenderer() { - return new BasicRenderer(getActivity(), this); - } - - public static final class BasicRenderer extends AExampleRenderer { - - private Object3D mSphere; - - public BasicRenderer(Context context, @Nullable AExampleFragment fragment) { - super(context, fragment); - } - - @Override - protected void initScene() { - try { - Material material = new Material(); - material.addTexture(new Texture("earthColors", - R.drawable.earthtruecolor_nasa_big)); - material.setColorInfluence(0); - mSphere = new Sphere(1, 24, 24); - mSphere.setMaterial(material); - getCurrentScene().addChild(mSphere); - } catch (ATexture.TextureException e) { - e.printStackTrace(); - } - - getCurrentCamera().enableLookAt(); - getCurrentCamera().setLookAt(0, 0, 0); - getCurrentCamera().setZ(6); - } - - @Override - public void onRender(final long elapsedTime, final double deltaTime) { - super.onRender(elapsedTime, deltaTime); - mSphere.rotate(Vector3.Axis.Y, 1.0); - } - } -} \ No newline at end of file diff --git a/rajaDemo/src/main/res/layout/rajawali_surfaceview_fragment.xml b/rajaDemo/src/main/res/layout/rajawali_surfaceview_fragment.xml index 08bdcb0..a5bb4a2 100644 --- a/rajaDemo/src/main/res/layout/rajawali_surfaceview_fragment.xml +++ b/rajaDemo/src/main/res/layout/rajawali_surfaceview_fragment.xml @@ -4,7 +4,7 @@ android:layout_width="fill_parent" android:layout_height="fill_parent"> - - - - + diff --git a/tangoRoomEditor/src/main/java/com/kanawish/tangotalk/controlroom/ControlRoomActivity.java b/tangoRoomEditor/src/main/java/com/kanawish/raja/controlroom/ControlRoomActivity.java similarity index 99% rename from tangoRoomEditor/src/main/java/com/kanawish/tangotalk/controlroom/ControlRoomActivity.java rename to tangoRoomEditor/src/main/java/com/kanawish/raja/controlroom/ControlRoomActivity.java index c135a8c..7c9085a 100644 --- a/tangoRoomEditor/src/main/java/com/kanawish/tangotalk/controlroom/ControlRoomActivity.java +++ b/tangoRoomEditor/src/main/java/com/kanawish/raja/controlroom/ControlRoomActivity.java @@ -1,4 +1,4 @@ -package com.kanawish.tangotalk.controlroom; +package com.kanawish.raja.controlroom; import android.opengl.Matrix; import android.os.Bundle; diff --git a/tangoRoomEditor/src/main/java/com/kanawish/tangotalk/controlroom/ControlRoomRenderer.java b/tangoRoomEditor/src/main/java/com/kanawish/raja/controlroom/ControlRoomRenderer.java similarity index 98% rename from tangoRoomEditor/src/main/java/com/kanawish/tangotalk/controlroom/ControlRoomRenderer.java rename to tangoRoomEditor/src/main/java/com/kanawish/raja/controlroom/ControlRoomRenderer.java index a72c740..7c0bdc4 100644 --- a/tangoRoomEditor/src/main/java/com/kanawish/tangotalk/controlroom/ControlRoomRenderer.java +++ b/tangoRoomEditor/src/main/java/com/kanawish/raja/controlroom/ControlRoomRenderer.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.kanawish.tangotalk.controlroom; +package com.kanawish.raja.controlroom; import android.content.Context; import android.graphics.Color; @@ -23,7 +23,7 @@ import com.google.atap.tangoservice.TangoCameraIntrinsics; import com.google.atap.tangoservice.TangoPoseData; -import com.kanawish.tangotalk.raja.ScenePoseCalculator; +import com.kanawish.raja.raja.ScenePoseCalculator; import org.rajawali3d.Object3D; import org.rajawali3d.animation.Animation; @@ -35,7 +35,6 @@ import org.rajawali3d.materials.Material; import org.rajawali3d.materials.methods.DiffuseMethod; import org.rajawali3d.materials.methods.SpecularMethod; -import org.rajawali3d.materials.plugins.FogMaterialPlugin; import org.rajawali3d.materials.textures.ATexture; import org.rajawali3d.materials.textures.StreamingTexture; import org.rajawali3d.materials.textures.Texture; diff --git a/tangoRoomEditor/src/main/java/com/kanawish/tangotalk/controlroom/PlanFittingApplication.java b/tangoRoomEditor/src/main/java/com/kanawish/raja/controlroom/PlanFittingApplication.java similarity index 83% rename from tangoRoomEditor/src/main/java/com/kanawish/tangotalk/controlroom/PlanFittingApplication.java rename to tangoRoomEditor/src/main/java/com/kanawish/raja/controlroom/PlanFittingApplication.java index 5027f30..1338c25 100644 --- a/tangoRoomEditor/src/main/java/com/kanawish/tangotalk/controlroom/PlanFittingApplication.java +++ b/tangoRoomEditor/src/main/java/com/kanawish/raja/controlroom/PlanFittingApplication.java @@ -1,4 +1,4 @@ -package com.kanawish.tangotalk.controlroom; +package com.kanawish.raja.controlroom; import android.app.Application; diff --git a/tangoRoomEditor/src/main/res/layout/activity_main.xml b/tangoRoomEditor/src/main/res/layout/activity_main.xml index 6eb8459..7a91068 100644 --- a/tangoRoomEditor/src/main/res/layout/activity_main.xml +++ b/tangoRoomEditor/src/main/res/layout/activity_main.xml @@ -4,7 +4,7 @@ xmlns:surfaceview="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent" - tools:context="com.kanawish.tangotalk.controlroom.ControlRoomActivity"> + tools:context="com.kanawish.raja.controlroom.ControlRoomActivity">