コード例 #1
0
ファイル: App.cs プロジェクト: burkhardm/Horde3D-.NET-wrapper
        public bool init()
        {
            // Initialize engine
            if (!Horde3D.init())
            {
                Horde3DUtils.dumpMessages();
                return(false);
            }

            // Set paths for resources
            Horde3D.setResourcePath(Horde3D.ResourceTypes.SceneGraph, "models");
            Horde3D.setResourcePath(Horde3D.ResourceTypes.Geometry, "models");
            Horde3D.setResourcePath(Horde3D.ResourceTypes.Animation, "models");
            Horde3D.setResourcePath(Horde3D.ResourceTypes.Material, "materials");
            Horde3D.setResourcePath(Horde3D.ResourceTypes.Code, "shaders");
            Horde3D.setResourcePath(Horde3D.ResourceTypes.Shader, "shaders");
            Horde3D.setResourcePath(Horde3D.ResourceTypes.Texture2D, "textures");
            Horde3D.setResourcePath(Horde3D.ResourceTypes.TextureCube, "textures");
            Horde3D.setResourcePath(Horde3D.ResourceTypes.Effect, "effects");

            // Load pipeline configuration
            if (!Horde3D.loadPipelineConfig("pipeline_Chicago.xml"))
            {
                Horde3DUtils.dumpMessages();
                return(false);
            }

            // Set options
            Horde3D.setOption(Horde3D.EngineOptions.LoadTextures, 1);
            Horde3D.setOption(Horde3D.EngineOptions.TexCompression, 0);
            Horde3D.setOption(Horde3D.EngineOptions.AnisotropyFactor, 8);
            Horde3D.setOption(Horde3D.EngineOptions.ShadowMapSize, 2048);
            Horde3D.setOption(Horde3D.EngineOptions.FastAnimation, 0);

            // Add resources
            // Font
            _fontMatRes = Horde3D.addResource(Horde3D.ResourceTypes.Material, "font.material.xml", 0);
            // Logo
            _logoMatRes = Horde3D.addResource(Horde3D.ResourceTypes.Material, "logo.material.xml", 0);
            // Shader for deferred shading
            int lightMatRes = Horde3D.addResource(Horde3D.ResourceTypes.Material, "light.material.xml", 0);
            // Environment
            int envRes = Horde3D.addResource(Horde3D.ResourceTypes.SceneGraph, "scene.scene.xml", 0);

            // Skybox
            //int skyBoxRes = Horde3D.addResource(Horde3D.ResourceTypes.SceneGraph, "skybox.scene.xml", 0);


            // Load resources
            Horde3DUtils.loadResourcesFromDisk("content");


            // Add scene nodes
            // Add environment
            Horde3D.addNodes(Horde3D.RootNode, envRes);
            // Add skybox
            //int sky = Horde3D.addNodes( Horde3D.RootNode, skyBoxRes );
            //Horde3D.setNodeTransform(sky, 0, 0, 0, 0, 0, 0, 210, 50, 210);
            // Add light source
            int light = Horde3D.addLightNode(Horde3D.RootNode, "Light1", lightMatRes, "LIGHTING", "SHADOWMAP");

            Horde3D.setNodeTransform(light, 0, 25, -25, -120, 0, 0, 1, 1, 1);
            Horde3D.setLightParam(light, Horde3D.LightNodeParams.Radius, 100);
            Horde3D.setLightParam(light, Horde3D.LightNodeParams.FOV, 90);
            Horde3D.setLightParam(light, Horde3D.LightNodeParams.ShadowMapCount, 3);
            Horde3D.setLightParam(light, Horde3D.LightNodeParams.ShadowSplitLambda, 0.95f);
            Horde3D.setLightParam(light, Horde3D.LightNodeParams.Col_R, 0.98f);
            Horde3D.setLightParam(light, Horde3D.LightNodeParams.Col_G, 0.6f);
            Horde3D.setLightParam(light, Horde3D.LightNodeParams.Col_B, 0.5f);

            // Add light source
            light = Horde3D.addLightNode(Horde3D.RootNode, "Light2", lightMatRes, "LIGHTING", "SHADOWMAP");
            Horde3D.setNodeTransform(light, 0, 25, 30, -60, 0, 0, 1, 1, 1);
            Horde3D.setLightParam(light, Horde3D.LightNodeParams.Radius, 50);
            Horde3D.setLightParam(light, Horde3D.LightNodeParams.FOV, 90);
            Horde3D.setLightParam(light, Horde3D.LightNodeParams.ShadowMapCount, 3);
            Horde3D.setLightParam(light, Horde3D.LightNodeParams.ShadowSplitLambda, 0.95f);
            Horde3D.setLightParam(light, Horde3D.LightNodeParams.Col_R, 0.5f);
            Horde3D.setLightParam(light, Horde3D.LightNodeParams.Col_G, 0.6f);
            Horde3D.setLightParam(light, Horde3D.LightNodeParams.Col_B, 0.98f);

            _crowdSim = new CrowdSim();
            _crowdSim.init();

            _initialized = true;

            return(true);
        }
