Example #1
0
        public Path(Simulator simulator, ColorInterpolator color, byte alpha, BlendType blend)
        {
            Scene = simulator.Scene;
            ColorInterpolator = color;
            
            InnerPath = new Path3D();
            Times = new List<double>(MaxCurvePoints);
            Points = new List<Vector3>(MaxCurvePoints);

            for(int i = 0; i < MaxCurvePoints; i++)
            {
                Times.Add(0);
                Points.Add(Vector3.Zero);
            }

            NbPoints = 0;
            Length = 0;
            LengthBefore = 0;

            Lines = new Image[MaxVisibleLines];

            for (int i = 0; i < MaxVisibleLines; i++)
            {
                Lines[i] = new Image("LigneTrajet", Vector3.Zero)
                {
                    Blend = blend,
                    SizeX = 1.5f,
                    Alpha = alpha
                };
            }

            Active = true;
            TakeIntoAccountFakeGravTurret = false;
            TakeIntoAccountFakeGravTurretLv2 = false;
        }
Example #2
0
        public LineItem( Vector4f p0, Vector4f c0,
            Vector4f p1, Vector4f c1 )
        {
            P0 = p0;
            C0 = c0;
            P1 = p1;
            C1 = c1;

            BlendType = BlendType.Opaque;
        }
Example #3
0
        public TriangleItem( Vector4f p0, Vector4f p1, Vector4f p2,
            Vector4f c0, Vector4f c1, Vector4f c2, BlendType blendType )
        {
            P0 = p0;
            P1 = p1;
            P2 = p2;

            C0 = c0;
            C1 = c1;
            C2 = c2;

            BlendType = blendType;
        }
Example #4
0
 public TriangleItem
     (
         Vector2f p0, Vector2f p1, Vector2f p2,
         Vector4f c0, Vector4f c1, Vector4f c2,
         BlendType blendType
     )
     : this
     (
         new Vector4f( p0, 0, 1 ), new Vector4f( p1, 0, 1 ), new Vector4f( p2, 0, 1 ),
         c0, c1, c2,
         blendType
     )
 {
     
 }
Example #5
0
        /// <summary>
        /// 描画オブジェクトを追加します。
        /// </summary>
        public void AddRender(Texture texture, BlendType blend, Color color,
                              Mesh mesh, Matrix44d transform, double zorder)
        {
            if (mesh == null)
            {
                throw new ArgumentNullException("mesh");
            }

            AddRenderInternal(new RenderData
            {
                Texture   = texture,
                Blend     = blend,
                Color     = color,
                Mesh      = mesh,
                Transform = transform,
                ZOrder    = zorder,
            });
        }
Example #6
0
        public BlendNode(int w, int h, GraphPixelType p = GraphPixelType.RGBA)
        {
            Name = "Blend";

            width  = w;
            height = h;

            alpha = 1;
            mode  = BlendType.Copy;

            previewProcessor = new BasicImageRenderer();
            processor        = new BlendProcessor();

            internalPixelType = p;

            tileX = tileY = 1;

            Id     = Guid.NewGuid().ToString();
            Inputs = new List <NodeInput>();
            Output = new NodeOutput(NodeType.Color | NodeType.Gray, this);

            first  = new NodeInput(NodeType.Color | NodeType.Gray, this, "Foreground");
            second = new NodeInput(NodeType.Color | NodeType.Gray, this, "Background");
            mask   = new NodeInput(NodeType.Gray, this, "Mask");

            first.OnInputAdded   += OnInputAdded;
            first.OnInputRemoved += OnInputRemoved;
            first.OnInputChanged += OnInputChanged;

            second.OnInputRemoved += OnInputRemoved;
            second.OnInputAdded   += OnInputAdded;
            second.OnInputChanged += OnInputChanged;

            mask.OnInputRemoved += OnInputRemoved;
            mask.OnInputAdded   += OnInputAdded;
            mask.OnInputChanged += OnInputChanged;

            Inputs.Add(first);
            Inputs.Add(second);
            Inputs.Add(mask);

            Outputs = new List <NodeOutput>();
            Outputs.Add(Output);
        }
 public override void Read(PackFileDeserializer des, BinaryReaderEx br)
 {
     base.Read(des, br);
     m_dockingBone = br.ReadInt16();
     br.ReadUInt32();
     br.ReadUInt16();
     m_translationOffset = des.ReadVector4(br);
     m_rotationOffset    = des.ReadQuaternion(br);
     m_blendType         = (BlendType)br.ReadSByte();
     br.ReadByte();
     m_flags = br.ReadUInt16();
     br.ReadUInt32();
     m_child         = des.ReadClassPointer <hkbGenerator>(br);
     m_intervalStart = br.ReadInt32();
     m_intervalEnd   = br.ReadInt32();
     br.ReadUInt64();
     br.ReadUInt64();
     br.ReadUInt64();
 }
