/** * Creates a line primitive with a single color. * * @param points * @param thickness * @param color */ public Line3D(Stack<Vector3> points, float thickness, int color) { this(points, thickness, null); setColor(color); }
/** * Creates a cube primitive. * * @param width The width of the prism. * @param height The height of the prism. * @param depth The depth of the prism. * @param hasCubemapTexture A boolean that indicates a cube map texture will be used (6 textures) or a regular * single texture. * @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 createVBOs A boolean that indicates whether the VBOs should be created imediately or not. */ public RectangularPrism(float width, float height, float depth, boolean hasCubemapTexture, boolean createTextureCoordinates, boolean createVertexColorBuffer, boolean createVBOs) { super(); mWidth = width; mHeight = height; mDepth = depth; mHasCubemapTexture = hasCubemapTexture; mCreateTextureCoords = createTextureCoordinates; mCreateVertexColorBuffer = createVertexColorBuffer; init(createVBOs); }
/** * Creates a cube primitive. * * @param size The size of the cube. * @param isSkybox A boolean that indicates whether this is a skybox or not. If set to true the normals will * be inverted. * @param hasCubemapTexture A boolean that indicates a cube map texture will be used (6 textures) or a regular * single texture. * @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 createVBOs A boolean that indicates whether the VBOs should be created immediately. */ public Cube(float size, boolean isSkybox, boolean hasCubemapTexture, boolean createTextureCoordinates, boolean createVertexColorBuffer, boolean createVBOs) { super(); mIsSkybox = isSkybox; mSize = size; mHasCubemapTexture = hasCubemapTexture; mCreateTextureCoords = createTextureCoordinates; mCreateVertexColorBuffer = createVertexColorBuffer; init(createVBOs); }
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); }
final Cube cube = new Cube(0.25f); cube.setMaterial(material); cube.setColor(0xffffff00); // Yellow addChild(cube); final Cylinder xAxis = new Cylinder(0.75f, 0.05f, 1, 6); xAxis.setMaterial(material); xAxis.setColor(0xffff0000); // Red xAxis.rotate(Vector3.Axis.Y, 90.0); xAxis.setPosition(0.375, 0, 0); addChild(xAxis); final NPrism xTip = new NPrism(8, 0, 0.1f, 0.25f); xTip.setMaterial(material); xTip.setColor(0xffff0000); // Red xTip.rotate(Vector3.Axis.Z, 90.0); xTip.setPosition(0.875f, 0, 0); addChild(xTip); final Cylinder yAxis = new Cylinder(0.75f, 0.05f, 1, 6); yAxis.setMaterial(material); yAxis.setColor(0xff00ff00); // Green yAxis.rotate(Vector3.Axis.X, 90.0); yAxis.setPosition(0, 0.375, 0); addChild(yAxis); final NPrism yTip = new NPrism(8, 0, 0.1f, 0.25f); yTip.setMaterial(material); yTip.setColor(0xff00ff00); // Green
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); }
/** * Creates a skybox with the specified 6 {@link Bitmap} textures. * * @param bitmaps {@link Bitmap} array containing the cube map textures. */ public boolean setSkybox(Bitmap[] bitmaps) throws TextureException { final Cube skybox = new Cube(700, true); final CubeMapTexture texture = new CubeMapTexture("bitmap_skybox", bitmaps); texture.isSkyTexture(true); final Material material = new Material(); material.setColorInfluence(0); material.addTexture(texture); skybox.setMaterial(material); return setSkybox(skybox, texture); }
@Test public void testApplySphere() { Sphere sphere = new Sphere(1, 4, 2, false, false, false, false); sphere.getGeometry().getBoundingSphere(); visitor.apply(sphere); assertNull(visitor.getPickedObject()); }
/** * Creates a frustum like prism with elliptical base rather than circular. * The major axis is equivalent to the radius specified and the minor axis * is computed from the eccentricity. * * @param sides Integer number of sides to the prism. * @param radiusTop Double the radius of the top. * @param radiusBase Double the radius of the base. * @param eccentricity Double the eccentricity of the ellipse. * @param height Double the height of the prism. * @param createVBOs Boolean If true, the VBOs are created immediately. */ public NPrism(int sides, double radiusTop, double radiusBase, double eccentricity, double height, boolean createVBOs) { if (sides < 3) throw new IllegalArgumentException("Prisms must have at least 3 sides!"); if ((eccentricity < 0) || (eccentricity >= 1)) throw new IllegalArgumentException("Eccentricity must be in the range [0,1)"); mSideCount = sides; mEccentricity = eccentricity; mRadiusTop = radiusTop; mMinorTop = calculateMinorAxis(mRadiusTop); mRadiusBase = radiusBase; mMinorBase = calculateMinorAxis(mRadiusBase); mHeight = height; init(createVBOs); }
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); } }
@Before public void setup() { screenQuad = new ScreenQuad(false); }
/** * Creates a ScreenQuad. * * @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 numTextureTiles * The number of texture tiles. If more than 1 the texture will be repeat by n times. * @param createVBOs * A boolean that indicates whether the VBOs should be created immediately. */ public ScreenQuad(int segmentsW, int segmentsH, boolean createTextureCoordinates, boolean createVertexColorBuffer, int numTextureTiles, boolean createVBOs, UVmapping mapping) { super(); mSegmentsW = segmentsW; mSegmentsH = segmentsH; mCreateTextureCoords = createTextureCoordinates; mCreateVertexColorBuffer = createVertexColorBuffer; mNumTextureTiles = numTextureTiles; init(createVBOs, mapping); }
/** * 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); }
mCreateVertexColorBuffer = createVertexColorBuffer; mNumTextureTiles = numTextureTiles; init(createVBOs);
public void setBoundingColor(int color) { mBoundingColor.set(color); if (mVisualBox != null) { mVisualBox.setColor(color); } }
/** * Creates a line primitive with a specified color for each point. * * @param points * @param thickness * @param colors * @param createVBOs */ public Line3D(Stack<Vector3> points, float thickness, int[] colors, boolean createVBOs) { super(); mPoints = points; mLineThickness = thickness; mColors = colors; if (colors != null && colors.length != points.size()) throw new RuntimeException("The number of line points and colors is not the same."); init(createVBOs); }
/** * Reloads this scene. */ public void reload() { reloadChildren(); if(mSkybox != null) mSkybox.reload(); reloadPlugins(); mReloadPickerInfo = true; }
/** * Creates a cylinder primitive. * * @param length * The length of the cylinder * @param radius * The radius of the cylinder * @param segmentsL * The number of length segments * @param segmentsC * The number of circle 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 createVBOs * A boolean that indicates whether the VBOs should be created immediately. */ public Cylinder(float length, float radius, int segmentsL, int segmentsC, boolean createTextureCoordinates, boolean createVertexColorBuffer, boolean createVBOs) { super(); mLength = length; mRadius = radius; mSegmentsL = segmentsL; mSegmentsC = segmentsC; mCreateTextureCoords = createTextureCoordinates; mCreateVertexColorBuffer = createVertexColorBuffer; init(createVBOs); }
/** * Creates a torus primitive. * * @param largeRadius * The large radius of the dount * @param smallRadius * The small radius of the dount * @param segmentsL * The number of segments on the large radius * @param segmentsS * The number of segments on the small radius * @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 createVBOs * A boolean that indicates whether the VBOs should be created immediately. */ public Torus(float largeRadius, float smallRadius, int segmentsL, int segmentsS, boolean createTextureCoordinates, boolean createVertexColorBuffer, boolean createVBOs) { super(); mLargeRadius = largeRadius; mSmallRadius = smallRadius; mSegmentsL = segmentsL; mSegmentsS = segmentsS; mCreateTextureCoords = createTextureCoordinates; mCreateVertexColorBuffer = createVertexColorBuffer; init(createVBOs); }