Package fcagnin.jglsdk.glm

Examples of fcagnin.jglsdk.glm.Vec3


            super( offset );
        }

        @Override
        Vec3 calcScale(float elapsedTime) {
            return new Vec3( 0.5f, 1.0f, 10.0f );
        }
View Full Code Here


            lightIntensity.add( new Vec4( 0.2f, 0.2f, 0.2f, 1.0f ) );
        }

        ArrayList<Vec3> posValues = new ArrayList<>();

        posValues.add( new Vec3( -50.0f, 30.0f, 70.0f ) );
        posValues.add( new Vec3( -70.0f, 30.0f, 50.0f ) );
        posValues.add( new Vec3( -70.0f, 30.0f, -50.0f ) );
        posValues.add( new Vec3( -50.0f, 30.0f, -70.0f ) );
        posValues.add( new Vec3( 50.0f, 30.0f, -70.0f ) );
        posValues.add( new Vec3( 70.0f, 30.0f, -50.0f ) );
        posValues.add( new Vec3( 70.0f, 30.0f, 50.0f ) );
        posValues.add( new Vec3( 50.0f, 30.0f, 70.0f ) );
        lightPos.get( 0 ).setValues( posValues );
        lightTimers.add( new Timer( Timer.Type.LOOP, 15.0f ) );

        // Right-side light.
        posValues = new ArrayList<>();
        posValues.add( new Vec3( 100.0f, 6.0f, 75.0f ) );
        posValues.add( new Vec3( 90.0f, 8.0f, 90.0f ) );
        posValues.add( new Vec3( 75.0f, 10.0f, 100.0f ) );
        posValues.add( new Vec3( 60.0f, 12.0f, 90.0f ) );
        posValues.add( new Vec3( 50.0f, 14.0f, 75.0f ) );
        posValues.add( new Vec3( 60.0f, 16.0f, 60.0f ) );
        posValues.add( new Vec3( 75.0f, 18.0f, 50.0f ) );
        posValues.add( new Vec3( 90.0f, 20.0f, 60.0f ) );
        posValues.add( new Vec3( 100.0f, 22.0f, 75.0f ) );
        posValues.add( new Vec3( 90.0f, 24.0f, 90.0f ) );
        posValues.add( new Vec3( 75.0f, 26.0f, 100.0f ) );
        posValues.add( new Vec3( 60.0f, 28.0f, 90.0f ) );
        posValues.add( new Vec3( 50.0f, 30.0f, 75.0f ) );

        posValues.add( new Vec3( 105.0f, 9.0f, -70.0f ) );
        posValues.add( new Vec3( 105.0f, 10.0f, -90.0f ) );
        posValues.add( new Vec3( 72.0f, 20.0f, -90.0f ) );
        posValues.add( new Vec3( 72.0f, 22.0f, -70.0f ) );
        posValues.add( new Vec3( 105.0f, 32.0f, -70.0f ) );
        posValues.add( new Vec3( 105.0f, 34.0f, -90.0f ) );
        posValues.add( new Vec3( 72.0f, 44.0f, -90.0f ) );

        lightPos.get( 1 ).setValues( posValues );
        lightTimers.add( new Timer( Timer.Type.LOOP, 25.0f ) );

        // Left-side light.
        posValues = new ArrayList<>();
        posValues.add( new Vec3( -7.0f, 35.0f, 1.0f ) );
        posValues.add( new Vec3( 8.0f, 40.0f, -14.0f ) );
        posValues.add( new Vec3( -7.0f, 45.0f, -29.0f ) );
        posValues.add( new Vec3( -22.0f, 50.0f, -14.0f ) );
        posValues.add( new Vec3( -7.0f, 55.0f, 1.0f ) );
        posValues.add( new Vec3( 8.0f, 60.0f, -14.0f ) );
        posValues.add( new Vec3( -7.0f, 65.0f, -29.0f ) );

        posValues.add( new Vec3( -83.0f, 30.0f, -92.0f ) );
        posValues.add( new Vec3( -98.0f, 27.0f, -77.0f ) );
        posValues.add( new Vec3( -83.0f, 24.0f, -62.0f ) );
        posValues.add( new Vec3( -68.0f, 21.0f, -77.0f ) );
        posValues.add( new Vec3( -83.0f, 18.0f, -92.0f ) );
        posValues.add( new Vec3( -98.0f, 15.0f, -77.0f ) );

        posValues.add( new Vec3( -50.0f, 8.0f, 25.0f ) );
        posValues.add( new Vec3( -59.5f, 4.0f, 65.0f ) );
        posValues.add( new Vec3( -59.5f, 4.0f, 78.0f ) );
        posValues.add( new Vec3( -45.0f, 4.0f, 82.0f ) );
        posValues.add( new Vec3( -40.0f, 4.0f, 50.0f ) );
        posValues.add( new Vec3( -70.0f, 20.0f, 40.0f ) );
        posValues.add( new Vec3( -60.0f, 20.0f, 90.0f ) );
        posValues.add( new Vec3( -40.0f, 25.0f, 90.0f ) );

        lightPos.get( 2 ).setValues( posValues );
        lightTimers.add( new Timer( Timer.Type.LOOP, 15.0f ) );
    }