Example #8
0
    public void Stop(float blendDuration = 0.5f, Action onFinished = null)
    {
        Debug.Log($"{name}: Stop. CurrentBlend={CurrentBlend}");

        if (blendDuration <= 0f)
        {
            PlayableDirector.Pause();
        }

        if (CurrentBlend != BlendType.None && CurrentBlend != BlendType.In)
        {
            //Debug.Log($"{nameof(TimelordDirector)}.{nameof(Stop)}() was called while already blending ({CurrentBlend}), and was ignored.");
            return;
        }

        if (CurrentBlend == BlendType.In)
        {
            _abortBlendIn = true;
        }

        CurrentBlend = BlendType.Out;

        if (!_output.IsOutputValid())
        {
            Debug.Log($"{name}: Rebuilding output");
            PlayableDirector.RebuildGraph();
            BuildOutput();
        }

        if (_output.IsOutputValid())
        {
            StartCoroutine(BlendOut(PlayableDirector, _output, blendDuration, _output.GetWeight(), () =>
            {
                onFinished?.Invoke();
                CurrentBlend = BlendType.None;
            }));
        }
        else
        {
            //Debug.Log($"{nameof(TimelordDirector)}.{nameof(Stop)}() failed because the graph was invalid.");
        }
    }
Example #9
0
        public void SetDefaults()
        {
            Speed = 16f;
            AnimationParameter = DefaultParameter;
            Weight             = 1f;
            Mask            = HVRHandPoseMask.None;
            Type            = BlendType.Immediate;
            ButtonParameter = false;

            ThumbType  = HVRSettings.Instance.ThumbCurlType;
            IndexType  = HVRSettings.Instance.IndexCurlType;
            MiddleType = HVRSettings.Instance.MiddleCurlType;
            RingType   = HVRSettings.Instance.RingCurlType;
            PinkyType  = HVRSettings.Instance.PinkyCurlType;

            ThumbStart  = HVRSettings.Instance.ThumbStart;
            IndexStart  = HVRSettings.Instance.IndexStart;
            MiddleStart = HVRSettings.Instance.MiddleStart;
            RingStart   = HVRSettings.Instance.RingStart;
            PinkyStart  = HVRSettings.Instance.PinkyStart;
        }
Example #10
0
    public void DrawGeneralTab()
    {
        m.DrawField("_Cull", ref twoSided, "Two Sided");

        if (m.HasProperty("_BlendSrc") && m.HasProperty("_BlendDst"))
        {
            sed.DrawHelp("_BlendSrc");
            blendType = ( BlendType )egui.EnumPopup("Blending Mode", blendType);
        }

        m.DrawField("_Color", ref mainColor, "Global Tint");

        showImages = EditorGUI.Foldout(egui.GetControlRect(), showImages, "Textures", true);
        if (showImages)
        {
            m.DrawField("_MainTex", ref mainTexture, ref mainTextureScale, ref mainTextureOffset, "Image Texture");

            if (FeatureToggle("Texture Swap", "TEXTURE_SWAP"))
            {
                m.DrawField("_MainTex2", ref mainTexture2, ref mainTexture2Scale, ref mainTexture2Offset, "Image Texture 2");
            }
            m.DrawField("_Noise", ref noiseTexture, "Scatter Texture");
        }

        m.DrawField("_TileCount", ref tileCount, "Tile Count");
        m.DrawField("_SquareTiles", ref squareTiles, "Square Tiles");
        m.DrawField("_Scaling", ref scaling, "Scaling");

        if (FeatureToggle("Scale Around Tile", "SCALE_AROUND_TILE"))
        {
            m.DrawField("_ScaleAroundTile", ref scaleAroundTile, "Scale Around Tiles");
        }

        sed.DrawHelp("COMPLEX");
        if (FeatureToggle("Allow Complexities", "COMPLEX"))
        {
            sed.DrawField(m, "_Flicker", ref flicker, "Flicker");
            sed.DrawField(m, "_BackfaceVisibility", ref backfaceVisibility, "Backface Visibility");
        }
    }