コード例 #2
0
ファイル: App.cs プロジェクト: geromueller/horde3d
        public bool init()
        {
            // Initialize engine
            if (!h3d.init())
            {
                Horde3DUtils.dumpMessages();
                return false;
            }

            // Set options
            h3d.setOption( h3d.H3DOptions.LoadTextures, 1 );
            h3d.setOption( h3d.H3DOptions.TexCompression, 0 );
            h3d.setOption( h3d.H3DOptions.MaxAnisotropy, 4 );
            h3d.setOption( h3d.H3DOptions.ShadowMapSize, 2048 );
            h3d.setOption( h3d.H3DOptions.FastAnimation, 1 );

            // Add resources
             	        // Pipelines
            _forwardPipeRes = h3d.addResource((int)h3d.H3DResTypes.Pipeline, "pipelines/forward.pipeline.xml", 0);
            _deferredPipeRes = h3d.addResource((int)h3d.H3DResTypes.Pipeline, "pipelines/deferred.pipeline.xml", 0);
            // Overlays
            _fontMatRes = h3d.addResource((int)h3d.H3DResTypes.Material, "overlays/font.material.xml", 0);
            _panelMatRes = h3d.addResource( (int) h3d.H3DResTypes.Material, "overlays/panel.material.xml", 0 );
            _logoMatRes = h3d.addResource((int)h3d.H3DResTypes.Material, "overlays/logo.material.xml", 0);
            // Shader for deferred shading
            int lightMatRes = h3d.addResource((int) h3d.H3DResTypes.Material, "materials/light.material.xml", 0);
            // Environment
            int envRes = h3d.addResource((int) h3d.H3DResTypes.SceneGraph, "models/platform/platform.scene.xml", 0);
            // Skybox
            int skyBoxRes = h3d.addResource((int) h3d.H3DResTypes.SceneGraph, "models/skybox/skybox.scene.xml", 0);

            // Load resources
            Horde3DUtils.loadResourcesFromDisk( "../Content" );

            // Add scene nodes
            // Add camera
            _cam = h3d.addCameraNode( h3d.H3DRootNode, "Camera", _forwardPipeRes );
            // Add environment
            int env = h3d.addNodes( h3d.H3DRootNode, envRes);
            h3d.setNodeTransform( env, 0, 0, 0, 0, 0, 0, 0.23f, 0.23f, 0.23f );
            // Add skybox
            int sky = h3d.addNodes(h3d.H3DRootNode, skyBoxRes);
            h3d.setNodeTransform( sky, 0, 0, 0, 0, 0, 0, 210, 50, 210 );
            // Add light source

            int light = h3d.addLightNode(h3d.H3DRootNode, "Light1", lightMatRes, "LIGHTING", "SHADOWMAP");
            h3d.setNodeTransform( light, 0, 20, 50, -30, 0, 0, 1, 1, 1 );
            h3d.setNodeParamF(light, (int) h3d.H3DLight.RadiusF, 0, 200);
            h3d.setNodeParamF(light, (int) h3d.H3DLight.FovF, 0, 90);
            h3d.setNodeParamI(light, (int) h3d.H3DLight.ShadowMapCountI, 3);
            h3d.setNodeParamF(light, (int) h3d.H3DLight.ShadowSplitLambdaF, 0, 0.9f);
            h3d.setNodeParamF(light, (int) h3d.H3DLight.ShadowMapBiasF, 0,  0.001f);
            h3d.setNodeParamF(light, (int) h3d.H3DLight.ColorF3, 0, 0.9f);
            h3d.setNodeParamF(light, (int) h3d.H3DLight.ColorF3, 1, 0.7f);
            h3d.setNodeParamF(light, (int) h3d.H3DLight.ColorF3, 2, 0.75f);

            _crowdSim = new CrowdSim();
            _crowdSim.init();

            _initialized = true;

            return true;
        }