View Full Code Here

        Vec4 sunDirection = new Vec4( 0.0f );
        sunDirection.x = (float) Math.sin( angle );
        sunDirection.y = (float) Math.cos( angle );

        // Keep the sun from being perfectly centered overhead.
        sunDirection = Mat4.mul( Glm.rotate( new Mat4( 1.0f ), 5.0f, new Vec3( 0.0f, 1.0f, 0.0f ) ), sunDirection );

        return sunDirection;
    }
View Full Code Here

        }

        @Override
        Vec3 calcScale(float elapsedTime) {
            final float loopDuration = 3.0f;
            return new Vec3( Glm.mix( 1.0f, 4.0f, calcLerpFactor( elapsedTime, loopDuration ) ) );
        }
View Full Code Here

        @Override
        Vec3 calcScale(float elapsedTime) {
            final float xLoopDuration = 3.0f;
            final float zLoopDuration = 5.0f;
            return new Vec3(
                    Glm.mix( 1.0f, 0.5f, calcLerpFactor( elapsedTime, xLoopDuration ) ),
                    1.0f,
                    Glm.mix( 1.0f, 10.0f, calcLerpFactor( elapsedTime, zLoopDuration ) )
            );
        }
View Full Code Here

            // Render the sun
            {
                modelMatrix.push();

                Vec3 sunlightDir = new Vec3( lights.getSunlightDirection() );
                modelMatrix.translate( sunlightDir.scale( 500.0f ) );
                modelMatrix.scale( 30.0f, 30.0f, 30.0f );

                glUseProgram( unlit.theProgram );
                glUniformMatrix4( unlit.modelToCameraMatrixUnif, false,
                        modelMatrix.top().fillAndFlipBuffer( mat4Buffer ) );
View Full Code Here

        float cyclicAngle = camTimer.getAlpha() * 6.28f;
        float hOffset = (float) (Math.cos( cyclicAngle ) * 0.25f);
        float vOffset = (float) (Math.sin( cyclicAngle ) * 0.25f);

        final Mat4 worldToCamMat = Glm.lookAt( new Vec3( hOffset, 1.0f, -64.0f ),
                new Vec3( hOffset, -5.0f + vOffset, -44.0f ), new Vec3( 0.0f, 1.0f, 0.0f ) );

        MatrixStack modelMatrix = new MatrixStack();
        modelMatrix.applyMatrix( worldToCamMat );

        final ProgramData prog = drawGammaProgram ? progGamma : progNoGamma;
View Full Code Here

        // Render the sun
        {
            modelMatrix.push();

            Vec3 sunlightDir = new Vec3( lightEnv.getSunlightDirection() );
            modelMatrix.translate( sunlightDir.scale( 500.0f ) );
            modelMatrix.scale( 30.0f, 30.0f, 30.0f );

            glUseProgram( progUnlit.theProgram );
            glUniformMatrix4( progUnlit.modelToCameraMatrixUnif, false,
                    modelMatrix.top().fillAndFlipBuffer( mat4Buffer ) );
View Full Code Here

        Vec4 sunDirection = new Vec4( 0.0f );
        sunDirection.x = (float) Math.sin( angle );
        sunDirection.y = (float) Math.cos( angle );

        // Keep the sun from being perfectly centered overhead.
        sunDirection = Mat4.mul( Glm.rotate( new Mat4( 1.0f ), 5.0f, new Vec3( 0.0f, 1.0f, 0.0f ) ), sunDirection );

        return sunDirection;
    }
View Full Code Here

        return res;
    }

    private Vec3 parseVec3(String s) {
        Scanner snr = new Scanner( s );
        Vec3 res = new Vec3();

        res.x = Float.parseFloat( snr.next() );
        res.y = Float.parseFloat( snr.next() );
        res.z = Float.parseFloat( snr.next() );
View Full Code Here

TOP

Related Classes of fcagnin.jglsdk.glm.Vec3

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.