forked from kanawish/caster-samples-3d
-
Notifications
You must be signed in to change notification settings - Fork 0
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
32 changed files
with
195 additions
and
368 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
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
99 changes: 99 additions & 0 deletions
99
rajaDemo/src/main/java/com/kanawish/raja/BaselineRenderingFragment.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,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) { | ||
} | ||
|
||
} | ||
|
||
} |
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
13 changes: 3 additions & 10 deletions
13
...wish/tangotalk/rajademo/MainActivity.java → .../java/com/kanawish/raja/MainActivity.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 |
---|---|---|
@@ -1,30 +1,23 @@ | ||
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 | ||
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(); | ||
|
||
getSupportFragmentManager().beginTransaction() | ||
.replace(R.id.content_frame, fragment, name) | ||
.commit(); | ||
|
||
/* | ||
Fragment fragment = (Fragment) aClass.newInstance(); | ||
fragment.setArguments(bundle); | ||
*/ | ||
} | ||
} |
Oops, something went wrong.