Examples of Vec4


Examples of fcagnin.jglsdk.glm.Vec4

        ArrayList<LightData> ambient = new ArrayList<>();
        ArrayList<LightData> light = new ArrayList<>();
        ArrayList<LightData> background = new ArrayList<>();

        for ( int valIndex = 0; valIndex < size; valIndex++ ) {
            ambient.add( new LightData( new Vec4( values[valIndex].ambient ), values[valIndex].normTime ) );
            light.add( new LightData( new Vec4( values[valIndex].sunlightIntensity ), values[valIndex].normTime ) );
            background.add( new LightData( new Vec4( values[valIndex].backgroundColor ), values[valIndex].normTime ) );
        }

        ambientInterpolator.setValues( ambient );
        sunlightInterpolator.setValues( light );
        backgroundInterpolator.setValues( background );
View Full Code Here

Examples of fcagnin.jglsdk.glm.Vec4

        ArrayList<LightData> light = new ArrayList<>();
        ArrayList<LightData> background = new ArrayList<>();
        ArrayList<MaxIntensityData> maxIntensity = new ArrayList<>();

        for ( int valIndex = 0; valIndex < size; valIndex++ ) {
            ambient.add( new LightData( new Vec4( values[valIndex].ambient ), values[valIndex].normTime ) );
            light.add( new LightData( new Vec4( values[valIndex].sunlightIntensity ), values[valIndex].normTime ) );
            background.add( new LightData( new Vec4( values[valIndex].backgroundColor ), values[valIndex].normTime ) );
            maxIntensity.add( new MaxIntensityData( values[valIndex].maxIntensity, values[valIndex].normTime ) );
        }

        ambientInterpolator.setValues( ambient );
        sunlightInterpolator.setValues( light );
View Full Code Here

