Package org.terasology.rendering.cameras

Examples of org.terasology.rendering.cameras.Camera


        WorldRenderer worldRenderer = CoreRegistry.get(WorldRenderer.class);
        if (worldRenderer != null) {
            Vector3f sunDirection = worldRenderer.getSkysphere().getSunDirection(true);

            Camera activeCamera = CoreRegistry.get(WorldRenderer.class).getActiveCamera();

            Vector4f sunPositionWorldSpace4 = new Vector4f(sunDirection.x * 10000.0f, sunDirection.y * 10000.0f, sunDirection.z * 10000.0f, 1.0f);
            Vector4f sunPositionScreenSpace = new Vector4f();
            activeCamera.getViewProjectionMatrix().transform(sunPositionWorldSpace4, sunPositionScreenSpace);

            sunPositionScreenSpace.x /= sunPositionScreenSpace.w;
            sunPositionScreenSpace.y /= sunPositionScreenSpace.w;
            sunPositionScreenSpace.z /= sunPositionScreenSpace.w;
            sunPositionScreenSpace.w = 1.0f;

            program.setFloat("lightDirDotViewDir", activeCamera.getViewingDirection().dot(sunDirection), true);
            program.setFloat2("lightScreenPos", (sunPositionScreenSpace.x + 1.0f) / 2.0f, (sunPositionScreenSpace.y + 1.0f) / 2.0f, true);
        }
    }
View Full Code Here


    // TODO: Fix this up for multiplayer (cannot at the moment due to the use of camera)
    @Command(shortDescription = "Places a block in front of the player", helpText = "Places the specified block in front of the player. " +
            "The block is set directly into the world and might override existing blocks. After placement the block can be destroyed like any regular placed block.")
    public String placeBlock(@CommandParam("blockName") String blockName) {
        Camera camera = renderer.getActiveCamera();
        Vector3f spawnPos = camera.getPosition();
        Vector3f offset = camera.getViewingDirection();
        offset.scale(3);
        spawnPos.add(offset);

        BlockFamily blockFamily;
View Full Code Here

        skysphere = new Skysphere();
        chunkMeshUpdateManager = new ChunkMeshUpdateManager(chunkTessellator, worldProvider);

        // TODO: won't need localPlayerSystem here once camera is in the ES proper
        systemManager = CoreRegistry.get(ComponentSystemManager.class);
        Camera localPlayerCamera;
        if (CoreRegistry.get(Config.class).getRendering().isOculusVrSupport()) {
            localPlayerCamera = new OculusStereoCamera();
        } else {
            localPlayerCamera = new PerspectiveCamera(CoreRegistry.get(Config.class).getRendering().getCameraSettings());
        }
View Full Code Here

TOP

Related Classes of org.terasology.rendering.cameras.Camera

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.