public CurvedStarLinkEntity2D(ALayer2D layer2D, IObject2DFactory factory, CurvedStarLinkEntity entity) : base(layer2D, entity) { this.starEntityFrom = layer2D.GetEntity2DFromEntity(entity.StarFrom) as StarEntity2D; this.starEntityTo = layer2D.GetEntity2DFromEntity(entity.StarTo) as StarEntity2D; this.ObjectSprite.Color = Color.Blue; //this.ObjectSprite.Texture = factory.GetTextureByIndex(0); this.radius = (int)entity.Radius; this.center = new Vector2f(entity.Center.X, entity.Center.Y); Shader shader = new Shader(null, null, @"Assets\Graphics\Shaders\LinkCurvedFrag.frag"); Texture distortionMap = factory.GetTextureById("distorsionTexture"); this.ObjectSprite.Texture = factory.GetTextureById("distorsionTexture"); this.ObjectSprite.Texture.Repeated = true; distortionMap.Repeated = true; distortionMap.Smooth = true; shader.SetUniform("currentTexture", new Shader.CurrentTextureType()); shader.SetUniform("distTexture", distortionMap); render = new RenderStates(BlendMode.Alpha); render.Shader = shader; shader.SetUniform("radius", (float)(this.radius)); shader.SetUniform("margin", (float)(StarLinkEntity2D.WIDTH_LINK / 2)); shader.SetUniform("sideMainTexture", (int)this.ObjectSprite.Texture.Size.X); this.UpdateScaling(); this.Priority = 9; this.InitializeState(entity); }
public StarLinkEntity2D(ALayer2D layer2D, IObject2DFactory factory, StarLinkEntity entity) : base(layer2D, factory, entity) { this.currentColorFrom = Color.Black; this.currentColorTo = Color.Black; this.ratioColorFrom = -1; this.ratioLinkTo = -1; this.starEntityFrom = layer2D.GetEntity2DFromEntity(entity.StarFrom) as StarEntity2D; this.starEntityTo = layer2D.GetEntity2DFromEntity(entity.StarTo) as StarEntity2D; //this.fillRatio = 0; this.isFocused = true; this.ObjectSprite.Color = Color.Blue; Shader shader = new Shader(null, null, @"Assets\Graphics\Shaders\LinkSimpleFrag.frag"); Texture distortionMap = factory.GetTextureById("distorsionTexture"); this.ObjectSprite.Texture = factory.GetTextureById("distorsionTexture"); this.ObjectSprite.Texture.Repeated = true; distortionMap.Repeated = true; distortionMap.Smooth = true; shader.SetUniform("currentTexture", new Shader.CurrentTextureType()); shader.SetUniform("distTexture", distortionMap); render = new RenderStates(BlendMode.Alpha); render.Shader = shader; this.UpdateScaling(); this.Priority = 9; this.InitializeState(entity); }
public CJStarDomain2D(ALayer2D layer2D, IObject2DFactory factory, CJStarDomain entity) : base(layer2D, factory, entity) { // TO REMOVE //this.Test(); //this.widthRatio = 0; //this.heightRatio = 0; this.targetedColor = Color.Black; Shader shader = new Shader(null, null, @"Assets\Graphics\Shaders\StarDomain.frag"); Texture distortionMap = factory.GetTextureById("distorsionTexture"); this.ObjectSprite.Texture = factory.GetTextureById("distorsionTexture"); this.ObjectSprite.Texture.Repeated = true; distortionMap.Repeated = true; distortionMap.Smooth = true; shader.SetUniform("currentTexture", new Shader.CurrentTextureType()); render = new RenderStates(BlendMode.Alpha); render.Shader = shader; this.isFocused = true; this.IsFocused = false; this.Priority = entity.Priority; this.domainStars = entity.Domain.Select(pElem => layer2D.GetEntity2DFromEntity(pElem) as StarEntity2D).ToList(); this.isFilled = entity.IsFilled; shader.SetUniform("isFilled", this.isFilled); SequenceAnimation sequence = new SequenceAnimation(Time.FromSeconds(6), AnimationType.ONETIME); IAnimation anim = new ZoomAnimation(1f, 2f, Time.FromSeconds(2), AnimationType.ONETIME, InterpolationMethod.SQUARE_ACC); sequence.AddAnimation(0, anim); anim = new ZoomAnimation(2f, 1f, Time.FromSeconds(3), AnimationType.ONETIME, InterpolationMethod.SQUARE_ACC); sequence.AddAnimation(2, anim); this.animationsList.Add(sequence); this.UpdateScaling(entity); this.StartNotActiveState(); }