Android Open Source - StorySphere Camera Screen






From Project

Back to project page StorySphere.

License

The source code is released under:

GNU General Public License

If you think the Android project StorySphere listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.ruselabs.storysphere.tricks;
/*  w  w  w .ja  v a2  s.co m*/
import android.graphics.SurfaceTexture;
import android.hardware.Camera;

import rajawali.Object3D;
import rajawali.materials.Material;
import rajawali.materials.textures.ATexture;
import rajawali.materials.textures.AlphaVideoTexture;
import rajawali.primitives.Plane;

/**
 * Created by davidbrodsky on 10/5/14.
 */
public class CameraScreen {

    Plane mVideoScreen;
//    VideoTexture mVideoTexture;
    AlphaVideoTexture mVideoTexture;
    Material mVideoMaterial;
    Camera mCamera;


    public CameraScreen(Camera camera, int initialHeight, int initialWidth, double x, double y, double z) {
        try {
            mCamera = camera;
//            mVideoTexture = new VideoTexture("camera", mCamera, new SurfaceTexture.OnFrameAvailableListener() {
//                @Override
//                public void onFrameAvailable(SurfaceTexture surfaceTexture) {
//                    // do nothing
//                }
//            });
            mVideoTexture = new AlphaVideoTexture("camera", mCamera, new SurfaceTexture.OnFrameAvailableListener() {
                @Override
                public void onFrameAvailable(SurfaceTexture surfaceTexture) {
                    // do nothing
                }
            });

            mVideoScreen = new Plane(initialWidth, initialHeight, 5, 5);
            mVideoScreen.setPosition(x, y, z);
//            mVideoScreen.setRotY(90);
            mVideoScreen.setDoubleSided(true);
            mVideoMaterial = new Material();
            mVideoMaterial.addTexture(mVideoTexture);
            mVideoMaterial.setColorInfluence(0f);

            mVideoScreen.setMaterial(mVideoMaterial);

        } catch (ATexture.TextureException e) {
            e.printStackTrace();
        }
    }

    public Object3D getScreen() {
        return mVideoScreen;
    }

    public void advanceFrame() {
        mVideoTexture.update();
    }
}




Java Source Code List

com.ruselabs.storysphere.activities.ARActivity.java
com.ruselabs.storysphere.activities.StorySphereActivity.java
com.ruselabs.storysphere.renderer.StorySphereRenderer.java
com.ruselabs.storysphere.tricks.CameraScreen.java
com.ruselabs.storysphere.tricks.ChromaVideoScreen.java
com.ruselabs.storysphere.tricks.PhotosphereBlender.java
com.ruselabs.storysphere.tricks.VideoScreen.java
com.ruselabs.storysphere.tricks.VideoSphereScreen.java