コード例 #1
0
        public int InitProjectedLight()
        {
            lightProj = new LightProj(new vec4(1.0f, 1.0f, 0.5f, 1.0f), 10, 60, "");
            lightProj.setWorldPosition(new dvec3(2.5f, 2.5f, 3.0f));
            lightProj.setName("projector");
            lightProj.setRotation(new quat(-45.0f, 45.0f, 0f));
            lightProj.setPenumbra(0.425f);
            lightProj.setIntensity(1.0f);
            lightProj.release();
            editor.addNode(lightProj.getNode());
            Log.message("\n" + "Created a projected light source \n");

            lightOmni = new LightOmni(new vec4(1f), 20f, null);
            lightOmni.setWorldPosition(new dvec3(0, 0, 5));
            lightOmni.setIntensity(0.1f);
            lightOmni.release();
            editor.addNode(lightOmni.getNode());
            Log.message("\n" + "Created a omni light source \n");

            lightWorld = new LightWorld(new vec4(1));
            lightWorld.setName("Sun");
            lightWorld.setDisableAngle(90f);
            lightWorld.setIntensity(1);
            lightWorld.setScattering(LightWorld.SCATTERING_SUN);
            lightWorld.setWorldRotation(new quat(0, 1, 0, 0));
            lightWorld.release();
            editor.addNode(lightWorld.getNode());
            Log.message("\nCreated a world light source\n");

            return(1);
        }
コード例 #2
0
        public int UpdateLights()
        {
            sunAngle += sunRotationRate * ifps;
            if (sunAngle > 360)
            {
                sunAngle = 0;
            }
            LightWorld.cast(editor.getNodeByName("Sun")).setWorldRotation(new quat(new vec3(0, 1, 0), 180 - sunAngle));

            return(1);
        }