Example #11
0
        protected static bool CombineOutputTypes(OutputType type, float opacity, BlendType blending, Graph previous, Dictionary <OutputType, Node> render, Node mask, BlendProcessor processor)
        {
            if (previous == null || render == null || processor == null)
            {
                return(false);
            }

            Node node = null;

            foreach (string k in previous.OutputNodes)
            {
                Node n = null;
                if (previous.NodeLookup.TryGetValue(k, out n))
                {
                    OutputNode output = n as OutputNode;
                    if (output != null && output.OutType == type)
                    {
                        node = n;
                        break;
                    }
                }
            }

            Node renderLayer = null;

            render.TryGetValue(type, out renderLayer);

            if (node != null && renderLayer != null && renderLayer.GetActiveBuffer() != null && renderLayer.GetActiveBuffer().Id != 0 && node.GetActiveBuffer() != null && node.GetActiveBuffer().Id != 0)
            {
                processor.Alpha      = opacity;
                processor.AlphaMode  = (int)AlphaModeType.Add;
                processor.BlendMode  = (int)blending;
                processor.Luminosity = 1.0f;
                processor.Process(node.Width, node.Height, node.GetActiveBuffer(), renderLayer.GetActiveBuffer(), mask?.GetActiveBuffer(), renderLayer.GetActiveBuffer());
                processor.Complete();
                return(true);
            }

            return(false);
        }
Example #12
0
    public void Seek(float toTime, float blendDuration, Action onFinished = null)
    {
        //Debug.Log($"{name}: Seek. CurrentBlend={CurrentBlend} to={toTime}");

        if (CurrentBlend == BlendType.None)
        {
            CurrentBlend = BlendType.Seek;

            if (_output.IsOutputValid())
            {
                StartCoroutine(SeekBlend(blendDuration, toTime, () =>
                {
                    onFinished?.Invoke();
                    CurrentBlend = BlendType.None;
                }));
            }
            else
            {
                //Debug.Log($"{nameof(TimelordDirector)}.{nameof(Stop)}() failed because the graph was invalid.");
            }
        }
    }
Example #13
0
    void Update()
    {
        if (IsPlaying && CurrentBlend == BlendType.None)
        {
            if (_outTime >= 0 && PlayableDirector.time >= _outTime)
            {
                CurrentBlend = BlendType.Out;

                //Debug.Log($"{name}: Starting Scheduled Blend-Out at {PlayableDirector.time:N2}");
                _sw.Restart();

                StartCoroutine(BlendOut(PlayableDirector, _output, _scheduledBlendOutDuration, _output.GetWeight(), () =>
                {
                    _sw.Stop();
                    //Debug.Log($"{name}: Finished Scheduled Blend-Out after {_sw.Elapsed.TotalSeconds:N3}ms");
                    _scheduledBlendOutCallback?.Invoke();
                    _scheduledBlendOutCallback = null;
                    CurrentBlend = BlendType.None;
                }));
            }
        }
    }
Example #14
0
        private void AddBlendTile(int x, int y, Texture texture, BlendType blendType)
        {
            short tileIndex = texture.GetTileIndex(x, y);

            if (tileIndex == map.Tiles[x, y].BaseTexture)
            {
                return;
            }
            short blendTileIndex = map.Tiles.GetBlendTileIndex(tileIndex, blendType);

            if (map.Tiles[x, y].BlendTexture1 == 0)
            {
                map.Tiles[x, y].BlendTexture1 = blendTileIndex;
            }
            else if (map.Tiles[x, y].BlendTexture2 == 0)
            {
                map.Tiles[x, y].BlendTexture2 = blendTileIndex;
            }
            else if (map.Tiles[x, y].BlendTexture3 == 0)
            {
                map.Tiles[x, y].BlendTexture3 = blendTileIndex;
            }
        }
