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

Fix alpha and caching #57

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions android/.idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,13 @@ public float getFar() {
public void onSurfaceCreated(GL10 unused, EGLConfig config) {
// Set the background frame color
float[] backgroundColor = main.getModelActivity().getBackgroundColor();
GLES20.glClearColor(backgroundColor[0], backgroundColor[1], backgroundColor[2], backgroundColor[3]);
//add aplha channel to background to render as a overlay on camera
GLES20.glClearColor(0f, 0f, 0f, 0f);
GLES20.glClear(GLES20.GL_DEPTH_BUFFER_BIT|GLES20.GL_COLOR_BUFFER_BIT);

// Use culling to remove back faces.
// Don't remove back faces so we can see them
// GLES20.glEnable(GLES20.GL_CULL_FACE);
//GLES20.glEnable(GLES20.GL_CULL_FACE);

// Enable depth testing for hidden-surface elimination.
GLES20.glEnable(GLES20.GL_DEPTH_TEST);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import org.andresoviedo.app.model3D.services.SceneLoader;
import org.andresoviedo.app.util.Utils;
import org.andresoviedo.app.util.content.ContentUtils;
import android.graphics.PixelFormat;
import android.os.Handler;

import android.opengl.GLSurfaceView;
Expand Down Expand Up @@ -37,6 +38,10 @@ public class ModelSurfaceView extends GLSurfaceView {

public ModelSurfaceView(Context context, RN3DView parent, String modelSrc, String textureSrc, float[] backgroundColor) {
super(context);
//for aplha channel
this.setZOrderOnTop(true);
this.setEGLConfigChooser(8, 8, 8, 8, 16, 0);
this.getHolder().setFormat(PixelFormat.RGBA_8888);
this.parent = parent;

this.modelSrc = modelSrc;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
package se.bonniernews.rn3d;

import android.content.Context;
import android.support.annotation.Nullable;
import android.support.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.NonNull;
import android.view.ViewGroup;

import com.facebook.infer.annotation.Assertions;
Expand Down
11 changes: 11 additions & 0 deletions android/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="Theme.Transparent" parent="android:Theme">
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowBackground">@android:color/transparent</item>
<item name="android:windowContentOverlay">@null</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowIsFloating">true</item>
<item name="android:backgroundDimEnabled">false</item>
</style>
</resources>
4 changes: 0 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
import ModelView from './lib/ModelView'
import ARModelView from './lib/ARModelView'
import Manager from './lib/Manager'
import ARManager from './lib/ARManager'

export {
ModelView,
ARModelView,
Manager,
ARManager
}
3 changes: 2 additions & 1 deletion ios/ARKitInteraction/Utilities/Utilities.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ extension float4x4 {
extension CGPoint {
/// Extracts the screen space point from a vector returned by SCNView.projectPoint(_:).
init(_ vector: SCNVector3) {
x = CGFloat(vector.x)
self.init()
x = CGFloat(vector.x)
y = CGFloat(vector.y)
}

Expand Down
28 changes: 0 additions & 28 deletions ios/RCT3DARModelView.h

This file was deleted.

177 changes: 0 additions & 177 deletions ios/RCT3DARModelView.m

This file was deleted.

8 changes: 0 additions & 8 deletions ios/RCT3DARModelViewManager.h

This file was deleted.

Loading