Package fcagnin.jglsdk.glm

Examples of fcagnin.jglsdk.glm.Mat4


        void rotateY(float angDeg) {
            currMat.mul( new Mat4( Hierarchy.this.rotateY( angDeg ) ) );
        }

        void rotateZ(float angDeg) {
            currMat.mul( new Mat4( Hierarchy.this.rotateZ( angDeg ) ) );
        }
View Full Code Here


        void rotateZ(float angDeg) {
            currMat.mul( new Mat4( Hierarchy.this.rotateZ( angDeg ) ) );
        }

        void scale(Vec3 scaleVec) {
            Mat4 scaleMat = new Mat4( 1.0f );
            scaleMat.set( 0, 0, scaleVec.x );
            scaleMat.set( 1, 1, scaleVec.y );
            scaleMat.set( 2, 2, scaleVec.z );

            currMat.mul( scaleMat );
        }
View Full Code Here

            currMat.mul( scaleMat );
        }

        void translate(Vec3 offsetVec) {
            Mat4 translateMat = new Mat4( 1.0f );
            translateMat.setColumn( 3, new Vec4( offsetVec, 1.0f ) );

            currMat.mul( translateMat );
        }
View Full Code Here

        glBindVertexArray( vao );

        float elapsedTime = getElapsedTime() / 1000.0f;
        for ( Instance currInst : instanceList ) {
            final Mat4 transformMatrix = currInst.constructMatrix( elapsedTime );

            glUniformMatrix4( modelToCameraMatrixUnif, false, transformMatrix.fillAndFlipBuffer( mat4Buffer ) );
            glDrawElements( GL_TRIANGLES, indexData.length, GL_UNSIGNED_SHORT, 0 );
        }

        glBindVertexArray( 0 );
        glUseProgram( 0 );
View Full Code Here

        abstract Vec3 calcScale(float elapsedTime);

        Mat4 constructMatrix(float elapsedTime) {
            Vec3 theScale = calcScale( elapsedTime );

            Mat4 theMat = new Mat4( 1.0f );
            theMat.set( 0, 0, theScale.x );
            theMat.set( 1, 1, theScale.y );
            theMat.set( 2, 2, theScale.z );
            theMat.setColumn( 3, new Vec4( offset, 1.0f ) );
            return theMat;
        }
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

        glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );

        MatrixStack modelMatrix = new MatrixStack();
        modelMatrix.setMatrix( viewPole.calcMatrix() );

        final Mat4 worldToCamMat = modelMatrix.top();
        LightBlockHDR lightData = lights.getLightInformationHDR( worldToCamMat );

        glBindBuffer( GL_UNIFORM_BUFFER, lightUniformBuffer );
        glBufferSubData( GL_UNIFORM_BUFFER, 0, lightData.fillAndFlipBuffer( lightBlockBuffer ) );
        glBindBuffer( GL_UNIFORM_BUFFER, 0 );
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 );

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


    public static class UniformMat4Binder extends UniformBinderBase {

        public void setValue(Mat4 val) {
            this.val = new Mat4( val );
        }
View Full Code Here

TOP

Related Classes of fcagnin.jglsdk.glm.Mat4

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.