Example #15
0
        public static TriangleItem[] MakeSquare( Vector2f center, float radius, Vector4f color, BlendType blendType )
        {
            return new[]
            {
                new TriangleItem
                (
                    new Vector2f( center.X - radius, center.Y - radius ),
                    new Vector2f( center.X + radius, center.Y - radius ),
                    new Vector2f( center.X - radius, center.Y + radius ),
                    color,
                    blendType
                ),

                new TriangleItem
                (
                    new Vector2f( center.X - radius, center.Y + radius ),
                    new Vector2f( center.X + radius, center.Y - radius ),
                    new Vector2f( center.X + radius, center.Y + radius ),
                    color,
                    blendType
                )
            };
        }
Example #16
0
 public Scene(int width, int height)
 {
     Buffer = Visuals.ScenesController.Buffer;
     EnableVisuals = false;
     EnableInputs = false;
     EnableUpdate = false;
     ToDraw = new List<IScenable>();
     ToDrawWithoutCameraForeground = new List<IScenable>();
     ToDrawWithoutCameraBackground = new List<IScenable>();
     Batch = new SpriteBatch(Preferences.GraphicsDeviceManager.GraphicsDevice);
     LastBlend = BlendType.Alpha;
     UpdatedThisTick = false;
     Camera = new Camera(new Vector2(width, height));
     Camera.Origin = new Vector2(width / 2.0f, height / 2.0f);
     Name = name;
     Animations = new AnimationsController(this);
     PhysicalEffects = new EffectsController<IPhysical>();
     VisualEffects = new EffectsController<IVisual>();
     Particles = new ParticlesController(this);
     EphemereGames.Core.Input.Inputs.AddListener(this);
     IdentityMatrix = Matrix.CreateTranslation(width / 2, height / 2, 0);
     DrawMode = DrawMode.Default;
 }
 public static byte SetBottomL(byte b, BlendType bt)
 {
     return((byte)(b | ((byte)bt << 6)));
 }
 public static byte SetTopR(byte b, BlendType bt)
 {
     return((byte)(b | ((byte)bt << 2)));
 }
 public static byte SetTopL(byte b, BlendType bt)
 {
     return((byte)(b | (byte)bt));
 }
Example #20
0
        private static EmitterBlendMode ToMercuryBlend(BlendType core)
        {
            EmitterBlendMode blend;

            switch (core)
            {
                case BlendType.Add:          blend = EmitterBlendMode.Add;       break;
                case BlendType.Alpha:        blend = EmitterBlendMode.Alpha;     break;
                case BlendType.None:         blend = EmitterBlendMode.None;      break;
                default:                     blend = EmitterBlendMode.Add;       break;
            }

            return blend;
        }
 public override void DrawEditorLayout()
 {
     min   = UnityEditor.EditorGUILayout.FloatField(new GUIContent("Min", "This is the minimum random radius that will be picked."), min);
     max   = UnityEditor.EditorGUILayout.FloatField(new GUIContent("Max", "This is the maximum random radius that will be picked."), max);
     blend = (BlendType)UnityEditor.EditorGUILayout.EnumPopup(new GUIContent("Blend", "The way the picked radius value will be blended with the current one."), blend);
 }
Example #22
0
 public Blending(BlendType type, byte source, byte destination)
 {
     m_type               = type;
     m_sourcefactor       = type != BlendType.None ? source : (byte)0;
     m_destionationfactor = type != BlendType.None ? destination : (byte)0;
 }
Example #23
0
 public static byte SetTopR(byte b, BlendType bt) {
   return (byte)(b | ((byte)bt << 2));
 }
Example #24
0
        /// <summary>
        /// 描画オブジェクトを追加します。
        /// </summary>
        public void AddRender(BlendType blend, Color color,
                              RectangleF bounds, Matrix44d transform,
                              double zorder, double opacity = 1.0)
        {
            var alphaByte = (byte)Math.Min(color.A * opacity, 255);
            var color2 = Color.FromArgb(alphaByte, color);
            var transform2 = ToMatrix(bounds, transform);

            AddRender(blend, color2, transform2, zorder);
        }
