Package com.ardor3d.math

Examples of com.ardor3d.math.ColorRGBA


    private void setupDefaultStates() {
        _lightState.detachAll();
        final DirectionalLight dLight = new DirectionalLight();
        dLight.setEnabled(true);
        dLight.setAmbient(new ColorRGBA(0.4f, 0.4f, 0.5f, 1));
        dLight.setDiffuse(new ColorRGBA(0.6f, 0.6f, 0.5f, 1));
        dLight.setSpecular(new ColorRGBA(0.3f, 0.3f, 0.2f, 1));
        dLight.setDirection(new Vector3(-1, -1, -1).normalizeLocal());
        _lightState.attach(dLight);
        _lightState.setEnabled(true);

        final CullState cs = new CullState();
        cs.setEnabled(true);
        cs.setCullFace(CullState.Face.Back);
        _root.setRenderState(cs);

        final FogState fs = new FogState();
        fs.setStart(farPlane / 2.0f);
        fs.setEnd(farPlane);
        fs.setColor(new ColorRGBA(1.0f, 1.0f, 1.0f, 1.0f));
        fs.setDensityFunction(DensityFunction.Linear);
        _root.setRenderState(fs);
    }
View Full Code Here


     * @param i
     *            Index of the light
     */
    void randomLight(final int i) {
        // Chose the color for the lights.
        final ColorRGBA lightColor = ColorRGBA.randomColor(new ColorRGBA());

        // Create a sphere to show where the light is in the demo.
        final Sphere lightSphere = new Sphere("lightSphere" + i, 9, 9, .1f);
        lightSphere.setModelBound(new BoundingSphere());
        lightSphere.getSceneHints().setLightCombineMode(LightCombineMode.Off);
        lightSphere.setDefaultColor(lightColor);

        // Create a new point light and fill out the properties
        final PointLight pointLight = new PointLight();
        pointLight.setAttenuate(true);
        pointLight.setConstant(.01f);
        pointLight.setLinear(.001f);
        pointLight.setQuadratic(.1f);
        pointLight.setEnabled(true);
        pointLight.setDiffuse(lightColor);
        pointLight.setAmbient(new ColorRGBA(.1f, .1f, .1f, .1f));

        _lightState.attach(pointLight);

        lightSphere.addController(new SpatialController<Spatial>() {

View Full Code Here

    private void setupDefaultStates() {
        _lightState.detachAll();
        final DirectionalLight dLight = new DirectionalLight();
        dLight.setEnabled(true);
        dLight.setAmbient(new ColorRGBA(0.4f, 0.4f, 0.5f, 1));
        dLight.setDiffuse(new ColorRGBA(0.6f, 0.6f, 0.5f, 1));
        dLight.setSpecular(new ColorRGBA(0.3f, 0.3f, 0.2f, 1));
        dLight.setDirection(new Vector3(-1, -1, -1).normalizeLocal());
        _lightState.attach(dLight);
        _lightState.setEnabled(true);

        final CullState cs = new CullState();
        cs.setEnabled(true);
        cs.setCullFace(CullState.Face.Back);
        _root.setRenderState(cs);

        final FogState fs = new FogState();
        fs.setStart(farPlane / 2.0f);
        fs.setEnd(farPlane);
        fs.setColor(new ColorRGBA(1.0f, 1.0f, 1.0f, 1.0f));
        fs.setDensityFunction(DensityFunction.Linear);
        _root.setRenderState(fs);
    }
View Full Code Here

        }

        if (aboveWater && camera.getLocation().getY() < waterNode.getWaterHeight()) {
            fogState.setStart(-1000f);
            fogState.setEnd(farPlane / 10f);
            fogState.setColor(new ColorRGBA(0.0f, 0.0f, 0.1f, 1.0f));
            aboveWater = false;
        } else if (!aboveWater && camera.getLocation().getY() >= waterNode.getWaterHeight()) {
            fogState.setStart(farPlane / 2.0f);
            fogState.setEnd(farPlane);
            fogState.setColor(new ColorRGBA(0.96f, 0.97f, 1.0f, 1.0f));
            aboveWater = true;
        }

        if (updateTerrain) {
            terrainCamera.set(camera);
View Full Code Here

        _controlHandle.setMoveSpeed(50);

        _lightState.detachAll();
        final DirectionalLight dLight = new DirectionalLight();
        dLight.setEnabled(true);
        dLight.setAmbient(new ColorRGBA(0.4f, 0.4f, 0.5f, 1));
        dLight.setDiffuse(new ColorRGBA(0.6f, 0.6f, 0.5f, 1));
        dLight.setSpecular(new ColorRGBA(0.3f, 0.3f, 0.2f, 1));
        dLight.setDirection(new Vector3(-1, -1, -1).normalizeLocal());
        _lightState.attach(dLight);
        _lightState.setEnabled(true);

        final CullState cs = new CullState();
        cs.setEnabled(true);
        cs.setCullFace(CullState.Face.Back);
        _root.setRenderState(cs);

        fogState = new FogState();
        fogState.setStart(farPlane / 2.0f);
        fogState.setEnd(farPlane);
        fogState.setColor(new ColorRGBA(0.96f, 0.97f, 1.0f, 1.0f));
        fogState.setDensityFunction(DensityFunction.Linear);
        _root.setRenderState(fogState);

        // add our sphere, but have it off for now.
        sphere.getSceneHints().setCullHint(CullHint.Always);
View Full Code Here

        smoke.setSpeed(1.0f);
        smoke.setMinimumLifeTime(age / 2);
        smoke.setMaximumLifeTime(age);
        smoke.setStartSize(1.0f);
        smoke.setEndSize(12.0f);
        smoke.setStartColor(new ColorRGBA(1.0f, 1.0f, 1.0f, 1.0f));
        smoke.setEndColor(new ColorRGBA(.22f, .2f, .18f, 0.0f));
        smoke.setInitialVelocity(0.03f);
        smoke.setParticleEmitter(new MeshEmitter(emitDisc, false));
        smoke.setRotateWithScene(true);

        final BlendState blend = new BlendState();
View Full Code Here

     */
    private void setupFog() {
        final FogState fogState = new FogState();
        fogState.setDensity(1.0f);
        fogState.setEnabled(true);
        fogState.setColor(new ColorRGBA(1.0f, 1.0f, 1.0f, 1.0f));
        fogState.setEnd((float) farPlane);
        fogState.setStart((float) farPlane / 10.0f);
        fogState.setDensityFunction(FogState.DensityFunction.Linear);
        fogState.setQuality(FogState.Quality.PerVertex);
        _root.setRenderState(fogState);
View Full Code Here

        if (!isInitialized) {
            final DisplaySettings settings = new DisplaySettings(cam.getWidth(), cam.getHeight(), 24, 0, 0, 8, 0, 0,
                    false, false);
            _sceneTextureRenderer = TextureRendererFactory.INSTANCE.createTextureRenderer(settings, false, renderer,
                    ContextManager.getCurrentContext().getCapabilities());
            _sceneTextureRenderer.setBackgroundColor(new ColorRGBA(0.0f, 0.0f, 0.1f, 0f));

            _blurBufferTexture = new Texture2D();
            _blurBufferTexture.setWrap(Texture.WrapMode.Clamp);
            _blurBufferTexture.setMinificationFilter(MinificationFilter.NearestNeighborNoMipMaps);
            _blurBufferTexture.setMagnificationFilter(Texture.MagnificationFilter.NearestNeighbor);
View Full Code Here

        _text.getSceneHints().setCullHint(CullHint.Always);
        _root.attachChild(_text);

        // Set up picked pulse
        _pickedControl = new SpatialController<Spatial>() {
            ColorRGBA curr = new ColorRGBA();
            float val = 0;
            boolean add = true;

            @Override
            public void update(final double time, final Spatial caller) {
                val += time * (add ? 1 : -1);
                if (val < 0) {
                    val = -val;
                    add = true;
                } else if (val > 1) {
                    val = 1 - (val - (int) val);
                    add = false;
                }

                curr.set(val, val, val, 1.0f);

                final MaterialState ms = (MaterialState) caller.getLocalRenderState(StateType.Material);
                ms.setAmbient(curr);
            }
        };
View Full Code Here

        _root.setRenderState(buf);

        // ---- LIGHTS
        /** Set up a basic, default light. */
        light = new PointLight();
        light.setDiffuse(new ColorRGBA(0.75f, 0.75f, 0.75f, 0.75f));
        light.setAmbient(new ColorRGBA(0.5f, 0.5f, 0.5f, 1.0f));
        light.setLocation(new Vector3(100, 100, 100));
        light.setEnabled(true);

        /** Attach the light to a lightState and the lightState to rootNode. */
        _lightState = new LightState();
View Full Code Here

TOP

Related Classes of com.ardor3d.math.ColorRGBA

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.