예제 #1
0
 /// <summary>
 /// Adds a new simple colored material resource to the scene.
 /// </summary>
 /// <param name="sceneManipulator">The manipulator of the scene.</param>
 /// <param name="textureSourceHighQuality">The source of the texture which should be loaded.</param>
 /// <param name="textureSourceLowQuality">The source of the texture with low quality.</param>
 public static NamedOrGenericKey AddStandardMaterialResource(
     this SceneManipulator sceneManipulator,
     ResourceLink textureSourceHighQuality, ResourceLink textureSourceLowQuality)
 {
     var resTexture = sceneManipulator.AddTextureResource(textureSourceHighQuality, textureSourceLowQuality);
     return sceneManipulator.AddResource(_ => new StandardMaterialResource(resTexture));
 }
예제 #2
0
        /// <summary>
        /// Builds a floor to the given scene.
        /// </summary>
        protected void BuildStandardFloor(SceneManipulator manipulator, string sceneLayer)
        {
            var bgLayer = manipulator.AddLayer("BACKGROUND");

            manipulator.SetLayerOrderId(bgLayer, 0);
            manipulator.SetLayerOrderId(Scene.DEFAULT_LAYER_NAME, 1);
            ResourceLink sourceBackgroundTexture = new AssemblyResourceLink(
                typeof(SampleBase),
                "Assets.Background.dds");
            ResourceLink sourceTileTexture = new AssemblyResourceLink(
                typeof(SampleBase),
                "Assets.Floor.dds");

            var resBackgroundTexture = manipulator.AddTextureResource(sourceBackgroundTexture);

            manipulator.AddObject(new FullscreenTexture(resBackgroundTexture), bgLayer.Name);

            // Define textures and materials
            var resTileTexture  = manipulator.AddResource(device => new StandardTextureResource(sourceTileTexture));
            var resTileMaterial = manipulator.AddResource(device => new StandardMaterialResource(resTileTexture));

            // Define floor geometry
            var floorType = new FloorGeometryFactory(new Vector2(4f, 4f));

            floorType.SetTilemap(25, 25);

            // AddObject floor to scene
            var resFloorGeometry = manipulator.AddResource(device => new GeometryResource(floorType));

            manipulator.AddMeshObject(resFloorGeometry, sceneLayer, resTileMaterial);
        }