Examples of fcagnin.jglsdk.glm.Vec4

        void setValues(ArrayList<LightData> data, boolean isLooping) {
            values.clear();

            for ( LightData curr : data ) {
                Data temp = new Data();
                temp.data = new Vec4( LightManager.getValue( curr ) );
                temp.weight = LightManager.getTime( curr );

                values.add( temp );
            }

            if ( isLooping && !values.isEmpty() ) {
                Data temp = new Data();
                temp.data = new Vec4( values.get( 0 ).data );
                temp.weight = values.get( 0 ).weight;

                values.add( temp );
            }
View Full Code Here

Examples of fcagnin.jglsdk.glm.Vec4

    @Override
    protected void display() {
        lights.updateTime( getElapsedTime() );

        Vec4 bkg = lights.getBackgroundColor();

        glClearColor( bkg.x, bkg.y, bkg.z, bkg.w );
        glClearDepth( 1.0f );
        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 );

        {
            modelMatrix.push();

            scene.draw( modelMatrix, materialBlockIndex, lights.getTimerValue( "tetra" ) );

            modelMatrix.pop();
        }

        {
            modelMatrix.push();

            // 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 ) );

                Vec4 lightColor = lights.getSunlightIntensity();
                glUniform4( unlit.objectColorUnif, lightColor.fillAndFlipBuffer( vec4Buffer ) );
                scene.getSphereMesh().render( "flat" );

                modelMatrix.pop();
            }

            // Render the lights
            {
                for ( int light = 0; light < lights.getNumberOfPointLights(); light++ ) {
                    modelMatrix.push();

                    modelMatrix.translate( lights.getWorldLightPosition( light ) );

                    glUseProgram( unlit.theProgram );
                    glUniformMatrix4( unlit.modelToCameraMatrixUnif, false,
                            modelMatrix.top().fillAndFlipBuffer( mat4Buffer ) );

                    Vec4 lightColor = lights.getPointLightIntensity( light );
                    glUniform4( unlit.objectColorUnif, lightColor.fillAndFlipBuffer( vec4Buffer ) );
                    scene.getCubeMesh().render( "flat" );

                    modelMatrix.pop();
                }
            }
View Full Code Here

Examples of fcagnin.jglsdk.glm.Vec4

    private void setupDaytimeLighting() {
        SunlightValue values[] = {
                new SunlightValue(
                        0.0f / 24.0f,
                        new Vec4( 0.2f, 0.2f, 0.2f, 1.0f ),
                        new Vec4( 0.6f, 0.6f, 0.6f, 1.0f ),
                        new Vec4( skyDaylightColor ) ),
                new SunlightValue(
                        4.5f / 24.0f,
                        new Vec4( 0.2f, 0.2f, 0.2f, 1.0f ),
                        new Vec4( 0.6f, 0.6f, 0.6f, 1.0f ),
                        new Vec4( skyDaylightColor ) ),
                new SunlightValue(
                        6.5f / 24.0f,
                        new Vec4( 0.15f, 0.05f, 0.05f, 1.0f ),
                        new Vec4( 0.3f, 0.1f, 0.10f, 1.0f ),
                        new Vec4( 0.5f, 0.1f, 0.1f, 1.0f ) ),
                new SunlightValue(
                        8.0f / 24.0f,
                        new Vec4( 0.0f, 0.0f, 0.0f, 1.0f ),
                        new Vec4( 0.0f, 0.0f, 0.0f, 1.0f ),
                        new Vec4( 0.0f, 0.0f, 0.0f, 1.0f ) ),
                new SunlightValue(
                        18.0f / 24.0f,
                        new Vec4( 0.0f, 0.0f, 0.0f, 1.0f ),
                        new Vec4( 0.0f, 0.0f, 0.0f, 1.0f ),
                        new Vec4( 0.0f, 0.0f, 0.0f, 1.0f ) ),
                new SunlightValue(
                        19.5f / 24.0f,
                        new Vec4( 0.15f, 0.05f, 0.05f, 1.0f ),
                        new Vec4( 0.3f, 0.1f, 0.1f, 1.0f ),
                        new Vec4( 0.5f, 0.1f, 0.1f, 1.0f ) ),
                new SunlightValue(
                        20.5f / 24.0f,
                        new Vec4( 0.2f, 0.2f, 0.2f, 1.0f ),
                        new Vec4( 0.6f, 0.6f, 0.6f, 1.0f ),
                        new Vec4( skyDaylightColor ) )
        };

        lights.setSunlightValues( values, 7 );

        lights.setPointLightIntensity( 0, new Vec4( 0.2f, 0.2f, 0.2f, 1.0f ) );
        lights.setPointLightIntensity( 1, new Vec4( 0.0f, 0.0f, 0.3f, 1.0f ) );
        lights.setPointLightIntensity( 2, new Vec4( 0.3f, 0.0f, 0.0f, 1.0f ) );
    }
View Full Code Here

Examples of fcagnin.jglsdk.glm.Vec4

    private void setupNighttimeLighting() {
        SunlightValue values[] = {
                new SunlightValue(
                        0.0f / 24.0f,
                        new Vec4( 0.2f, 0.2f, 0.2f, 1.0f ),
                        new Vec4( 0.6f, 0.6f, 0.6f, 1.0f ),
                        new Vec4( skyDaylightColor ) ),
                new SunlightValue(
                        4.5f / 24.0f,
                        new Vec4( 0.2f, 0.2f, 0.2f, 1.0f ),
                        new Vec4( 0.6f, 0.6f, 0.6f, 1.0f ),
                        new Vec4( skyDaylightColor ) ),
                new SunlightValue(
                        6.5f / 24.0f,
                        new Vec4( 0.15f, 0.05f, 0.05f, 1.0f ),
                        new Vec4( 0.3f, 0.1f, 0.10f, 1.0f ),
                        new Vec4( 0.5f, 0.1f, 0.1f, 1.0f ) ),
                new SunlightValue(
                        8.0f / 24.0f,
                        new Vec4( 0.0f, 0.0f, 0.0f, 1.0f ),
                        new Vec4( 0.0f, 0.0f, 0.0f, 1.0f ),
                        new Vec4( 0.0f, 0.0f, 0.0f, 1.0f ) ),
                new SunlightValue(
                        18.0f / 24.0f,
                        new Vec4( 0.0f, 0.0f, 0.0f, 1.0f ),
                        new Vec4( 0.0f, 0.0f, 0.0f, 1.0f ),
                        new Vec4( 0.0f, 0.0f, 0.0f, 1.0f ) ),
                new SunlightValue(
                        19.5f / 24.0f,
                        new Vec4( 0.15f, 0.05f, 0.05f, 1.0f ),
                        new Vec4( 0.3f, 0.1f, 0.1f, 1.0f ),
                        new Vec4( 0.5f, 0.1f, 0.1f, 1.0f ) ),
                new SunlightValue(
                        20.5f / 24.0f,
                        new Vec4( 0.2f, 0.2f, 0.2f, 1.0f ),
                        new Vec4( 0.6f, 0.6f, 0.6f, 1.0f ),
                        new Vec4( skyDaylightColor ) )
        };

        lights.setSunlightValues( values, 7 );

        lights.setPointLightIntensity( 0, new Vec4( 0.6f, 0.6f, 0.6f, 1.0f ) );
        lights.setPointLightIntensity( 1, new Vec4( 0.0f, 0.0f, 0.7f, 1.0f ) );
        lights.setPointLightIntensity( 2, new Vec4( 0.7f, 0.0f, 0.0f, 1.0f ) );
    }
View Full Code Here

Examples of fcagnin.jglsdk.glm.Vec4

    private void setupHDRLighting() {
        SunlightValueHDR values[] = {
                new SunlightValueHDR(
                        0.0f / 24.0f,
                        new Vec4( 0.6f, 0.6f, 0.6f, 1.0f ),
                        new Vec4( 1.8f, 1.8f, 1.8f, 1.0f ),
                        new Vec4( skyDaylightColor ),
                        3.0f ),
                new SunlightValueHDR(
                        4.5f / 24.0f,
                        new Vec4( 0.6f, 0.6f, 0.6f, 1.0f ),
                        new Vec4( 1.8f, 1.8f, 1.8f, 1.0f ),
                        new Vec4( skyDaylightColor ),
                        3.0f ),
                new SunlightValueHDR(
                        6.5f / 24.0f,
                        new Vec4( 0.225f, 0.075f, 0.075f, 1.0f ),
                        new Vec4( 0.45f, 0.15f, 0.15f, 1.0f ),
                        new Vec4( 0.5f, 0.1f, 0.1f, 1.0f ),
                        1.5f ),
                new SunlightValueHDR(
                        8.0f / 24.0f,
                        new Vec4( 0.0f, 0.0f, 0.0f, 1.0f ),
                        new Vec4( 0.0f, 0.0f, 0.0f, 1.0f ),
                        new Vec4( 0.0f, 0.0f, 0.0f, 1.0f ),
                        1.0f ),
                new SunlightValueHDR(
                        18.0f / 24.0f,
                        new Vec4( 0.0f, 0.0f, 0.0f, 1.0f ),
                        new Vec4( 0.0f, 0.0f, 0.0f, 1.0f ),
                        new Vec4( 0.0f, 0.0f, 0.0f, 1.0f ),
                        1.0f ),
                new SunlightValueHDR(
                        19.5f / 24.0f,
                        new Vec4( 0.225f, 0.075f, 0.075f, 1.0f ),
                        new Vec4( 0.45f, 0.15f, 0.15f, 1.0f ),
                        new Vec4( 0.5f, 0.1f, 0.1f, 1.0f ),
                        1.5f ),
                new SunlightValueHDR(
                        20.5f / 24.0f,
                        new Vec4( 0.6f, 0.6f, 0.6f, 1.0f ),
                        new Vec4( 1.8f, 1.8f, 1.8f, 1.0f ),
                        new Vec4( skyDaylightColor ),
                        3.0f )
        };

        lights.setSunlightValues( values, 7 );

        lights.setPointLightIntensity( 0, new Vec4( 0.6f, 0.6f, 0.6f, 1.0f ) );
        lights.setPointLightIntensity( 1, new Vec4( 0.0f, 0.0f, 0.7f, 1.0f ) );
        lights.setPointLightIntensity( 2, new Vec4( 0.7f, 0.0f, 0.0f, 1.0f ) );
    }
View Full Code Here

Examples of fcagnin.jglsdk.glm.Vec4

            glDisable( GL_FRAMEBUFFER_SRGB );
        }

        lightEnv.updateTime( getElapsedTime() );

        Vec4 bgColor = lightEnv.getBackgroundColor();
        glClearColor( bgColor.x, bgColor.y, bgColor.z, bgColor.w );
        glClearDepth( 1.0f );
        glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );

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

        LightBlock lightData = lightEnv.getLightBlock( viewPole.calcMatrix() );

        glBindBuffer( GL_UNIFORM_BUFFER, lightUniformBuffer );
        glBufferData( GL_UNIFORM_BUFFER, lightData.fillAndFlipBuffer( lightBlockBuffer ), GL_STREAM_DRAW );
        glBindBuffer( GL_UNIFORM_BUFFER, 0 );

        modelMatrix.push();
        modelMatrix.rotateX( -90.0f );

        glUseProgram( progStandard.theProgram );
        glUniformMatrix4( progStandard.modelToCameraMatrixUnif, false,
                modelMatrix.top().fillAndFlipBuffer( mat4Buffer ) );
        glUniform1i( progStandard.numberOfLightsUnif, lightEnv.getNumLights() );

        glActiveTexture( GL_TEXTURE0 + colorTexUnit );
        glBindTexture( GL_TEXTURE_2D, linearTexture );
        glBindSampler( colorTexUnit, samplers[currSampler] );

        terrain.render( "lit-tex" );

        glBindSampler( colorTexUnit, 0 );
        glBindTexture( GL_TEXTURE_2D, 0 );

        glUseProgram( 0 );

        modelMatrix.pop();

        // 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 ) );

            Vec4 lightColor = lightEnv.getSunlightScaledIntensity();
            glUniform4( progUnlit.objectColorUnif, lightColor.fillAndFlipBuffer( vec4Buffer ) );
            sphere.render( "flat" );

            modelMatrix.pop();
        }

        // Draw lights
        for ( int light = 0; light < lightEnv.getNumPointLights(); light++ ) {
            modelMatrix.push();

            modelMatrix.translate( lightEnv.getPointLightWorldPos( light ) );

            glUseProgram( progUnlit.theProgram );
            glUniformMatrix4( progUnlit.modelToCameraMatrixUnif, false,
                    modelMatrix.top().fillAndFlipBuffer( mat4Buffer ) );

            Vec4 lightColor = lightEnv.getPointLightScaledIntensity( light );
            glUniform4( progUnlit.objectColorUnif, lightColor.fillAndFlipBuffer( vec4Buffer ) );
            sphere.render( "flat" );

            modelMatrix.pop();
        }
