use of org.rajawali3d.renderer.pip.WorkaroundScreenQuad in project Rajawali by Rajawali.
the class PipRenderer method initScene.
@Override
public void initScene() {
mMainQuadMaterial = new Material();
mMainQuadMaterial.setColorInfluence(0);
mMiniQuadMaterial = new Material();
mMiniQuadMaterial.setColorInfluence(0);
mMainQuad = new WorkaroundScreenQuad();
mMainQuad.setMaterial(mMainQuadMaterial);
mMainQuad.setTransparent(true);
// Set-up viewport dimensions of mini quad for touch event processing
setupMiniTouchLimits();
mMiniQuad = new WorkaroundScreenQuad();
// Set the size of the mini view using a scale factor (mPipScale times the main view)
mMiniQuad.setScale(mPipScale);
// Position the mini view in the top right corner
// For X and Y, the position is:
// 50% screen shift to the right/top minus half the size of the minimap to bring it back
// left/bottom into full view plus a little bit more left/bottom to leave margin
mMiniQuad.setX(.5d - mPipScale / 2d - mPipMarginX / mDefaultViewportWidth);
mMiniQuad.setY(.5d - mPipScale / 2d - mPipMarginY / mDefaultViewportHeight);
mMiniQuad.setMaterial(mMiniQuadMaterial);
mMainRenderTarget = new RenderTarget("pipMainRT", mDefaultViewportWidth, mDefaultViewportHeight);
mMainRenderTarget.setFullscreen(false);
mMiniRenderTarget = new RenderTarget("pipMiniRT", mDefaultViewportWidth, mDefaultViewportHeight);
mMiniRenderTarget.setFullscreen(false);
addRenderTarget(mMainRenderTarget);
addRenderTarget(mMiniRenderTarget);
mCompositeScene = getCurrentScene();
mCompositeScene.addChild(mMainQuad);
mCompositeScene.addChild(mMiniQuad);
try {
mMiniQuadMaterial.addTexture(mMiniRenderTarget.getTexture());
mMainQuadMaterial.addTexture(mMainRenderTarget.getTexture());
} catch (ATexture.TextureException e) {
e.printStackTrace();
}
// Init main scene
mMainRenderer.initScene();
// Init mini scene
mMiniRenderer.initScene();
}
Aggregations