public void drawBoundingVolume(Camera camera, final Matrix4 vpMatrix, final Matrix4 projMatrix, final Matrix4 vMatrix, final Matrix4 mMatrix) { if(mVisualSphere == null) { mVisualSphere = new Sphere(1, 8, 8); Material material = new Material(); mVisualSphere.setMaterial(material); mVisualSphere.setColor(0xffffff00); mVisualSphere.setDrawingMode(GLES20.GL_LINE_LOOP); mVisualSphere.setDoubleSided(true); } mVisualSphere.setPosition(mPosition); mVisualSphere.setScale(mRadius * mScale); mVisualSphere.render(camera, vpMatrix, projMatrix, vMatrix, mTmpMatrix, null); }
/** * Creates a sphere primitive. * * @param radius * The radius of the sphere * @param segmentsW * The number of vertical segments * @param segmentsH * The number of horizontal segments * @param createTextureCoordinates * A boolean that indicates if the texture coordinates should be calculated or not. * @param createVertexColorBuffer * A boolean that indicates if a vertex color buffer should be created or not. * @param createVBOs * A boolean that indicates if the VBOs should be created immediately. * @param mirrorTextureCoords * A boolean that indicates if the texture coords should be mirrored horizontally. */ public Sphere(float radius, int segmentsW, int segmentsH, boolean createTextureCoordinates, boolean createVertexColorBuffer, boolean createVBOs, boolean mirrorTextureCoords) { super(); mRadius = radius; mSegmentsW = segmentsW; mSegmentsH = segmentsH; mCreateTextureCoords = createTextureCoordinates; mCreateVertexColorBuffer = createVertexColorBuffer; mMirrorTextureCoords = mirrorTextureCoords; init(createVBOs); }
setData(vertices, normals, textureCoords, colors, indices, createVBOs);
public DebugCamera(Camera camera, int color, int lineThickness) { super(color, lineThickness); mMaterial = new Material(); mCamera = camera; mPositionBall = new Sphere(0.25f, 8, 8); mPositionBall.setColor(color); mPositionBall.setMaterial(mMaterial); }
public void render(Camera camera, final Matrix4 vpMatrix, final Matrix4 projMatrix, final Matrix4 vMatrix, final Matrix4 parentMatrix, Material sceneMaterial) { updateFrustum(); mPositionBall.setPosition(mCamera.getPosition()); mPositionBall.render(camera, vpMatrix, projMatrix, vMatrix, parentMatrix, sceneMaterial); super.render(camera, vpMatrix, projMatrix, vMatrix, parentMatrix, sceneMaterial); } }
private static Sphere createPhotoSphereWithTexture(ATexture texture) { Material material = new Material(); material.setColor(0); try { material.addTexture(texture); } catch (ATexture.TextureException e) { throw new RuntimeException(e); } Sphere sphere = new Sphere(50, 64, 32); sphere.setScaleX(-1); sphere.setMaterial(material); return sphere; }
@Test public void testApplySphere() { Sphere sphere = new Sphere(1, 4, 2, false, false, false, false); sphere.getGeometry().getBoundingSphere(); visitor.apply(sphere); assertNull(visitor.getPickedObject()); }
Sphere sphere = new Sphere(50, 64, 32); sphere.setScaleX(-1); sphere.setMaterial(material);
public void drawBoundingVolume(Camera camera, final Matrix4 vpMatrix, final Matrix4 projMatrix, final Matrix4 vMatrix, final Matrix4 mMatrix) { if (mVisualSphere == null) { mVisualSphere = new Sphere(1, 8, 8); Material material = new Material(); mVisualSphere.setMaterial(material); mVisualSphere.setColor(0xffffff00); mVisualSphere.setDrawingMode(GLES20.GL_LINE_LOOP); mVisualSphere.setDoubleSided(true); } mVisualSphere.setPosition(mPosition); mVisualSphere.setScale(mRadius * mScale); mVisualSphere.render(camera, vpMatrix, projMatrix, vMatrix, mTmpMatrix, null); }
/** * Creates a sphere primitive. * * @param radius * The radius of the sphere * @param segmentsW * The number of vertical segments * @param segmentsH * The number of horizontal segments * @param createTextureCoordinates * A boolean that indicates whether the texture coordinates should be calculated or not. * @param createVertexColorBuffer * A boolean that indicates whether a vertex color buffer should be created or not. * @param createVertexColorBuffer * A boolean that indicates whether the VBOs should be created immediately. */ public Sphere(float radius, int segmentsW, int segmentsH, boolean createTextureCoordinates, boolean createVertexColorBuffer, boolean createVBOs) { super(); mRadius = radius; mSegmentsW = segmentsW; mSegmentsH = segmentsH; mCreateTextureCoords = createTextureCoordinates; mCreateVertexColorBuffer = createVertexColorBuffer; init(createVBOs); }
setData(vertices, normals, textureCoords, colors, indices, createVBOs);