use of org.rajawali3d.primitives.ScreenQuad in project Rajawali by Rajawali.
the class SideBySideRenderer method initScene.
@Override
public void initScene() {
mCameraLeft = new Camera();
mCameraLeft.setNearPlane(.01f);
mCameraLeft.setFieldOfView(getCurrentCamera().getFieldOfView());
mCameraLeft.setNearPlane(getCurrentCamera().getNearPlane());
mCameraLeft.setFarPlane(getCurrentCamera().getFarPlane());
mCameraRight = new Camera();
mCameraRight.setNearPlane(.01f);
mCameraRight.setFieldOfView(getCurrentCamera().getFieldOfView());
mCameraRight.setNearPlane(getCurrentCamera().getNearPlane());
mCameraRight.setFarPlane(getCurrentCamera().getFarPlane());
setPupilDistance(mPupilDistance);
mLeftQuadMaterial = new Material();
mLeftQuadMaterial.setColorInfluence(0);
mRightQuadMaterial = new Material();
mRightQuadMaterial.setColorInfluence(0);
mSideBySideScene = new Scene(this);
mLeftQuad = new ScreenQuad();
mLeftQuad.setScaleX(.5);
mLeftQuad.setX(-.25);
mLeftQuad.setMaterial(mLeftQuadMaterial);
mSideBySideScene.addChild(mLeftQuad);
mRightQuad = new ScreenQuad();
mRightQuad.setScaleX(.5);
mRightQuad.setX(.25);
mRightQuad.setMaterial(mRightQuadMaterial);
mSideBySideScene.addChild(mRightQuad);
addScene(mSideBySideScene);
mViewportWidthHalf = (int) (mDefaultViewportWidth * .5f);
mLeftRenderTarget = new RenderTarget("sbsLeftRT", mViewportWidthHalf, mDefaultViewportHeight);
mLeftRenderTarget.setFullscreen(false);
mRightRenderTarget = new RenderTarget("sbsRightRT", mViewportWidthHalf, mDefaultViewportHeight);
mRightRenderTarget.setFullscreen(false);
mCameraLeft.setProjectionMatrix(mViewportWidthHalf, mDefaultViewportHeight);
mCameraRight.setProjectionMatrix(mViewportWidthHalf, mDefaultViewportHeight);
addRenderTarget(mLeftRenderTarget);
addRenderTarget(mRightRenderTarget);
try {
mLeftQuadMaterial.addTexture(mLeftRenderTarget.getTexture());
mRightQuadMaterial.addTexture(mRightRenderTarget.getTexture());
} catch (TextureException e) {
e.printStackTrace();
}
}
use of org.rajawali3d.primitives.ScreenQuad in project Rajawali by Rajawali.
the class VuforiaRenderer method onRenderSurfaceSizeChanged.
@Override
public void onRenderSurfaceSizeChanged(GL10 gl, int width, int height) {
RajLog.i("onRenderSurfaceSizeChanged " + width + ", " + height);
super.onRenderSurfaceSizeChanged(gl, width, height);
updateRendering(width, height);
QCAR.onSurfaceChanged(width, height);
getCurrentCamera().setProjectionMatrix(getFOV(), getVideoWidth(), getVideoHeight());
if (mBackgroundRenderTarget == null) {
mBackgroundRenderTarget = new RenderTarget("rajVuforia", width, height);
addRenderTarget(mBackgroundRenderTarget);
Material material = new Material();
material.setColorInfluence(0);
try {
material.addTexture(mBackgroundRenderTarget.getTexture());
} catch (TextureException e) {
e.printStackTrace();
}
mBackgroundQuad = new ScreenQuad();
if (mVuforiaManager.getScreenOrientation() == ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE)
mBackgroundQuad.setScaleY((float) height / (float) getVideoHeight());
else
mBackgroundQuad.setScaleX((float) width / (float) getVideoWidth());
mBackgroundQuad.setMaterial(material);
getCurrentScene().addChildAt(mBackgroundQuad, 0);
}
}
Aggregations