Examples of GLSLShaderObjectsState


Examples of com.ardor3d.renderer.state.GLSLShaderObjectsState

            createAnimation();

            System.out.println("Importing: " + mainFile);
            System.out.println("Took " + (System.currentTimeMillis() - time) + " ms");

            gpuShader = new GLSLShaderObjectsState();
            gpuShader.setEnabled(true);
            try {
                gpuShader.setVertexShader(ResourceLocatorTool.getClassPathResourceAsStream(AnimationCopyExample.class,
                        "com/ardor3d/extension/animation/skeletal/skinning_gpu_texture.vert"));
                gpuShader.setFragmentShader(ResourceLocatorTool.getClassPathResourceAsStream(
View Full Code Here

Examples of com.ardor3d.renderer.state.GLSLShaderObjectsState

            ex.printStackTrace();
        }

        colladaNode = colladaStorage.getScene();

        gpuShader = new GLSLShaderObjectsState();
        gpuShader.setEnabled(true);
        try {
            gpuShader.setVertexShader(ResourceLocatorTool.getClassPathResourceAsStream(
                    AnimationBlinnPhongExample.class,
                    "com/ardor3d/example/media/models/collada/juanita/skinning_gpu2.vert"));
View Full Code Here

Examples of com.ardor3d.renderer.state.GLSLShaderObjectsState

            indices[i * 4 + 2] = 0;
            indices[i * 4 + 3] = 0;
        }
        arm.setJointIndices(indices);

        final GLSLShaderObjectsState gpuShader = new GLSLShaderObjectsState();
        gpuShader.setEnabled(useGPU);
        try {
            gpuShader.setVertexShader(ResourceLocatorTool.getClassPathResourceAsStream(PrimitiveSkeletonExample.class,
                    "com/ardor3d/extension/animation/skeletal/skinning_gpu.vert"));
            gpuShader.setFragmentShader(ResourceLocatorTool.getClassPathResourceAsStream(PrimitiveSkeletonExample.class,
                    "com/ardor3d/extension/animation/skeletal/skinning_gpu.frag"));
        } catch (final IOException ioe) {
            ioe.printStackTrace();
        }
        arm.setGPUShader(gpuShader);
View Full Code Here

Examples of com.ardor3d.renderer.state.GLSLShaderObjectsState

            final Node colladaNode = storage.getScene();

            System.out.println("Importing: " + mainFile);
            System.out.println("Took " + (System.currentTimeMillis() - time) + " ms");

            final GLSLShaderObjectsState gpuShader = new GLSLShaderObjectsState();
            gpuShader.setEnabled(true);
            try {
                gpuShader.setVertexShader(ResourceLocatorTool.getClassPathResourceAsStream(AnimationDemoExample.class,
                        "com/ardor3d/extension/animation/skeletal/skinning_gpu_texture.vert"));
                gpuShader.setFragmentShader(ResourceLocatorTool.getClassPathResourceAsStream(
                        AnimationDemoExample.class,
                        "com/ardor3d/extension/animation/skeletal/skinning_gpu_texture.frag"));

                gpuShader.setUniform("texture", 0);
                gpuShader.setUniform("lightDirection", new Vector3(1, 1, 1).normalizeLocal());
            } catch (final IOException ioe) {
                ioe.printStackTrace();
            }

            // OPTIMIZATION: SkinnedMesh combining... Useful in our case because the skeleton model is composed of 2
            // separate meshes.
            skeleton = (SkinnedMesh) MeshCombiner.combine(colladaNode, new SkinnedMeshCombineLogic());
            // Non-combined:
            // primeModel = colladaNode;

            // OPTIMIZATION: turn on the buffers in our skeleton so they can be shared. (reuse ids)
            skeleton.acceptVisitor(new Visitor() {
                @Override
                public void visit(final Spatial spatial) {
                    if (spatial instanceof SkinnedMesh) {
                        final SkinnedMesh skinnedSpatial = (SkinnedMesh) spatial;
                        skinnedSpatial.recreateWeightAttributeBuffer();
                        skinnedSpatial.recreateJointAttributeBuffer();
                    }
                }
            }, true);

            // OPTIMIZATION: run nv strippifyier on model...
            final NvTriangleStripper stripper = new NvTriangleStripper();
            stripper.setReorderVertices(true);
            skeleton.acceptVisitor(stripper, true);

            // OPTIMIZATION: don't draw surfaces that face away from the camera...
            final CullState cullState = new CullState();
            cullState.setCullFace(Face.Back);
            skeleton.setRenderState(cullState);

            skeleton.getSceneHints().setDataMode(DataMode.VBO);
            gpuShader.setUseAttributeVBO(true);
            skeleton.setGPUShader(gpuShader);
            skeleton.setUseGPU(true);

        } catch (final Exception ex) {
            ex.printStackTrace();
View Full Code Here

Examples of com.ardor3d.renderer.state.GLSLShaderObjectsState

            createAnimation();

            System.out.println("Importing: " + mainFile);
            System.out.println("Took " + (System.currentTimeMillis() - time) + " ms");

            gpuShader = new GLSLShaderObjectsState();
            gpuShader.setEnabled(true);
            try {
                gpuShader.setVertexShader(ResourceLocatorTool.getClassPathResourceAsStream(AnimationStateExample.class,
                        "com/ardor3d/extension/animation/skeletal/skinning_gpu_texture.vert"));
                gpuShader.setFragmentShader(ResourceLocatorTool.getClassPathResourceAsStream(
View Full Code Here

Examples of com.ardor3d.renderer.state.GLSLShaderObjectsState

        this.useProjectedShader = useProjectedShader;
        this.useRefraction = useRefraction;
        this.renderScale = renderScale;
        resetParameters();

        waterShader = new GLSLShaderObjectsState();
        blurShaderVertical = new GLSLShaderObjectsState();

        cullBackFace = new CullState();
        cullBackFace.setEnabled(true);
        cullBackFace.setCullFace(CullState.Face.None);
    }
View Full Code Here

Examples of com.ardor3d.renderer.state.GLSLShaderObjectsState

        _colorRampTexture = colorRampTexture;
        _colorRampTexture.setWrap(WrapMode.EdgeClamp);
    }

    private GLSLShaderObjectsState getColorizeShader() {
        final GLSLShaderObjectsState shader = new GLSLShaderObjectsState();
        try {
            shader.setVertexShader(ResourceLocatorTool.getClassPathResourceAsStream(ColorReplaceEffect.class,
                    shaderDirectory + "fsq.vert"));
            shader.setFragmentShader(ResourceLocatorTool.getClassPathResourceAsStream(ColorReplaceEffect.class,
                    shaderDirectory + "color_replace.frag"));
        } catch (final Exception e) {
            e.printStackTrace();
        }
        shader.setUniform("inputTex", 0);
        shader.setUniform("colorRampTex", 1);
        shader.setUniform("redWeight", _redWeight);
        shader.setUniform("greenWeight", _greenWeight);
        shader.setUniform("blueWeight", _blueWeight);
        return shader;
    }
View Full Code Here

Examples of com.ardor3d.renderer.state.GLSLShaderObjectsState

        secondTexture = new Texture2D();
        secondTexture.setWrap(Texture.WrapMode.Clamp);
        secondTexture.setMagnificationFilter(Texture.MagnificationFilter.Bilinear);
        tRenderer.setupTexture(secondTexture);

        extractionShader = new GLSLShaderObjectsState();
        try {
            extractionShader.setVertexShader(ResourceLocatorTool.getClassPathResourceAsStream(BloomRenderPass.class,
                    shaderDirectory + "bloom_extract.vert"));
            extractionShader.setFragmentShader(ResourceLocatorTool.getClassPathResourceAsStream(BloomRenderPass.class,
                    shaderDirectory + "bloom_extract.frag"));
        } catch (final IOException ex) {
            logger.logp(Level.SEVERE, getClass().getName(), "init(Renderer)", "Could not load shaders.", ex);
        }
        extractionShader.setUniform("RT", 0);

        // Create blur shader
        blurShader = new GLSLShaderObjectsState();
        try {
            blurShader.setVertexShader(ResourceLocatorTool.getClassPathResourceAsStream(BloomRenderPass.class,
                    shaderDirectory + "bloom_blur.vert"));
            blurShader.setFragmentShader(ResourceLocatorTool.getClassPathResourceAsStream(BloomRenderPass.class,
                    shaderDirectory + "bloom_blur.frag"));
        } catch (final IOException ex) {
            logger.logp(Level.SEVERE, getClass().getName(), "init(Renderer)", "Could not load shaders.", ex);
        }
        blurShader.setUniform("RT", 0);

        // Create blur shader horizontal
        blurShaderHorizontal = new GLSLShaderObjectsState();
        try {
            blurShaderHorizontal.setVertexShader(ResourceLocatorTool.getClassPathResourceAsStream(
                    BloomRenderPass.class, shaderDirectory + "bloom_blur.vert"));
            blurShaderHorizontal.setFragmentShader(ResourceLocatorTool.getClassPathResourceAsStream(
                    BloomRenderPass.class, shaderDirectory + "bloom_blur_horizontal7.frag"));
        } catch (final IOException ex) {
            logger.logp(Level.SEVERE, getClass().getName(), "init(Renderer)", "Could not load shaders.", ex);
        }
        blurShaderHorizontal.setUniform("RT", 0);

        // Create blur shader vertical
        blurShaderVertical = new GLSLShaderObjectsState();
        try {
            blurShaderVertical.setVertexShader(ResourceLocatorTool.getClassPathResourceAsStream(BloomRenderPass.class,
                    shaderDirectory + "bloom_blur.vert"));
            blurShaderVertical.setFragmentShader(ResourceLocatorTool.getClassPathResourceAsStream(
                    BloomRenderPass.class, shaderDirectory + "bloom_blur_vertical7.frag"));
        } catch (final IOException ex) {
            logger.logp(Level.SEVERE, getClass().getName(), "init(Renderer)", "Could not load shaders.", ex);
        }
        blurShaderVertical.setUniform("RT", 0);

        // Create final shader(basic texturing)
        finalShader = new GLSLShaderObjectsState();
        try {
            finalShader.setVertexShader(ResourceLocatorTool.getClassPathResourceAsStream(BloomRenderPass.class,
                    shaderDirectory + "bloom_final.vert"));
            finalShader.setFragmentShader(ResourceLocatorTool.getClassPathResourceAsStream(BloomRenderPass.class,
                    shaderDirectory + "bloom_final.frag"));
View Full Code Here

Examples of com.ardor3d.renderer.state.GLSLShaderObjectsState

        secondary.getTexture().setWrap(WrapMode.Clamp);
        manager.getRenderTargetMap().put(RT_SECONDARY, secondary);
    }

    protected GLSLShaderObjectsState getExtractionShader() {
        final GLSLShaderObjectsState shader = new GLSLShaderObjectsState();
        try {
            shader.setVertexShader(ResourceLocatorTool.getClassPathResourceAsStream(BloomRenderPass.class,
                    shaderDirectory + "fsq.vert"));
            shader.setFragmentShader(ResourceLocatorTool.getClassPathResourceAsStream(BloomRenderPass.class,
                    shaderDirectory + "bloom_extract.frag"));
        } catch (final Exception e) {
            e.printStackTrace();
        }
        shader.setUniform("inputTex", 0);
        return shader;
    }
View Full Code Here

Examples of com.ardor3d.renderer.state.GLSLShaderObjectsState

        shader.setUniform("inputTex", 0);
        return shader;
    }

    protected GLSLShaderObjectsState getBlurHorizShader() {
        final GLSLShaderObjectsState shader = new GLSLShaderObjectsState();
        try {
            shader.setVertexShader(ResourceLocatorTool.getClassPathResourceAsStream(BloomRenderPass.class,
                    shaderDirectory + "fsq.vert"));
            shader.setFragmentShader(ResourceLocatorTool.getClassPathResourceAsStream(BloomRenderPass.class,
                    shaderDirectory + "gausian_blur_horizontal9.frag"));
        } catch (final Exception e) {
            e.printStackTrace();
        }
        shader.setUniform("inputTex", 0);
        return shader;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.