Example #25
0
 public int GetSize()
 {
     return(2
            + 8
            + BlendType.GetSize());
 }
Example #26
0
        private BlendState SwitchBlendMode(BlendType blend)
        {
            LastBlend = blend;

            BlendState newBlend = BlendState.AlphaBlend;

            switch (blend)
            {
                case BlendType.Add:
                    newBlend = BlendState.Additive;
                    break;

                case BlendType.Multiply:
                    newBlend = CustomBlends.Multiply;
                    break;

                default:
                case BlendType.Default:
                case BlendType.Alpha:
                    newBlend = CustomBlends.Alpha;
                    break;

                case BlendType.Substract:
                    newBlend = CustomBlends.Substract;
                    break;
            }

            return newBlend;
        }
 public override void DrawEditorLayout()
 {
     hardness = EditorGUILayout.FloatField(new GUIContent("Hardness", "The change in hardness when the pressure is 1, based on the current blend."), hardness);
     blend    = (BlendType)EditorGUILayout.EnumPopup(new GUIContent("Blend", "The way the hardness value will be blended with the current one."), blend);
 }
Example #28
0
 public CurveBlendData()
 {
     BlendType = BlendType.Overwrite;
 }
        void GenerateMaterialId()
        {
            var textureId = texture == null ? 0 : texture.TextureId;

            materialId = (uint)textureId << 12 | (uint)BlendType.GetHashCode();
        }
Example #30
0
        private static BlendType ToCoreBlend(EmitterBlendMode mercury)
        {
            BlendType blend;

            switch (mercury)
            {
                case EmitterBlendMode.Add:          blend = BlendType.Add;        break;
                case EmitterBlendMode.Alpha:        blend = BlendType.Alpha;      break;
                case EmitterBlendMode.None:         blend = BlendType.None;       break;
                default:                            blend = BlendType.Add;        break;
            }

            return blend;
        }
Example #31
0
 public void Reset() {
   this.f = this.g = this.j = this.k = BlendType.BlendNone;
 }
Example #32
0
 public static byte SetBottomL(byte b, BlendType bt) {
   return (byte)(b | ((byte)bt << 6));
 }
Example #33
0
 /// <summary>
 /// 描画オブジェクトを追加します。
 /// </summary>
 public void AddRender(BlendType blend, Color color,
                       Matrix44d transform, double zorder)
 {
     AddRenderInternal(new RenderData
     {
         Mesh = DefaultMesh,
         Blend = blend,
         Color = color,
         Transform = transform,
         ZOrder = zorder,
     });
 }
Example #34
0
 public static byte SetTopL(byte b, BlendType bt) {
   return (byte)(b | (byte)bt);
 }
Example #35
0
        /// <summary>
        /// 描画オブジェクトを追加します。
        /// </summary>
        public void AddRender(GLUtil.Texture texture, BlendType blend,
                              RectangleF bounds, Matrix44d transform,
                              Mesh mesh, double zorder,
                              double opacity = 1.0)
        {
            if (texture == null || texture.TextureName == 0)
            {
                return;
            }

            var alphaByte = (byte)Math.Min(256 * opacity, 255);
            var color = Color.FromArgb(alphaByte, Color.White);
            var transform2 = ToMatrix(bounds, transform);

            AddRender(texture, blend, color, mesh, transform2, zorder);
        }
Example #36
0
 public Blending(BlendType type, int source, int destination)
 {
     m_type               = type;
     m_sourcefactor       = type != BlendType.None ? (byte)Misc.Clamp(source, 0, 255) : (byte)0;
     m_destionationfactor = type != BlendType.None ? (byte)Misc.Clamp(destination, 0, 255) : (byte)0;
 }
 public void Reset()
 {
     this.f = this.g = this.j = this.k = BlendType.BlendNone;
 }
Example #38
0
 public DxsLayer(MaterialType matType, BlendType blendType)
 {
     _matType   = matType;
     _blendType = blendType;
 }
Example #39
0
 public static void SetBlendState(DeviceContext context, BlendType type)
 {
     context.OutputMerger.BlendState = m_BlendStates[(int)type];
 }
