use of org.rajawali3d.materials.Material in project Rajawali by Rajawali.
the class GridFloor method createGridFloor.
private void createGridFloor() {
final float sizeHalf = mSize * 0.5f;
final float spacing = mSize / mNumLines;
mPoints = new Stack<>();
for (float z = -sizeHalf; z <= sizeHalf; z += spacing) {
mPoints.add(new Vector3(-sizeHalf, 0, z));
mPoints.add(new Vector3(sizeHalf, 0, z));
}
for (float x = -sizeHalf; x <= sizeHalf; x += spacing) {
mPoints.add(new Vector3(x, 0, -sizeHalf));
mPoints.add(new Vector3(x, 0, sizeHalf));
}
setMaterial(new Material());
init(true);
setDrawingMode(GLES20.GL_LINES);
}
use of org.rajawali3d.materials.Material in project Rajawali by Rajawali.
the class DebugBoundingBox method updateBoundingBox.
public void updateBoundingBox(BoundingBox boundingBox) {
if (mBBoxVertices == null) {
mBBoxVertices = new Vector3[8];
mPoints = new Stack<>();
for (int i = 0; i < 16; i++) {
mPoints.push(new Vector3());
if (i < 8)
mBBoxVertices[i] = new Vector3();
}
init(true);
getGeometry().changeBufferUsage(mGeometry.getVertexBufferInfo(), GLES20.GL_DYNAMIC_DRAW);
setMaterial(new Material());
}
updateBox(boundingBox);
}
use of org.rajawali3d.materials.Material 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.materials.Material in project Rajawali by Rajawali.
the class EffectPass method createMaterial.
protected void createMaterial(@NonNull VertexShader vertexShader, @NonNull FragmentShader fragmentShader) {
mVertexShader = vertexShader;
mFragmentShader = fragmentShader;
mVertexShader.setNeedsBuild(false);
mFragmentShader.setNeedsBuild(false);
setMaterial(new Material(mVertexShader, mFragmentShader));
}
use of org.rajawali3d.materials.Material in project Rajawali by Rajawali.
the class Scene method setSkybox.
/**
* Creates a skybox with the specified 6 textures.
*
* @param posx int Resource id for the front face.
* @param negx int Resource id for the right face.
* @param posy int Resource id for the back face.
* @param negy int Resource id for the left face.
* @param posz int Resource id for the up face.
* @param negz int Resource id for the down face.
* @throws TextureException
*/
public boolean setSkybox(int posx, int negx, int posy, int negy, int posz, int negz) throws TextureException {
final AFrameTask task = new AFrameTask() {
@Override
protected void doTask() {
for (int i = 0, j = mCameras.size(); i < j; ++i) mCameras.get(i).setFarPlane(1000);
}
};
synchronized (mNextSkyboxLock) {
mNextSkybox = new Cube(700, true);
int[] resourceIds = new int[] { posx, negx, posy, negy, posz, negz };
mSkyboxTexture = new CubeMapTexture("skybox", resourceIds);
((CubeMapTexture) mSkyboxTexture).isSkyTexture(true);
Material mat = new Material();
mat.setColorInfluence(0);
mat.addTexture(mSkyboxTexture);
mNextSkybox.setMaterial(mat);
}
return internalOfferTask(task);
}
Aggregations