Exemple #1
0
 private int painterSortStable(Sprite a, Sprite b)
 {
     if (a.Zdepth.HasValue && b.Zdepth.HasValue && a.Zdepth != b.Zdepth) return Mathf.Round(b.Zdepth.Value - a.Zdepth.Value);
     else return Convert.ToInt32(b.Id - a.Id);
 }
Exemple #2
0
        private static void Init()
        {
            mediaPath = Path.GetFullPath("../../../../../js/r68/examples/");
            texturesPath = Path.Combine(mediaPath, "textures");
            renderer = new Renderer();

            scene = new Scene()
            {
                Fog = new FogLinear(Color.Black, 1500,2100)
            };

            camera = new PerspectiveCamera(renderer, 60, 1, 2100)
            {
                Position = new Vector3(0, 0, 1500)
            };


            cameraOrtho = new OrthographicCamera(renderer, 1, 10000)
        {
            Position = new Vector3(0, 0, 150)
        };
            sceneOrtho = new Scene();

            //var amount = 200;
            //var radius = 500;


            sceneOrtho.Add(new Mesh(new SphereGeometry(100, 50, 50), new MeshBasicMaterial(renderer) { Diffuse = Color.Red}));
            

            var group = new Object3D();

            var materialA = new SpriteMaterial(renderer)
            {
                DiffuseMap = new Texture(Path.Combine(texturesPath, "sprite0.png")),
                Diffuse = Color.White,
                UseFog = true,
            };

            spriteTL = new Sprite(renderer, materialA)
            {
                Scale = new Vector3(materialA.DiffuseMap.Resolution.Width,materialA.DiffuseMap.Resolution.Height,1),                
            };
            sceneOrtho.Add(spriteTL);

            spriteTR = new Sprite(renderer, materialA)
            {
                Scale = new Vector3(materialA.DiffuseMap.Resolution.Width, materialA.DiffuseMap.Resolution.Height, 1),
            };
            sceneOrtho.Add(spriteTR);

            spriteBL = new Sprite(renderer, materialA)
            {
                Scale = new Vector3(materialA.DiffuseMap.Resolution.Width, materialA.DiffuseMap.Resolution.Height, 1),
            };
            sceneOrtho.Add(spriteBL);

            spriteBR = new Sprite(renderer, materialA)
            {
                Scale = new Vector3(materialA.DiffuseMap.Resolution.Width, materialA.DiffuseMap.Resolution.Height, 1),
            };
            sceneOrtho.Add(spriteBR);

            spriteC = new Sprite(renderer, materialA)
            {
                Scale = new Vector3(materialA.DiffuseMap.Resolution.Width, materialA.DiffuseMap.Resolution.Height, 1),
            };
            sceneOrtho.Add(spriteC);

            UpdateHUDSprites();

            var materialB = new SpriteMaterial(renderer)
            {
                DiffuseMap = new Texture(Path.Combine(texturesPath, "sprite1.png")),
                Diffuse = Color.White,
                UseFog = true,
            };

            var materialC = new SpriteMaterial(renderer)
            {
                DiffuseMap = new Texture(Path.Combine(texturesPath, "sprite2.png")),
                Diffuse = Color.White,
                UseFog = true,
            };

            mediaPath = Path.Combine(mediaPath, "../../tests/");

        }
Exemple #3
0
	int PainterSortStable(Sprite a,Sprite b ) 
    {
		if ( a.Zdepth != b.Zdepth)  return b.Zdepth.Value.CompareTo(a.Zdepth.Value);
		else return b.Id.CompareTo(a.Id);
    }