Example #40
0
 public TriangleItem( Vector2f p0, Vector2f p1, Vector2f p2, Vector4f color, BlendType blendType )
     : this( new Vector4f( p0, 0, 1 ), new Vector4f( p1, 0, 1 ), new Vector4f( p2, 0, 1 ),
     color, color, color, blendType )
 {
     
 }
Example #41
0
 internal BlendedAnimation(IAnimationInstance instance, BlendType blendType)
 {
     System.Diagnostics.Debug.Assert(instance != null);
       Instance = instance;
       blendType_ = blendType;
 }
Example #42
0
 internal BlendedAnimation(IAnimationInstance instance, BlendType blendType)
 {
     System.Diagnostics.Debug.Assert(instance != null);
     Instance   = instance;
     blendType_ = blendType;
 }
Example #43
0
        /// <summary>
        /// 描画オブジェクトを追加します。
        /// </summary>
        public void AddRender(BlendType blend, RectangleF bounds,
                              Matrix44d transform, Color color, double zorder)
        {
            var transform2 = ToMatrix(bounds, transform);

            AddRender(blend, color, transform2, zorder);
        }
Example #44
0
 public DxsLayer()
 {
     _matType   = MaterialType.Color;
     _blendType = BlendType.Replace;
     _color     = Color.White;
 }
Example #45
0
        private void ApplyPass( BlendType blendType )
        {
            switch( blendType )
            {
                case BlendType.Opaque:
                    opaquePass.Apply();
                    d3d.Device.InputAssembler.SetInputLayout( opaquePassLayout );
                    break;

                case BlendType.Additive:
                    additivePass.Apply();
                    d3d.Device.InputAssembler.SetInputLayout( additivePassLayout );
                    break;

                case BlendType.Alpha:
                    alphaPass.Apply();
                    d3d.Device.InputAssembler.SetInputLayout( alphaPassLayout );
                    break;                

                default:
                    break;
            }
        }
Example #46
0
        public static Color4 BlendColors(Color4 a, Color4 b, BlendType mixMode)
        {
            switch (mixMode)
            {
            case BlendType.And:
            {
                byte newAR = (byte)Math.Round(a.R * 255);
                byte newBR = (byte)Math.Round(b.R * 255);

                byte newR = (byte)((byte)Math.Round(a.R * 255) & (byte)Math.Round(b.R * 255));
                byte newG = (byte)((byte)Math.Round(a.G * 255) & (byte)Math.Round(b.G * 255));
                byte newB = (byte)((byte)Math.Round(a.B * 255) & (byte)Math.Round(b.B * 255));
                return(new Color4(newR / 255.0f, newG / 255.0f, newB / 255.0f, 1f));
            }

            case BlendType.Or:
            {
                byte newR = (byte)((byte)Math.Round(a.R * 255) | (byte)Math.Round(b.R * 255));
                byte newG = (byte)((byte)Math.Round(a.G * 255) | (byte)Math.Round(b.G * 255));
                byte newB = (byte)((byte)Math.Round(a.B * 255) | (byte)Math.Round(b.B * 255));
                return(new Color4(newR / 255.0f, newG / 255.0f, newB / 255.0f, 1f));
            }

            case BlendType.Xor:
            {
                byte newR = (byte)((byte)Math.Round(a.R * 255) ^ (byte)Math.Round(b.R * 255));
                byte newG = (byte)((byte)Math.Round(a.G * 255) ^ (byte)Math.Round(b.G * 255));
                byte newB = (byte)((byte)Math.Round(a.B * 255) ^ (byte)Math.Round(b.B * 255));
                return(new Color4(newR / 255.0f, newG / 255.0f, newB / 255.0f, 1f));
            }

            case BlendType.NotAnd:
            {
                byte newR = (byte)((byte)Math.Round(a.R * 255) & (byte)Math.Round(b.R * 255));
                byte newG = (byte)((byte)Math.Round(a.G * 255) & (byte)Math.Round(b.G * 255));
                byte newB = (byte)((byte)Math.Round(a.B * 255) & (byte)Math.Round(b.B * 255));
                return(new Color4((byte)~newR / 255.0f, (byte)~newG / 255.0f, (byte)~newB / 255.0f, 1f));
            }

            case BlendType.NotOr:
            {
                byte newR = (byte)((byte)Math.Round(a.R * 255) | (byte)Math.Round(b.R * 255));
                byte newG = (byte)((byte)Math.Round(a.G * 255) | (byte)Math.Round(b.G * 255));
                byte newB = (byte)((byte)Math.Round(a.B * 255) | (byte)Math.Round(b.B * 255));
                return(new Color4((byte)~newR / 255.0f, (byte)~newG / 255.0f, (byte)~newB / 255.0f, 1f));
            }

            case BlendType.NotXor:
            {
                byte newR = (byte)((byte)Math.Round(a.R * 255) ^ (byte)Math.Round(b.R * 255));
                byte newG = (byte)((byte)Math.Round(a.G * 255) ^ (byte)Math.Round(b.G * 255));
                byte newB = (byte)((byte)Math.Round(a.B * 255) ^ (byte)Math.Round(b.B * 255));
                return(new Color4((byte)~newR / 255.0f, (byte)~newG / 255.0f, (byte)~newB / 255.0f, 1f));
            }

            case BlendType.No:
            {
                return(new Color4(b.R, b.G, b.B, 1f));
            }

            default: return(Color4.White);
            }
        }
