Skip to content

Commit

Permalink
Merge pull request #2 from kanawish/dev/raja_upgrade
Browse files Browse the repository at this point in the history
Dev/raja upgrade version, also updates various dependencies.
  • Loading branch information
kanawish authored Dec 2, 2016
2 parents 43f8dc5 + 4ffbe2f commit fbe7d00
Show file tree
Hide file tree
Showing 29 changed files with 805 additions and 454 deletions.
31 changes: 2 additions & 29 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,12 @@ buildscript {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.0-alpha6'
classpath 'com.android.tools.build:gradle:2.2.2'
classpath 'com.google.gms:google-services:3.0.0'

// Retrolambda Support
classpath 'me.tatarka:gradle-retrolambda:3.2.5'
classpath 'me.tatarka.retrolambda.projectlombok:lombok.ast:0.2.3.a2'
classpath 'me.tatarka:gradle-retrolambda:3.3.0'

// Better Dagger Support
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
}
}

Expand All @@ -31,27 +28,3 @@ allprojects {
task clean(type: Delete) {
delete rootProject.buildDir
}

ext {
// version numbers for dependencies // source for most recent release
supportLibraryVersion = '24.0.0' // See standalone SDK manager
guavaVersion = '19.0' // https://github.com/google/guava/releases

commonsIOVersion = '2.5' // https://commons.apache.org/proper/commons-io/
commonsLangVersion = '3.4' // https://commons.apache.org/proper/commons-lang/

daggerVersion = '2.5' // https://github.com/google/dagger/blob/master/CHANGELOG.md
okhttpVersion = '3.3.1' // https://github.com/square/okhttp/blob/master/CHANGELOG.md
retrofitVersion='2.1.0' // https://github.com/square/retrofit/blob/master/CHANGELOG.md
picassoVersion='2.5.2' // https://github.com/square/picasso/blob/master/CHANGELOG.md
picassoOkHttpDownloaderVersion = '1.0.2' // https://github.com/JakeWharton/picasso2-okhttp3-downloader/blob/master/CHANGELOG.md
butterKnifeVersion='8.1.0' // https://github.com/JakeWharton/butterknife/blob/master/CHANGELOG.md

autoValueVersion='1.2' // https://github.com/google/auto
autoValueGsonVersion='0.3.1' // https://github.com/rharter/auto-value-gson/blob/master/CHANGELOG.md

rxJavaVersion='1.1.6' // https://github.com/ReactiveX/RxJava/blob/1.x/CHANGES.md
rxAndroidVersion='1.2.1' // https://github.com/ReactiveX/RxAndroid/blob/master/CHANGES.md
rxBindingVersion='0.4.0' // https://github.com/JakeWharton/RxBinding/blob/master/CHANGELOG.md

}
48 changes: 30 additions & 18 deletions commonLib/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apply plugin: 'me.tatarka.retrolambda'

android {
compileSdkVersion 24
buildToolsVersion "24.0.0 rc4"
buildToolsVersion "24.0.2"
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
Expand All @@ -22,32 +22,44 @@ android {
}
}

final SUPPORT_LIB_VERSION = '24.2.1' // https://developer.android.com/topic/libraries/support-library/revisions.html
final FIREBASE_VERSION = '9.6.1' // https://firebase.google.com/support/release-notes/android
final PLAY_SERVICES_VERSION = '9.6.1' // https://developers.google.com/android/guides/releases

dependencies {
// NOTE: commonLib dependencies are for 'framework' type dependencies I always want in my projects.
// Google Framework Dependencies
compile "com.android.support:support-v13:${SUPPORT_LIB_VERSION}"
compile "com.android.support:appcompat-v7:${SUPPORT_LIB_VERSION}"

// Timber Logging API: Better method signatures, easy log-level-by-flavor management, decent lint checks, etc.
// https://github.com/JakeWharton/timber
compile 'com.jakewharton.timber:timber:4.1.2'
compile "com.jakewharton.timber:timber:4.3.0" // https://github.com/JakeWharton/timber/blob/master/CHANGELOG.md

// RxJava 2 for your declarative programming needs
compile "io.reactivex.rxjava2:rxjava:2.0.0-RC4" // https://github.com/ReactiveX/RxJava/blob/2.x/CHANGES.md
compile 'io.reactivex.rxjava2:rxandroid:2.0.0-RC1' // https://github.com/ReactiveX/RxAndroid/blob/2.x/CHANGES.md

// RxJava
compile "io.reactivex:rxjava:$project.rxJavaVersion"
// Android Extensions - https://github.com/ReactiveX/RxAndroid/wiki
compile "io.reactivex:rxandroid:$project.rxAndroidVersion"
/*
compile "io.reactivex:rxjava:1.1.9" // https://github.com/ReactiveX/RxJava/blob/1.x/CHANGES.md
compile "io.reactivex:rxandroid:1.2.1" // https://github.com/ReactiveX/RxAndroid/blob/1.x/CHANGES.md
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:0.4.0" // https://github.com/JakeWharton/RxBinding/blob/master/CHANGELOG.md
compile "com.jakewharton.rxbinding:rxbinding-support-v4:0.4.0"
compile "com.jakewharton.rxbinding:rxbinding-appcompat-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.jakewharton.picasso:picasso2-okhttp3-downloader:$project.picassoOkHttpDownloaderVersion"
compile "com.squareup.retrofit2:retrofit:$project.retrofitVersion"
compile "com.squareup.retrofit2:adapter-rxjava:$project.retrofitVersion"
compile "com.squareup.retrofit2:converter-gson:$project.retrofitVersion"
compile "com.squareup.okhttp3:okhttp:3.4.1" // https://github.com/square/okhttp/blob/master/CHANGELOG.md
compile "com.squareup.okhttp3:okhttp-urlconnection:3.4.1"
debugCompile "com.squareup.okhttp3:logging-interceptor:3.4.1"
compile "com.squareup.retrofit2:retrofit:2.1.0" // https://github.com/square/retrofit/blob/master/CHANGELOG.md
compile "com.squareup.retrofit2:converter-gson:2.1.0"
compile "com.jakewharton.retrofit:retrofit2-rxjava2-adapter:1.0.0-RC3" // https://github.com/JakeWharton/retrofit2-rxjava2-adapter/blob/master/CHANGELOG.md
compile "com.squareup.picasso:picasso:2.5.2" // https://github.com/square/picasso/blob/master/CHANGELOG.md
compile "com.jakewharton.picasso:picasso2-okhttp3-downloader:1.0.2" // https://github.com/JakeWharton/picasso2-okhttp3-downloader/blob/master/CHANGELOG.md

}
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Mon Dec 28 10:00:20 PST 2015
#Tue Aug 02 17:34:15 EDT 2016
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
7 changes: 5 additions & 2 deletions rajaDemo/build.gradle
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
apply plugin: 'com.android.application'
apply plugin: 'com.neenbedankt.android-apt'
apply plugin: 'me.tatarka.retrolambda'

android {
compileSdkVersion 24
buildToolsVersion "24.0.0 rc4"
buildToolsVersion "24.0.2"
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
Expand Down Expand Up @@ -36,6 +35,10 @@ android {
dependencies {
compile project(':commonLib')

annotationProcessor "com.github.stephanenicolas.toothpick:toothpick-compiler:1.0.0" // https://github.com/stephanenicolas/toothpick/blob/master/CHANGELOG.md
compile "com.github.stephanenicolas.toothpick:toothpick-runtime:1.0.0"
compile "com.github.stephanenicolas.toothpick:smoothie:1.0.0"

// compile 'org.rajawali3d:rajawali:1.0.325@aar'

// Latest version of Rajawali
Expand Down
34 changes: 34 additions & 0 deletions rajaDemo/src/main/java/com/kanawish/raja/BaselineRenderer.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package com.kanawish.raja;

import android.content.Context;
import android.support.annotation.Nullable;
import android.view.MotionEvent;

import org.rajawali3d.renderer.Renderer;

import javax.microedition.khronos.egl.EGLConfig;
import javax.microedition.khronos.opengles.GL10;

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) {
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -72,28 +72,5 @@ public void onDestroyView() {
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) {
}

}

}
157 changes: 2 additions & 155 deletions rajaDemo/src/main/java/com/kanawish/raja/DemoFragment.java
Original file line number Diff line number Diff line change
@@ -1,39 +1,14 @@
package com.kanawish.raja;

import android.content.Context;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;

import com.kanawish.raja.rajademo.R;

import org.rajawali3d.Object3D;
import org.rajawali3d.animation.Animation;
import org.rajawali3d.animation.Animation3D;
import org.rajawali3d.animation.RotateOnAxisAnimation;
import org.rajawali3d.lights.DirectionalLight;
import org.rajawali3d.loader.LoaderOBJ;
import org.rajawali3d.loader.ParsingException;
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.Texture;
import org.rajawali3d.math.vector.Vector3;
import org.rajawali3d.postprocessing.PostProcessingManager;
import org.rajawali3d.postprocessing.effects.BloomEffect;
import org.rajawali3d.postprocessing.passes.BlendPass;

public class DemoFragment extends BaselineRenderingFragment {

private PostProcessingManager effectsManager;

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
super.onCreateView(inflater, container, savedInstanceState);
Expand All @@ -50,139 +25,11 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle sa

@Override
public BaselineRenderer createRenderer() {
return new FBXRenderer(getActivity(), this);
// NOTE: If you build your own renderer, simply switch them in here.
return new SimpleRenderer(getActivity(), this);
}

public static DemoFragment buildInstance() {
return new DemoFragment();
}

private final class FBXRenderer extends BaselineRenderer {

public FBXRenderer(Context context, @Nullable BaselineRenderingFragment fragment) {
super(context, fragment);
}

@Override
protected void initScene() {

// Add overall light to our scene. Directional behaves like sunlight.
DirectionalLight light = buildDirectionalLight();
getCurrentScene().addLight(light);

// 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,
R.drawable.posy, R.drawable.negy, R.drawable.posz, R.drawable.negz);
} catch (ATexture.TextureException e) {
e.printStackTrace();
}

getCurrentScene().addChild(buildLandscape());

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);

BloomEffect bloomEffect = new BloomEffect(
getCurrentScene(), getCurrentCamera(), getViewportWidth(),
getViewportHeight(), 0x111111, 0xffffff, BlendPass.BlendMode.SCREEN);
effectsManager.addEffect(bloomEffect);
bloomEffect.setRenderToScreen(true);

}

public void onRender(final long elapsedTime, final double deltaTime) {
effectsManager.render(elapsedTime, deltaTime);
}

private Object3D buildLandscape() {
LoaderOBJ objParser = new LoaderOBJ(mContext.getResources(), mTextureManager, R.raw.minecart_scene_obj);
try {
objParser.parse();
} catch (ParsingException e) {
e.printStackTrace();
}

Object3D o = objParser.getParsedObject();
return o;
}

private Object3D buildTree() {
LoaderOBJ objParser = new LoaderOBJ(mContext.getResources(), mTextureManager, R.raw.small_tree_color_obj);
try {
objParser.parse();
} catch (ParsingException e) {
e.printStackTrace();
}

Object3D o = objParser.getParsedObject();
o.setPosition(0,0,0);

Animation3D anim = new RotateOnAxisAnimation(Vector3.Axis.Y, 360);
anim.setDurationMilliseconds(16000);
anim.setRepeatMode(Animation.RepeatMode.INFINITE);
anim.setTransformable3D(o);
getCurrentScene().registerAnimation(anim);
anim.play();

return o;
}

@NonNull
private DirectionalLight buildDirectionalLight() {
final DirectionalLight directionalLight = new DirectionalLight();
directionalLight.setPosition(0.20, 5.0, 0.6);
directionalLight.setPower(0.95f);
directionalLight.setLookAt(Vector3.ZERO);
directionalLight.enableLookAt();
return directionalLight;
}

@NonNull
private Material buildMaterial(int color) {
Material material = new Material();
material.enableLighting(true);
material.setColor(color);
material.setDiffuseMethod(new DiffuseMethod.Lambert());
return material;
}

private Material buildTextureMaterial(int color) {
Material material = new Material();
Texture texture = new Texture("earthColors",
R.drawable.earthtruecolor_nasa_big);
material.enableLighting(true);
material.setDiffuseMethod(new DiffuseMethod.Lambert());
material.setSpecularMethod(new SpecularMethod.Phong());

try {
material.addTexture(texture);
} catch (ATexture.TextureException e) {
e.printStackTrace();
}
material.setColorInfluence(0);
texture.setInfluence(1.0f);

return material;
}
}
}
Loading

0 comments on commit fbe7d00

Please sign in to comment.