コード例 #3
0
ファイル: App.cs プロジェクト: zackszhu/Horde3D
        public bool init()
        {
            // Initialize engine
            if (!h3d.init(h3d.H3DRenderDevice.OpenGL4))
            {
                Horde3DUtils.dumpMessages();
                return(false);
            }

            // Set options
            h3d.setOption(h3d.H3DOptions.LoadTextures, 1);
            h3d.setOption(h3d.H3DOptions.TexCompression, 0);
            h3d.setOption(h3d.H3DOptions.MaxAnisotropy, 4);
            h3d.setOption(h3d.H3DOptions.ShadowMapSize, 2048);
            h3d.setOption(h3d.H3DOptions.FastAnimation, 1);

            // Add resources
            // Pipelines
            _forwardPipeRes  = h3d.addResource((int)h3d.H3DResTypes.Pipeline, "pipelines/forward.pipeline.xml", 0);
            _deferredPipeRes = h3d.addResource((int)h3d.H3DResTypes.Pipeline, "pipelines/deferred.pipeline.xml", 0);
            // Overlays
            _fontMatRes  = h3d.addResource((int)h3d.H3DResTypes.Material, "overlays/font.material.xml", 0);
            _panelMatRes = h3d.addResource((int)h3d.H3DResTypes.Material, "overlays/panel.material.xml", 0);
            _logoMatRes  = h3d.addResource((int)h3d.H3DResTypes.Material, "overlays/logo.material.xml", 0);
            // Shader for deferred shading
            int lightMatRes = h3d.addResource((int)h3d.H3DResTypes.Material, "materials/light.material.xml", 0);
            // Environment
            int envRes = h3d.addResource((int)h3d.H3DResTypes.SceneGraph, "models/platform/platform.scene.xml", 0);
            // Skybox
            int skyBoxRes = h3d.addResource((int)h3d.H3DResTypes.SceneGraph, "models/skybox/skybox.scene.xml", 0);


            // Load resources
            Horde3DUtils.loadResourcesFromDisk("../Content");


            // Add scene nodes
            // Add camera
            _cam = h3d.addCameraNode(h3d.H3DRootNode, "Camera", _forwardPipeRes);
            // Add environment
            int env = h3d.addNodes(h3d.H3DRootNode, envRes);

            h3d.setNodeTransform(env, 0, 0, 0, 0, 0, 0, 0.23f, 0.23f, 0.23f);
            // Add skybox
            int sky = h3d.addNodes(h3d.H3DRootNode, skyBoxRes);

            h3d.setNodeTransform(sky, 0, 0, 0, 0, 0, 0, 210, 50, 210);
            // Add light source

            int light = h3d.addLightNode(h3d.H3DRootNode, "Light1", lightMatRes, "LIGHTING", "SHADOWMAP");

            h3d.setNodeTransform(light, 0, 20, 50, -30, 0, 0, 1, 1, 1);
            h3d.setNodeParamF(light, (int)h3d.H3DLight.RadiusF, 0, 200);
            h3d.setNodeParamF(light, (int)h3d.H3DLight.FovF, 0, 90);
            h3d.setNodeParamI(light, (int)h3d.H3DLight.ShadowMapCountI, 3);
            h3d.setNodeParamF(light, (int)h3d.H3DLight.ShadowSplitLambdaF, 0, 0.9f);
            h3d.setNodeParamF(light, (int)h3d.H3DLight.ShadowMapBiasF, 0, 0.001f);
            h3d.setNodeParamF(light, (int)h3d.H3DLight.ColorF3, 0, 0.9f);
            h3d.setNodeParamF(light, (int)h3d.H3DLight.ColorF3, 1, 0.7f);
            h3d.setNodeParamF(light, (int)h3d.H3DLight.ColorF3, 2, 0.75f);

            _crowdSim = new CrowdSim();
            _crowdSim.init();

            _initialized = true;

            return(true);
        }