View Full Code Here

Examples of fcagnin.jglsdk.glm.Vec4

        lightData.lights[0] = new PerLight();
        lightData.lights[0].cameraSpaceLightPos = Mat4.mul( worldToCameraMat, getSunlightDirection() );
        lightData.lights[0].lightIntensity = sunlightInterpolator.interpolate( sunTimer.getAlpha() );

        for ( int lightIndex = 0; lightIndex < lightPos.size(); lightIndex++ ) {
            Vec4 worldLightPos = new Vec4(
                    lightPos.get( lightIndex ).interpolate( lightTimers.get( lightIndex ).getAlpha() ),
                    1.0f );
            Vec4 lightPosCameraSpace = Mat4.mul( worldToCameraMat, worldLightPos );

            lightData.lights[lightIndex + 1] = new PerLight();
            lightData.lights[lightIndex + 1].cameraSpaceLightPos = lightPosCameraSpace;
            lightData.lights[lightIndex + 1].lightIntensity = new Vec4( lightIntensity.get( lightIndex ) );
        }

        return lightData;
    }
View Full Code Here

Examples of gov.nasa.worldwind.geom.Vec4

    {
        Terrain terrain = dc.getTerrain();
        ExtrudedPolygon pol = (ExtrudedPolygon) super._pol_;

        Position refPos = pol.getReferencePosition();
        Vec4 refPoint = terrain.getSurfacePoint(refPos.getLatitude(), refPos.getLongitude(), 0);

        int altitudeMode = pol.getAltitudeMode();
        double height = pol.getHeight();

        Vec4 vaa = null;
        double vaaLength = 0; // used to compute independent length of each cap vertex
        double vaLength = 0;

        int i = 0;
        for (LatLon location : pol.getOuterBoundary())
        {
            Vec4 vert;

            // Compute the top/cap point.
            if (altitudeMode == WorldWind.CONSTANT || !(location instanceof Position))
            {
                if (vaa == null)
                {
                    // Compute the vector lengths of the top and bottom points at the reference position.
                    vaa = refPoint.multiply3(height / refPoint.getLength3());
                    vaaLength = vaa.getLength3();
                    vaLength = refPoint.getLength3();
                }

                // Compute the bottom point, which is on the terrain.
                vert = terrain.getSurfacePoint(location.getLatitude(), location.getLongitude(), 0);

                double delta = vaLength - vert.dot3(refPoint) / vaLength;
                vert = vert.add3(vaa.multiply3(1d + delta / vaaLength));
            }
            else if (altitudeMode == WorldWind.RELATIVE_TO_GROUND)
            {
                vert = terrain.getSurfacePoint(location.getLatitude(), location.getLongitude(),
                    ((Position) location).getAltitude());
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.