-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
1,984 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
app/src/main/java/mg/rivolink/app/aruco/renderer/Renderer3D.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
package mg.rivolink.app.aruco.renderer; | ||
|
||
import android.content.Context; | ||
import android.view.MotionEvent; | ||
|
||
import org.rajawali3d.Object3D; | ||
import org.rajawali3d.lights.PointLight; | ||
import org.rajawali3d.loader.LoaderOBJ; | ||
import org.rajawali3d.loader.ParsingException; | ||
import org.rajawali3d.math.vector.Vector3; | ||
import org.rajawali3d.renderer.Renderer; | ||
|
||
import mg.rivolink.app.aruco.R; | ||
|
||
public class Renderer3D extends Renderer{ | ||
|
||
private Object3D model; | ||
private PointLight light; | ||
|
||
public Renderer3D(Context context){ | ||
super(context); | ||
setFrameRate(60); | ||
} | ||
|
||
protected void initScene() { | ||
light=new PointLight(); | ||
light.setPosition(0,0,4); | ||
light.setPower(3); | ||
|
||
try { | ||
LoaderOBJ objParser=new LoaderOBJ(mContext.getResources(),mTextureManager,R.raw.camaro_obj); | ||
objParser.parse(); | ||
model=objParser.getParsedObject(); | ||
model.setPosition(0,0,-5); | ||
model.setRotation(90,90,0); | ||
getCurrentScene().addLight(light); | ||
getCurrentScene().addChild(model); | ||
|
||
|
||
} catch(ParsingException e) { | ||
e.printStackTrace(); | ||
} | ||
} | ||
|
||
@Override | ||
protected void render(long ellapsedRealtime,double deltaTime){ | ||
super.render(ellapsedRealtime,deltaTime); | ||
model.rotate(Vector3.Axis.Y,0.5); | ||
} | ||
|
||
@Override | ||
public void onOffsetsChanged(float x, float y, float z, float w, int i, int j){ | ||
// TODO: Implement this method | ||
} | ||
|
||
@Override | ||
public void onTouchEvent(MotionEvent p1){ | ||
// TODO: Implement this method | ||
} | ||
|
||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,24 @@ | ||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
xmlns:opencv="http://schemas.android.com/apk/res-auto" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" > | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<RelativeLayout | ||
xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:app="http://schemas.android.com/apk/res-auto" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent"> | ||
|
||
<org.opencv.android.JavaCameraView | ||
<org.opencv.android.JavaCameraView | ||
android:id="@+id/main_camera" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
android:layout_centerInParent="true"/> | ||
|
||
<org.rajawali3d.view.SurfaceView | ||
android:id="@+id/main_surface" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
android:id="@+id/main_camera" /> | ||
android:layout_centerInParent="true" | ||
app:frameRate="60.0" | ||
app:renderMode="RENDER_WHEN_DIRTY"/> | ||
|
||
</RelativeLayout> | ||
|
||
</LinearLayout> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# Blender3D MTL File: | ||
# Material Count: 1 | ||
newmtl 01_-_Default_CMRO_TEX.TGA | ||
Ns 96.078431 | ||
Ka 0.000000 0.000000 0.000000 | ||
Kd 0.000000 0.000000 0.000000 | ||
Ks 0.500000 0.500000 0.500000 | ||
Ni 1.000000 | ||
d 1.000000 | ||
illum 2 | ||
map_Kd camaro.jpg | ||
|
Oops, something went wrong.