Example #47
0
 public static byte SetTopR(this byte b, BlendType bt)
 {
     unchecked { return((byte)(b | (bt.Byte() << 2))); }
 }
Example #48
0
 internal static byte Byte(this BlendType type)
 {
     return(unchecked ((byte)type));
 }
Example #49
0
        /// <summary>
        /// 描画オブジェクトを追加します。
        /// </summary>
        public void AddRender(BlendType blend, Color color, Mesh mesh,
                              Matrix44d transform, double zorder)
        {
            if (mesh == null)
            {
                throw new ArgumentNullException("mesh");
            }

            AddRenderInternal(new RenderData
            {
                Blend = blend,
                Color = color,
                Mesh = mesh,
                Transform = transform,
                ZOrder = zorder,
            });
        }
Example #50
0
        private void RenderPass( BlendType blendType )
        {
            var prevItemType = ItemType.None;

            foreach( var item in rootItemTree.ItemsInSubTree() )
            {
                if( blendType != item.BlendType )
                {
                    continue;
                }

                var currentItemType = item.ItemType;

                // if the current item is different than the previous item
                if( currentItemType != prevItemType )
                {
                    // and it's not the first item type
                    // then render it and reset the stream
                    if( prevItemType != ItemType.None )
                    {
                        Render( prevItemType );
                    }
                }

                // if it doesn't fit
                // then render it and reset the stream
                if( !streamState.CanAppendItem( item ) )
                {
                    Render( prevItemType );                    
                }
                
                // then add it to the stream
                streamState.AppendItem( item );
                
                prevItemType = currentItemType;             
            }

            if( streamState.NumVerticesInCurrentStream > 0 )
            {
                Render( prevItemType );
            }
        }
 public override void DrawEditorLayout()
 {
     opacity = EditorGUILayout.FloatField(new GUIContent("Opacity", "The change in opacity when the pressure is 1, based on the current blend."), opacity);
     blend   = (BlendType)EditorGUILayout.EnumPopup(new GUIContent("Blend", "The way the opacity value will be blended with the current one."), blend);
 }
Example #52
0
 public static byte SetBottomL(this byte b, BlendType bt)
 {
     unchecked { return((byte)(b | (bt.Byte() << 6))); }
 }
 public override void DrawEditorLayout()
 {
     radius = UnityEditor.EditorGUILayout.FloatField(new GUIContent("Radius", "The paint component's Radius value will be modified using this value based on the current Blend setting."), radius);
     blend  = (BlendType)UnityEditor.EditorGUILayout.EnumPopup(new GUIContent("Blend", "This allows you to control how this new Radius value will modify the old value in the paint component.\n\nReplace = Transition between [old, new] based on pressure.\n\nMultiply = Transition between [old, old*new] based on pressure.\n\nIncrement = Transition between [old, old+new] based on pressure."), blend);
 }