public void Draw(UltimaBatcher2D batcher, int x, int y) { if (_texture != null) { X = x - (Width >> 1); Y = y - (Height >> 1); batcher.Begin(); batcher.SetStencil(_stencil.Value); //batcher.SetBlendState(_checkerBlend.Value); //_hueVector.X = 23; //_hueVector.Y = 1; //_hueVector.Z = 0; BlendState.AlphaBlend.ColorWriteChannels = ColorWriteChannels.Alpha; batcher.Draw2D(_texture, X, Y, ref _hueVector); BlendState.AlphaBlend.ColorWriteChannels = ColorWriteChannels.All; //batcher.SetBlendState(null); batcher.SetStencil(null); batcher.End(); } }
public static void Draw(UltimaBatcher2D batcher, Vector2 pos, ushort hue = 0) { if (_texture != null) { pos.X -= _width >> 1; pos.Y -= _height >> 1; Vector3 hueVector = new Vector3(); if (hue == 0) { hueVector.X = 0; hueVector.Y = 0f; } else { hueVector.X = hue; hueVector.Y = 1f; } batcher.SetStencil(_stencil.Value); batcher.Draw ( _texture, pos, hueVector ); batcher.SetStencil(null); } }
public static void Draw(UltimaBatcher2D batcher, int x, int y) { if (_texture != null) { x -= _width >> 1; y -= _height >> 1; batcher.SetStencil(_stencil.Value); batcher.Draw2D(_texture, x, y, ref _hueVector); batcher.SetStencil(null); } }
public static void Draw(UltimaBatcher2D batcher, int x, int y, ushort hue = 0) { if (_texture != null) { x -= _width >> 1; y -= _height >> 1; if (hue == 0) { _hueVector.X = 0; _hueVector.Y = 0f; } else { _hueVector.X = hue; _hueVector.Y = 1f; } batcher.SetStencil(_stencil.Value); batcher.Draw2D(_texture, x, y, ref _hueVector); batcher.SetStencil(null); } }
public override bool Draw(UltimaBatcher2D batcher, int posX, int posY) { if (!AllowedToDraw || IsDestroyed) { return(false); } ushort graphic = Graphic; ResetHueVector(); if (ProfileManager.Current.HighlightGameObjects && SelectedObject.LastObject == this) { HueVector.X = 0x0023; HueVector.Y = 1; } else if (ProfileManager.Current.NoColorObjectsOutOfRange && Distance > World.ClientViewRange) { HueVector.X = Constants.OUT_RANGE_COLOR; HueVector.Y = 1; } else if (World.Player.IsDead && ProfileManager.Current.EnableBlackWhiteEffect) { HueVector.X = Constants.DEAD_RANGE_COLOR; HueVector.Y = 1; } else { ShaderHuesTraslator.GetHueVector(ref HueVector, Hue, ItemData.IsPartialHue, 0); } //Engine.DebugInfo.StaticsRendered++; //if ((StaticFilters.IsTree(Graphic) || ItemData.IsFoliage || StaticFilters.IsRock(Graphic))) //{ // batcher.DrawSpriteShadow(Texture, posX - Bounds.X, posY - Bounds.Y /*- 10*/, false); //} if (StaticFilters.IsTree(graphic, out _)) { graphic = Constants.TREE_REPLACE_GRAPHIC; } if (DrawTransparent) { int maxDist = ProfileManager.Current.CircleOfTransparencyRadius + 44; int fx = (int)(World.Player.RealScreenPosition.X + World.Player.Offset.X); int fy = (int)(World.Player.RealScreenPosition.Y + (World.Player.Offset.Y - World.Player.Offset.Z)); fx -= posX; fy -= posY; int dist = (int)Math.Sqrt(fx * fx + fy * fy); if (dist <= maxDist) { switch (ProfileManager.Current.CircleOfTransparencyType) { default: case 0: HueVector.Z = 0.75f; break; case 1: HueVector.Z = MathHelper.Lerp(1f, 0f, (dist / (float)maxDist)); break; } DrawStaticAnimated(batcher, graphic, posX, posY, ref HueVector); if (AlphaHue != 255) { HueVector.Z = 1f - AlphaHue / 255f; } else { HueVector.Z = 0; } batcher.SetStencil(StaticTransparentStencil.Value); DrawStaticAnimated(batcher, graphic, posX, posY, ref HueVector); batcher.SetStencil(null); } else { if (AlphaHue != 255) { HueVector.Z = 1f - AlphaHue / 255f; } DrawStaticAnimated(batcher, graphic, posX, posY, ref HueVector); } } else { if (AlphaHue != 255) { HueVector.Z = 1f - AlphaHue / 255f; } DrawStaticAnimated(batcher, graphic, posX, posY, ref HueVector); } if (ItemData.IsLight) { Client.Game.GetScene <GameScene>() .AddLight(this, this, posX + 22, posY + 22); } if (!(SelectedObject.Object == this || (FoliageIndex != -1 && Client.Game.GetScene <GameScene>().FoliageIndex == FoliageIndex))) { if (DrawTransparent) { int d = Distance; int maxD = ProfileManager.Current.CircleOfTransparencyRadius + 1; if (d <= maxD && d <= 3) { return(true); } } ref var index = ref ArtLoader.Instance.GetValidRefEntry(graphic + 0x4000); posX -= index.Width; posY -= index.Height; if (SelectedObject.IsPointInStatic(ArtLoader.Instance.GetTexture(graphic), posX, posY)) { SelectedObject.Object = this; } }
public virtual bool Draw(UltimaBatcher2D batcher, int posX, int posY) { //if (DrawTransparent) //{ // int x = RealScreenPosition.X; // int y = RealScreenPosition.Y; // int fx = (int) (World.Player.RealScreenPosition.X + World.Player.Offset.X); // int fy = (int) (World.Player.RealScreenPosition.Y + (World.Player.Offset.Y - World.Player.Offset.Z)); // int dist = Math.Max(Math.Abs(x - fx), Math.Abs(y - fy)); // int maxDist = ProfileManager.Current.CircleOfTransparencyRadius; // if (dist <= maxDist) // { // HueVector.Z = MathHelper.Lerp(1f, 1f - dist / (float)maxDist, 0.5f); // //HueVector.Z = 1f - (dist / (float)maxDist); // } // else // HueVector.Z = 1f - AlphaHue / 255f; //} //else if (AlphaHue != 255) // HueVector.Z = 1f - AlphaHue / 255f; //if (!batcher.DrawSprite(Texture, posX - Bounds.X, posY - Bounds.Y, IsFlipped, ref HueVector)) // return false; if (DrawTransparent) { int maxDist = ProfileManager.Current.CircleOfTransparencyRadius + 44; int fx = (int)(World.Player.RealScreenPosition.X + World.Player.Offset.X); int fy = (int)(World.Player.RealScreenPosition.Y + (World.Player.Offset.Y - World.Player.Offset.Z)); fx -= posX; fy -= posY; int dist = (int)Math.Sqrt(fx * fx + fy * fy); //dist = Math.Max(Math.Abs(fx - x), Math.Abs(fy - y)); if (dist <= maxDist) { switch (ProfileManager.Current.CircleOfTransparencyType) { default: case 0: HueVector.Z = 0.75f; break; case 1: HueVector.Z = MathHelper.Lerp(1f, 0f, (dist / (float)maxDist)); break; } batcher.DrawSprite(Texture, posX - Bounds.X, posY - Bounds.Y, IsFlipped, ref HueVector); if (AlphaHue != 255) { HueVector.Z = 1f - AlphaHue / 255f; } else { HueVector.Z = 0; } batcher.SetStencil(_stencil.Value); batcher.DrawSprite(Texture, posX - Bounds.X, posY - Bounds.Y, IsFlipped, ref HueVector); batcher.SetStencil(null); goto COT; } } if (AlphaHue != 255) { HueVector.Z = 1f - AlphaHue / 255f; } if (!batcher.DrawSprite(Texture, posX - Bounds.X, posY - Bounds.Y, IsFlipped, ref HueVector)) { return(false); } COT: Select(posX, posY); Texture.Ticks = Time.Ticks; return(true); }
public override bool Draw(UltimaBatcher2D batcher, int posX, int posY) { if (!AllowedToDraw || IsDestroyed) { return(false); } ResetHueVector(); ushort hue = Hue; float alpha = 0; if (State != 0) { if ((State & CUSTOM_HOUSE_MULTI_OBJECT_FLAGS.CHMOF_IGNORE_IN_RENDER) != 0) { return(false); } if ((State & CUSTOM_HOUSE_MULTI_OBJECT_FLAGS.CHMOF_INCORRECT_PLACE) != 0) { hue = 0x002B; } if ((State & CUSTOM_HOUSE_MULTI_OBJECT_FLAGS.CHMOF_TRANSPARENT) != 0) { if (AlphaHue >= 192) { alpha = 0.25f; AlphaHue = 0xFF; } else { ProcessAlpha(192); } } } ushort graphic = Graphic; if (ProfileManager.Current.HighlightGameObjects && SelectedObject.LastObject == this) { HueVector.X = 0x0023; HueVector.Y = 1; } else if (ProfileManager.Current.NoColorObjectsOutOfRange && Distance > World.ClientViewRange) { HueVector.X = Constants.OUT_RANGE_COLOR; HueVector.Y = 1; } else if (World.Player.IsDead && ProfileManager.Current.EnableBlackWhiteEffect) { HueVector.X = Constants.DEAD_RANGE_COLOR; HueVector.Y = 1; } else { ShaderHuesTraslator.GetHueVector(ref HueVector, hue, ItemData.IsPartialHue, alpha); } //Engine.DebugInfo.MultiRendered++; if (IsFromTarget) { HueVector.Z = 0.5f; } posX += (int)Offset.X; posY += (int)(Offset.Y + Offset.Z); if (DrawTransparent) { int maxDist = ProfileManager.Current.CircleOfTransparencyRadius + 44; int fx = (int)(World.Player.RealScreenPosition.X + World.Player.Offset.X); int fy = (int)(World.Player.RealScreenPosition.Y + (World.Player.Offset.Y - World.Player.Offset.Z)); fx -= posX; fy -= posY; int dist = (int)Math.Sqrt(fx * fx + fy * fy); if (dist <= maxDist) { switch (ProfileManager.Current.CircleOfTransparencyType) { default: case 0: HueVector.Z = 0.75f; break; case 1: HueVector.Z = MathHelper.Lerp(1f, 0f, (dist / (float)maxDist)); break; } DrawStaticAnimated(batcher, graphic, posX, posY, ref HueVector); if (AlphaHue != 255) { HueVector.Z = 1f - AlphaHue / 255f; } else { HueVector.Z = 0; } batcher.SetStencil(StaticTransparentStencil.Value); DrawStaticAnimated(batcher, graphic, posX, posY, ref HueVector); batcher.SetStencil(null); } else { if (AlphaHue != 255) { HueVector.Z = 1f - AlphaHue / 255f; } DrawStaticAnimated(batcher, graphic, posX, posY, ref HueVector); } } else { if (AlphaHue != 255) { HueVector.Z = 1f - AlphaHue / 255f; } DrawStaticAnimated(batcher, graphic, posX, posY, ref HueVector); } if (ItemData.IsLight) { Client.Game.GetScene <GameScene>() .AddLight(this, this, posX + 22, posY + 22); } if (!(SelectedObject.Object == this || IsFromTarget || (FoliageIndex != -1 && Client.Game.GetScene <GameScene>().FoliageIndex == FoliageIndex))) { if (State != 0) { if ((State & (CUSTOM_HOUSE_MULTI_OBJECT_FLAGS.CHMOF_IGNORE_IN_RENDER | CUSTOM_HOUSE_MULTI_OBJECT_FLAGS.CHMOF_PREVIEW)) != 0) { return(true); } } if (DrawTransparent) { return(true); } ref var index = ref ArtLoader.Instance.GetValidRefEntry(graphic + 0x4000); posX -= index.Width; posY -= index.Height; if (SelectedObject.IsPointInStatic(ArtLoader.Instance.GetTexture(graphic), posX, posY)) { SelectedObject.Object = this; } }