Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transform and state sorting reform #1827

Open
wants to merge 44 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
f03b711
adding picture to transfer to linux
NolaDonato Mar 21, 2018
7b0759e
Merge branch 'master' of https://github.com/NolaDonato/GearVRf
NolaDonato Mar 21, 2018
6333b7c
wider head photo
NolaDonato Mar 21, 2018
b001c8f
vertical head shot
NolaDonato Mar 21, 2018
4f80b0f
Merge branch 'master' of https://github.com/Samsung/GearVRf
NolaDonato Apr 4, 2018
32d5f60
Merge branch 'master' of github.com:Samsung/GearVRf
NolaDonato Apr 7, 2018
5a36c72
Merge branch 'master' of github.com:Samsung/GearVRf
NolaDonato Apr 9, 2018
7aabcb9
Merge branch 'master' of github.com:Samsung/GearVRf
NolaDonato Apr 16, 2018
2a42739
Merge branch 'master' of github.com:Samsung/GearVRf
NolaDonato Apr 17, 2018
ae46273
Merge branch 'master' of github.com:Samsung/GearVRf
NolaDonato Apr 20, 2018
368b82c
Merge branch 'master' of github.com:Samsung/GearVRf
NolaDonato Apr 23, 2018
79d61f9
Merge branch 'master' of github.com:Samsung/GearVRf
NolaDonato Apr 26, 2018
4a02903
Merge branch 'master' of github.com:Samsung/GearVRf
NolaDonato May 3, 2018
d9577ab
Merge branch 'master' of github.com:Samsung/GearVRf
NolaDonato May 11, 2018
9987510
Merge branch 'master' of github.com:Samsung/GearVRf
NolaDonato May 17, 2018
3052782
Merge branch 'master' of github.com:Samsung/GearVRf
NolaDonato May 19, 2018
4bf6810
Merge branch 'master' of https://github.com/Samsung/GearVRf
NolaDonato May 19, 2018
9826044
Merge branch 'master' of https://github.com/NolaDonato/GearVRf
NolaDonato May 23, 2018
ac40d41
Merge branch 'master' of github.com:Samsung/GearVRf
NolaDonato May 23, 2018
21ec9ff
Merge branch 'master' of github.com:Samsung/GearVRf
NolaDonato May 29, 2018
6474897
merge with master
NolaDonato May 30, 2018
df1f8c8
fix problem with clearing lights
NolaDonato May 30, 2018
cf59335
change max matrices to 64
NolaDonato May 30, 2018
696887f
fix x3d regression
NolaDonato May 30, 2018
06c626d
fix merge issue with PBR shader
NolaDonato May 30, 2018
5502b71
fix matrix expression calculator
NolaDonato May 31, 2018
201cb09
remove redundant render call
NolaDonato May 31, 2018
c63542b
Merge branch 'master' of github.com:Samsung/GearVRf into statesort
NolaDonato Jun 1, 2018
347496e
merge with master
NolaDonato Jun 6, 2018
f5ed41b
spell lightmapTexture consistently
NolaDonato Jun 6, 2018
4652793
fix in PBR and X3D shaders
NolaDonato Jun 6, 2018
ff69744
Fix bugs with adding / removing lights
NolaDonato Jun 7, 2018
610c150
Fix vertex buffer copy constructor, add missing normal coord
NolaDonato Jun 7, 2018
cc276ce
Merge with master
NolaDonato Jun 13, 2018
aafffe2
merge with PR #1899
NolaDonato Jun 13, 2018
bf18120
fix for adding and removing lights
NolaDonato Jun 13, 2018
e9019c0
fix X3D load without animations
NolaDonato Jun 13, 2018
87f5a3d
comment out log message
NolaDonato Jun 13, 2018
a767d4d
Merge branch 'master' of https://github.com/Samsung/GearVRf into stat…
NolaDonato Jun 13, 2018
7e44840
fix pbr shader binding conflict
NolaDonato Jun 13, 2018
75c0f73
fix pbr shader compile issue
NolaDonato Jun 13, 2018
2602799
Merge branch 'master' of https://github.com/NolaDonato/GearVRf into s…
NolaDonato Jun 20, 2018
4258e7d
Merge branch 'master' of https://github.com/Samsung/GearVRf into stat…
NolaDonato Oct 18, 2018
5e296c4
Revert "Merge branch 'master' of https://github.com/Samsung/GearVRf i…
NolaDonato Oct 18, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Original file line number Diff line number Diff line change
Expand Up @@ -435,27 +435,27 @@ public boolean replaceCursor(Cursor newCursor, Cursor oldCursor)
private void showSettingsMenu(final Cursor cursor) {
Log.d(TAG, "showSettingsMenu");
enableSettingsCursor(cursor);
context.runOnGlThread(new Runnable() {
context.getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
new SettingsView(context, scene, CursorManager.this,
settingsCursor.getIoDevice().getCursorControllerId(), cursor, new
SettingsChangeListener() {
@Override
public void onBack(boolean cascading) {
disableSettingsCursor();
}

@Override
public int onDeviceChanged(IoDevice device) {
// we are changing the io device on the settings cursor
removeCursorFromScene(settingsCursor);
IoDevice clickedDevice = getAvailableIoDevice(device);
settingsCursor.setIoDevice(clickedDevice);
addCursorToScene(settingsCursor);
return device.getCursorControllerId();
}
});
settingsCursor.getIoDevice().getCursorControllerId(), cursor, new
SettingsChangeListener() {
@Override
public void onBack(boolean cascading) {
disableSettingsCursor();
}

@Override
public int onDeviceChanged(IoDevice device) {
// we are changing the io device on the settings cursor
removeCursorFromScene(settingsCursor);
IoDevice clickedDevice = getAvailableIoDevice(device);
settingsCursor.setIoDevice(clickedDevice);
addCursorToScene(settingsCursor);
return device.getCursorControllerId();
}
});
}
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ public String getId() {
void load(Cursor cursor) {
assetRoot = new GVRSceneObject(cursor.getGVRContext());
assetRoot.attachComponent(new GVRSwitch(cursor.getGVRContext()));
assetRoot.setName(name);
for (CursorAsset asset : assets.values()) {
asset.load(cursor);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ void load(Cursor cursor)
if (cursorType == CursorType.LASER)
{
renderData.setDepthTest(false);
renderData.setAlphaBlend(true);
renderData.setRenderingOrder(OVERLAY_RENDER_ORDER);
}
assetSceneObject.attachRenderData(renderData);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@

import org.gearvrf.GVRContext;
import org.gearvrf.GVRSceneObject;
import org.gearvrf.animation.GVRAnimation;
import org.gearvrf.animation.GVRAnimationEngine;
import org.gearvrf.animation.GVRAnimator;
import org.gearvrf.animation.GVRRepeatMode;
import org.gearvrf.scene_objects.GVRModelSceneObject;
import org.gearvrf.utility.Log;

import java.io.IOException;
Expand All @@ -33,39 +34,37 @@
class ObjectCursorAsset extends CursorAsset {
private static final String TAG = ObjectCursorAsset.class.getSimpleName();
private final String assetName;
private SparseArray<GVRSceneObject> objects;
private SparseArray<GVRModelSceneObject> objects;
private GVRAnimationEngine animationEngine;
private int LOOP_REPEAT_COUNT = -1;

ObjectCursorAsset(GVRContext context, CursorType type, Action action, String assetName) {
super(context, type, action);
this.assetName = assetName;
objects = new SparseArray<GVRSceneObject>();
objects = new SparseArray<GVRModelSceneObject>();
animationEngine = context.getAnimationEngine();
}

@Override
void set(Cursor cursor) {
super.set(cursor);
GVRSceneObject modelSceneObject = objects.get(cursor.getId());
GVRModelSceneObject modelSceneObject = objects.get(cursor.getId());

if (modelSceneObject == null) {
Log.e(TAG, "Model not found, should not happen");
return;
}
modelSceneObject.setEnable(true);

GVRAnimator animator = (GVRAnimator) modelSceneObject.getComponent(GVRAnimator.getComponentType());
if (animator != null)
{
animator.setRepeatMode(GVRRepeatMode.REPEATED);
animator.setRepeatCount(LOOP_REPEAT_COUNT);
animator.start();
for (GVRAnimation animation : modelSceneObject.getAnimations()) {
animation.setRepeatMode(GVRRepeatMode.REPEATED);
animation.setRepeatCount(LOOP_REPEAT_COUNT);
animation.start(animationEngine);
}
}

private GVRSceneObject loadModelSceneObject() {
GVRSceneObject modelSceneObject = null;
private GVRModelSceneObject loadModelSceneObject() {
GVRModelSceneObject modelSceneObject = null;
try {
modelSceneObject = context.getAssetLoader().loadModel(assetName);
} catch (IOException e) {
Expand All @@ -79,22 +78,22 @@ private GVRSceneObject loadModelSceneObject() {
void reset(Cursor cursor) {
super.reset(cursor);

GVRSceneObject modelSceneObject = objects.get(cursor.getId());
GVRModelSceneObject modelSceneObject = objects.get(cursor.getId());

modelSceneObject.setEnable(false);
GVRAnimator animator = (GVRAnimator) modelSceneObject.getComponent(GVRAnimator.getComponentType());
if (animator != null)
{
animator.setRepeatMode(GVRRepeatMode.ONCE);
animator.setRepeatCount(0);
animator.start();
for (GVRAnimation animation : modelSceneObject.getAnimations()) {
if (animation.isFinished() == false) {
animation.setRepeatMode(GVRRepeatMode.ONCE);
animation.setRepeatCount(0);
animationEngine.stop(animation);
}
}
}

@Override
void load(Cursor cursor) {
Integer key = cursor.getId();
GVRSceneObject modelSceneObject = objects.get(key);
GVRModelSceneObject modelSceneObject = objects.get(key);

if (modelSceneObject == null) {
modelSceneObject = loadModelSceneObject();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

package org.gearvrf.io.cursor3d.settings;

import android.app.Activity;
import android.graphics.Color;
import android.os.Handler;
import android.os.Looper;
Expand All @@ -26,53 +25,53 @@
import org.gearvrf.GVRActivity;
import org.gearvrf.GVRContext;
import org.gearvrf.GVRScene;
import org.gearvrf.IViewEvents;
import org.gearvrf.scene_objects.GVRViewSceneObject;

abstract class BaseView {
private static final String TAG = BaseView.class.getSimpleName();
private static final float DEFAULT_SCALE = 10.0f;
private static final float QUAD_X = 10.0f;
private static final float QUAD_Y = 8f;
public static final float QUAD_DEPTH = -13f;
private FrameLayout frameLayout;

private float quadHeight;
private float quadWidth;
GVRScene scene;
GVRActivity activity;
GVRContext context;
Activity activity;
private GVRViewSceneObject layoutSceneObject;
private Handler glThreadHandler;
int settingsCursorId;

BaseView(GVRContext context, GVRScene scene, int settingsCursorId, int layoutID) {
this(context, scene, settingsCursorId, layoutID, DEFAULT_SCALE);
this(context, scene, settingsCursorId, layoutID, QUAD_Y, QUAD_X);
}

BaseView(final GVRContext context, final GVRScene scene,
final int settingsCursorId, final int layoutID, final float scale) {
BaseView(GVRContext context, GVRScene scene, int settingsCursorId, int layoutID, float
quadHeight, float quadWidth) {
this.context = context;
this.scene = scene;
this.activity = context.getActivity();
this.settingsCursorId = settingsCursorId;
this.quadHeight = quadHeight;
this.quadWidth = quadWidth;

activity = context.getActivity();
frameLayout = new FrameLayout(activity);
frameLayout.setBackgroundColor(Color.TRANSPARENT);
View.inflate(activity, layoutID, frameLayout);
glThreadHandler = new Handler(Looper.getMainLooper());
}

layoutSceneObject = new GVRViewSceneObject(context, layoutID, new IViewEvents() {
@Override
public void onInitView(GVRViewSceneObject gvrViewSceneObject, View view) {
BaseView.this.onInitView(view);
}

void render(final float x, final float y, final float z) {
glThreadHandler.post(new Runnable() {
@Override
public void onStartRendering(GVRViewSceneObject gvrViewSceneObject, View view) {
gvrViewSceneObject.getTransform().setScale(scale, scale, 1.0f);
BaseView.this.onStartRendering();
public void run() {
layoutSceneObject = new GVRViewSceneObject(context, frameLayout,
context.createQuad(quadWidth, quadHeight));
layoutSceneObject.getTransform().setPosition(x, y, z);
show();
}
});

layoutSceneObject.setTextureBufferSize(1024);
}

abstract protected void onInitView(View view);
abstract protected void onStartRendering();

void render(final float x, final float y, final float z) {
layoutSceneObject.getTransform().setPosition(x, y, z);
show();
}

void show() {
Expand All @@ -91,6 +90,10 @@ void enable() {
scene.addSceneObject(layoutSceneObject);
}

View findViewById(int id) {
return frameLayout.findViewById(id);
}

void setSettingsCursorId(int settingsCursorId) {
this.settingsCursorId = settingsCursorId;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

package org.gearvrf.io.cursor3d.settings;

import android.app.Activity;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.drawable.Drawable;
Expand All @@ -29,6 +28,7 @@
import android.widget.RelativeLayout;
import android.widget.TextView;

import org.gearvrf.GVRActivity;
import org.gearvrf.GVRContext;
import org.gearvrf.GVRScene;
import org.gearvrf.io.GVRTouchPadGestureListener;
Expand Down Expand Up @@ -73,7 +73,7 @@ class CursorConfigView extends BaseView implements View.OnClickListener {
currentCursor, final GVRScene scene, int
settingsCursorId, SettingsChangeListener changeListener) {
super(context, scene, settingsCursorId, R.layout.cursor_configuration_layout);
final Activity activity = context.getActivity();
final GVRActivity activity = context.getActivity();
loadDrawables(activity);
layoutInflater = (LayoutInflater) activity.getSystemService(Context
.LAYOUT_INFLATER_SERVICE);
Expand All @@ -82,31 +82,28 @@ class CursorConfigView extends BaseView implements View.OnClickListener {
this.currentCursor = currentCursor;
this.changeListener = changeListener;
loadThemes();
}

@Override
protected void onInitView(View view) {
TextView tvCursorName = (TextView) view.findViewById(R.id.tvCursorName);
TextView tvCursorName = (TextView) findViewById(R.id.tvCursorName);
tvCursorName.setText(cursor.getName());
TextView tvCursorType = (TextView) view.findViewById(R.id.tvCursorType);
TextView tvCursorType = (TextView) findViewById(R.id.tvCursorType);
if (cursor.getCursorType() == CursorType.LASER) {
tvCursorType.setText(R.string.cursor_type_laser);
} else {
tvCursorType.setText(R.string.cursor_type_object);
}
TextView tvBackButton = (TextView) view.findViewById(R.id.tvBackButton);
TextView tvBackButton = (TextView) findViewById(R.id.tvBackButton);
tvBackButton.setOnClickListener(this);

TextView done = (TextView) view.findViewById(R.id.done);
TextView done = (TextView) findViewById(R.id.done);
done.setOnClickListener(this);

LinearLayout llThemes = (LinearLayout) view.findViewById(R.id.llThemes);
LinearLayout llThemes = (LinearLayout) findViewById(R.id.llThemes);
themeViews = new ArrayList<View>();
for (CursorTheme theme : themes) {
addTheme(theme, llThemes, theme == cursor.getCursorTheme());
}

LinearLayout llIoDevices = (LinearLayout) view.findViewById(R.id.llIoDevices);
LinearLayout llIoDevices = (LinearLayout) findViewById(R.id.llIoDevices);
ioDevicesDisplayed = cursor.getAvailableIoDevices();
availableIoDevices = new HashSet<IoDevice>(ioDevicesDisplayed);
List<IoDevice> usedIoDevices = cursorManager.getUsedIoDevices();
Expand All @@ -121,22 +118,13 @@ protected void onInitView(View view) {
for (IoDevice ioDevice : ioDevicesDisplayed) {
addIoDevice(ioDevice, llIoDevices, cursorManager.isDeviceActive(ioDevice));
}
}

@Override
protected void onStartRendering() {
render(0.0f, 0.0f, BaseView.QUAD_DEPTH);
}

@Override
void show() {
super.show();
activity.runOnUiThread(new Runnable() {
@Override
public void run() {
setGestureDetector(new GestureDetector(swipeListener));
}
});
setGestureDetector(new GestureDetector(swipeListener));
}

private void loadDrawables(Context context) {
Expand Down Expand Up @@ -286,23 +274,18 @@ private void markIoDeviceSelected(int newIoDevicePosition) {
}

private void createIoChangeDialog(final IoDevice ioDevice, final int newIoDevicePosition) {
context.runOnGlThread(new Runnable() {
new IoChangeDialogView(context, scene, settingsCursorId, new IoChangeDialogView
.DialogResultListener() {
@Override
public void run() {
new IoChangeDialogView(context, scene, settingsCursorId, new IoChangeDialogView
.DialogResultListener() {
@Override
public void onConfirm() {
setSettingsCursorId(changeListener.onDeviceChanged(ioDevice));
markIoDeviceSelected(newIoDevicePosition);
navigateBack(true);
}
public void onConfirm() {
setSettingsCursorId(changeListener.onDeviceChanged(ioDevice));
markIoDeviceSelected(newIoDevicePosition);
navigateBack(true);
}

@Override
public void onCancel() {
@Override
public void onCancel() {

}
});
}
});
}
Expand Down
Loading