示例#1
0
        public void SetProgression(float comboScore, int combo, float interpolatedProgression, float directProgression, bool isFever)
        {
            if (mpb == null)
            {
                return;
            }

            foreach (var r in rendererArray)
            {
                r.GetPropertyBlock(mpb);
                {
                    mpb.SetFloat(Progression, interpolatedProgression);
                    mpb.SetFloat(DirectProgression, interpolatedProgression);
                    mpb.SetInt(IsFever, isFever ? 1 : 0);
                    mpb.SetInt(SummonReady, interpolatedProgression >= 1 ? 1 : 0);
                    //mpb.SetVector(SummonPosition, new Vector4(ranges[0].position.x, ranges[1].position.x, 0, 0));
                }
                r.SetPropertyBlock(mpb);
            }

            m_ComboCountStrBuilder.Clear();
            m_ComboCountStrBuilder.Append(combo);
            foreach (var label in comboCountLabels)
            {
                label.SetText(m_ComboCountStrBuilder);
            }

            comboFrame.SetActive(!isFever);
            feverFrame.SetActive(isFever);
        }
示例#2
0
    public override void Interact(GameObject player)
    {
        // Don't even try interact with it if already opened
        if (opened)
        {
            return;
        }

        if (isFacingFront)
        {
            // Open item box
            Debug.Log("ITEM BOX INTERACTION SUCCESS");
            opened = true;
            // Turn off highlight effect
            propBlock.SetInt("_IsActive", 0);
            boxRenderer.SetPropertyBlock(propBlock);

            // Pickup item
            obj.PickupUse();
            // Display item contents
            StartCoroutine("DisplayItemAndDestroy", displayDuration);
        }
        else
        {
            Debug.Log("ITEM BOX INTERACTION FAIL");

            return;
        }
    }
        protected override void OnUpdate()
        {
            var buffer = GetBufferFromEntity <FrameData>(true);

            Entities
            .WithoutBurst()
            .WithReadOnly(buffer)
            .ForEach((Entity entity, RenderMesh mesh, in SpriteInformation info, in Translation translation) =>
            {
                MaterialPropertyBlock properties = new MaterialPropertyBlock();
                var data = buffer[entity][info.animation];
                properties.SetInt("Vector1_4A447B85", data.offset);
                properties.SetInt("Vector1_C85BB47D", data.count);

                if (info.direction == SpriteInformation.Direction.LEFT)
                {
                    properties.SetFloat("Boolean_A9A184AB", 0);
                }
                else
                {
                    properties.SetFloat("Boolean_A9A184AB", 1);
                }

                Graphics.DrawMesh(quad, translation.Value, Quaternion.identity, mesh.material, 0, Camera.main, 0, properties, false, false);
            }).Run();
示例#4
0
        public override void _Create()
        {
            if (mpb == null)
            {
                mpb = new MaterialPropertyBlock();
            }

            if (verts == null)
            {
                verts = GetComponent <MeshVerts>();
            }
            if (triangles == null)
            {
                triangles = GetComponent <MeshTris>();
            }

            SafeInsert(verts);
            SafeInsert(triangles);


            mpb.SetInt("_VertCount", verts.count);
            mpb.SetBuffer("_VertBuffer", verts._buffer);
            mpb.SetBuffer("_TriBuffer", triangles._buffer);

            DoCreate();
        }
 private void SetImageSprite(Sprite value)
 {
     if (spriteRenderer != null)
     {
         spriteRenderer.sprite = value;
         MaterialPropertyBlock block = new MaterialPropertyBlock();
         spriteRenderer.GetPropertyBlock(block);
         var palette = getPaletteOrNull();
         if (palette != null)
         {
             List <Vector4> pal = palette.ConvertAll <Vector4>((Color c) => new Vector4(c.r, c.g, c.b, c.a));
             block.SetVectorArray("_ColorPalette", pal);
             block.SetInt("_IsPaletted", 1);
         }
         else
         {
             block.SetInt("_IsPaletted", 0);
         }
         spriteRenderer.SetPropertyBlock(block);
     }
     else if (image != null)
     {
         image.sprite = value;
     }
 }
示例#6
0
    private void UpdateMaterialProperties()
    {
        if (properties == null)
        {
            properties = new MaterialPropertyBlock();
        }

        /*
         * Vector3 halfExtent = 0.5f * Vector3.one;
         * Vector3 boundsMax = transform.TransformPoint(halfExtent);
         * Vector3 boundsMin = transform.TransformPoint(-halfExtent);*/

        properties.SetInt("_useGradient", (this.Mode == VolumeMode.Gradient ? 1 : 0));
        //properties.SetVector("boundsMax", boundsMax);
        //properties.SetVector("boundsMin", boundsMin);
        //properties.SetVector("up", transform.up);
        //properties.SetVector("forward", transform.forward);
        //properties.SetVector("right", transform.right);
        //properties.SetVector("origin", transform.position);
        properties.SetVector("scale", transform.lossyScale);
        properties.SetMatrix("transformMatrix", transform.worldToLocalMatrix);


        if (this.Mode == VolumeMode.Color)
        {
            properties.SetColor("_Color", Color);
        }
        else
        {
            GradientTexture.UpdateTexture(Gradient, ref gradientTexture, SampleCount, GradientOffset, InvertGradient);
            properties.SetTexture("_gradient", gradientTexture);
            properties.SetInt("_gradientMode", (int)GradientType);
        }
    }
示例#7
0
    internal void ApplyMaterials(CreatureRaw race, MaterialPropertyBlock propertyBlock)
    {
        if (!gotShaderIds)
        {
            GetShaderIDs();
        }
        var renderer        = GetComponentInChildren <MeshRenderer>();
        var skinnedRenderer = GetComponentInChildren <SkinnedMeshRenderer>();

        if (renderer != null || skinnedRenderer != null)
        {
            var tissue     = race.tissues[layerRaw.tissue_id];
            var color      = ContentLoader.GetColor(tissue.material);
            var index      = ContentLoader.GetPatternIndex(tissue.material);
            var shapeIndex = ContentLoader.GetShapeIndex(tissue.material);
            propertyBlock.SetColor(_MatColorProperty, color);
            propertyBlock.SetColor(_Color1Property, color);
            propertyBlock.SetColor(_Color2Property, color);
            propertyBlock.SetColor(_Color3Property, color);
            propertyBlock.SetInt(_MatIndexProperty, index);
            propertyBlock.SetInt(_ShapeIndexProperty, shapeIndex);
            if (renderer != null)
            {
                renderer.SetPropertyBlock(propertyBlock);
            }
            if (skinnedRenderer != null)
            {
                skinnedRenderer.SetPropertyBlock(propertyBlock);
            }
        }
    }
示例#8
0
    private void SetSprite(SpriteInfo animationStills, List <Color> palette = null)
    {
        timeElapsed = 0;
        waitTime    = animationStills.waitTime;
        if (spriteRenderer == null)
        {
            spriteRenderer = GetComponent <SpriteRenderer>();
            if (spriteRenderer == null)
            {
                Logger.Log($"There is no spriterenderer on this object {name}");
                return;
            }
        }
        spriteRenderer.sprite = animationStills.sprite;
        MaterialPropertyBlock block = new MaterialPropertyBlock();

        spriteRenderer.GetPropertyBlock(block);

        if (palette != null)
        {
            List <Vector4> pal = palette.ConvertAll <Vector4>((Color c) => new Vector4(c.r, c.g, c.b, c.a));
            block.SetVectorArray("_ColorPalette", pal);
            block.SetInt("_IsPaletted", 1);
        }
        else
        {
            block.SetInt("_IsPaletted", 0);
        }
        spriteRenderer.SetPropertyBlock(block);
    }
示例#9
0
        public void EnqueuePass(ScriptableRenderer _renderer)
        {
            if (SRC_ReflectionPlane.m_ReflectionPlanes.Count == 0)
            {
                return;
            }

            int index = 0;

            foreach (var groups in SRC_ReflectionPlane.m_ReflectionPlanes.FindAll(p => p.m_MeshRenderer.isVisible).GroupBy(p => p.m_PlaneData))
            {
                if (index >= C_MaxReflectionTextureCount)
                {
                    Debug.LogWarning("Reflection Plane Outta Limit!");
                    break;
                }
                m_PropertyBlock.SetInt(ID_ReflectionTextureOn, 1);
                m_PropertyBlock.SetInt(ID_ReflectionTextureIndex, index);
                foreach (SRC_ReflectionPlane planeComponent in groups)
                {
                    #if UNITY_EDITOR
                    planeComponent.EditorApplyIndex(index);
                    #endif
                    m_PropertyBlock.SetFloat(ID_ReflectionNormalDistort, planeComponent.m_NormalDistort);
                    planeComponent.m_MeshRenderer.SetPropertyBlock(m_PropertyBlock);
                }
                _renderer.EnqueuePass(m_ReflectionPasses[index].Setup(index, groups.Key, groups, _renderer));
                index++;
            }
        }
示例#10
0
        public override void _Create()
        {
            print("run SEcOND");
            if (mpb == null)
            {
                mpb = new MaterialPropertyBlock();
            }


            if (verts == null)
            {
                verts = GetComponent <Form>();
            }
            if (triangles == null)
            {
                triangles = GetComponent <IndexForm>();
            }

            SafeInsert(verts);
            SafeInsert(triangles);


            mpb.SetInt("_VertCount", verts.count);
            mpb.SetBuffer("_VertBuffer", verts._buffer);
            mpb.SetBuffer("_TriBuffer", triangles._buffer);

            DoCreate();
        }
示例#11
0
    // Update is called once per frame
    void Update()
    {
        for (int set = 0; set < Ninstances; set++)
        {
            MaterialPropertyBlock mpb = new MaterialPropertyBlock();
            mpb.SetInt("offset", set * instance_max);
            mpb.SetInt("NumBodiesMax", NumBodiesMax);
            mpb.SetFloat("minSize", minSize);
            mpb.SetFloat("maxSize", maxSize);
            mpb.SetFloat("BHSize", BHSize);
            mpb.SetFloat("NSSize", NSSize);
            mpb.SetFloat("WDSize", WDSize);
            mpb.SetFloat("NmlSize", NmlSize);
            mpb.SetTexture("colormap", colormap);

            for (int i = 0; i < instances[set]; i++)
            {
                Matrix4x4 matrix = new Matrix4x4();
                //matrix.SetTRS(Vector3.zero, Quaternion.Euler(Vector3.zero), Vector3.one);
                //THIS SETTING IS VERY IMPORTANT.  Instancing will only be active (and therefore the object will only be drawn) when the first Vector3 is within the camera's view.  For instance, if it is set to Vector3.zero, the Nbody particles will only be drawn when the scene's origin is in view of the camera!
                matrix.SetTRS(CameraTarget.position, Quaternion.Euler(Vector3.zero), Vector3.one);
                transformList[set][i] = matrix;
            }


            Graphics.DrawMeshInstanced(mesh, 0, DynamicsMaterial, transformList[set], instances[set], mpb);
            Graphics.DrawMeshInstanced(mesh, 0, HRMaterial, transformList[set], instances[set], mpb);
        }
    }
        void Update(Playable playable, FrameData info)
        {
            if (!Parent)
            {
                return;
            }

            var time = playable.GetTime();

            int index = Mathf.FloorToInt((float)(time * FPS)) % FrameIndices.Count;

            int currentIndex = FrameIndices[index];

            for (int i = 0; i < frameTransforms.Count; i++)
            {
                frameTransforms[i].gameObject.SetActive(i == currentIndex);
            }

            block.SetFloat("_FadeIn", info.effectiveWeight);
            block.SetFloat("_FadeOut", 1 /*info.effectiveWeight*/);
            block.SetInt("_FadeModeIn", (int)FadeIn);
            block.SetInt("_FadeModeOut", (int)FadeOut);
            foreach (var r in renderers)
            {
                r.SetPropertyBlock(block);
            }
        }
示例#13
0
        void SendDataToRenderer()
        {
            //TODO set only changed data to MPB
            if (_mpb == null)
            {
                _mpb = new MaterialPropertyBlock();
            }
            _renderer.GetPropertyBlock(_mpb);

            _mpb.SetTexture(_positionTexId, _vatAnimation.PositionsTex);
            _mpb.SetTexture(_rotattionTexId, _vatAnimation.RotationsTex);
            if (_vatAnimation.HighPrecisionPositionMode)
            {
                _mpb.SetTexture(_positionTexBId, _vatAnimation.PositionsTexB);
            }
            _mpb.SetInt(_highPrecisionMode, (_vatAnimation.HighPrecisionPositionMode) ? 1 : 0);
            _mpb.SetInt(_partsIdsInUV3Id, (_vatAnimation.PartsIdsInUV3) ? 1 : 0);

            _mpb.SetFloat(_stateId, _state);
            _mpb.SetInt(_partsCountId, _vatAnimation.PartsCount);
            _mpb.SetVector(_boundsCenterId, _vatAnimation.BoundsCenter);
            _mpb.SetVector(_boundsExtentsId, _vatAnimation.BoundsExtents);
            _mpb.SetVector(_startBoundsCenterId, _vatAnimation.StartBoundsCenter);
            _mpb.SetVector(_startBoundsExtentsId, _vatAnimation.StartBoundsExtents);

            _renderer.SetPropertyBlock(_mpb);
        }
示例#14
0
 private void SetupDesktop()
 {
     desktopUI.SetActive(true);
     sphereBlock.SetInt("_Watermark", 1);
     sphereBlock.SetFloat("_SceneStartTime", Time.time - 1);
     sR.SetPropertyBlock(sphereBlock);
 }
    private void CheckAndApplyPalette(ref SpriteRenderer renderer)
    {
        bool isPaletted = false;

        if (toClone.TryGetComponent(out ItemAttributesV2 prefabAttributes))
        {
            ItemsSprites sprites = prefabAttributes.ItemSprites;
            if (sprites.IsPaletted)
            {
                List <Color> palette = sprites.Palette;
                Debug.Assert(palette != null, "Palette must not be null on paletteable objects.");
                MaterialPropertyBlock block = new MaterialPropertyBlock();
                renderer.GetPropertyBlock(block);
                List <Vector4> pal = palette.ConvertAll((c) => new Vector4(c.r, c.g, c.b, c.a));
                block.SetVectorArray("_ColorPalette", pal);
                block.SetInt("_PaletteSize", pal.Count);
                block.SetInt("_IsPaletted", 1);
                renderer.SetPropertyBlock(block);

                isPaletted = true;
            }
        }

        if (!isPaletted)
        {
            renderer.material.SetInt("_IsPaletted", 0);
        }
    }
示例#16
0
        public override void WhileDebug()
        {
            mpb.SetBuffer("_VertBuffer", toIndex._buffer);
            mpb.SetBuffer("_TriBuffer", _buffer);
            mpb.SetInt("_Count", count);
            mpb.SetInt("_VertCount", toIndex.count);

            Graphics.DrawProcedural(debugMaterial, new Bounds(transform.position, Vector3.one * 5000), MeshTopology.Lines, (count - 1) * 2, 1, null, mpb, ShadowCastingMode.Off, true, LayerMask.NameToLayer("Debug"));
        }
示例#17
0
        void LateUpdate()
        {
            if (_colorMap == null || _positionMap == null)
            {
                return;
            }
            if (_baseMaterial == null)
            {
                return;
            }

            if (_props == null)
            {
                _props = new MaterialPropertyBlock();
            }

            if (_slitToAlpha >= 0.9999f || _sliderToAlpha > 0.9999f)
            {
                return;
            }

            var xc = _positionMap.width / 4;
            var yc = _positionMap.height / 4;

            var slit2a   = _slitToAlpha * _slitToAlpha;
            var slit2e   = _slitToEmission * _slitToEmission;
            var slider2a = _sliderToAlpha * _sliderToAlpha;
            var slider2e = _sliderToEmission * _sliderToEmission;

            _props.SetTexture("_BaseColorMap", _colorMap);
            _props.SetTexture("_PositionMap", _positionMap);

            _props.SetInt("_XCount", xc);
            _props.SetInt("_YCount", yc);

            _props.SetColor("_BaseColor", Color.white);
            _props.SetFloat("_Metallic", Mathf.Min(_metallic * 2, 1));
            _props.SetFloat("_Smoothness", _metallic * 0.8f);

            _props.SetFloat("_RcamHue", _hueRandomness);
            _props.SetVector("_RcamLine", _lineToAlpha, _lineToEmission);
            _props.SetVector("_RcamSlit", slit2a, slit2e);
            _props.SetVector("_RcamSlider", slider2a, slider2e);

            var tref = _sensorOrigin != null ? _sensorOrigin : transform;

            _props.SetMatrix("_LocalToWorld", tref.localToWorldMatrix);

            Graphics.DrawProcedural(
                _baseMaterial,
                new Bounds(Vector3.zero, Vector3.one * 1000),
                MeshTopology.Points, xc * yc, 1,
                null, _props,
                ShadowCastingMode.On, true, gameObject.layer
                );
        }
示例#18
0
 /// <summary>
 /// 重置Unit描边信息
 /// </summary>
 private void ResetUnitOutLineInfo(Unit targetUnit)
 {
     if (targetUnit != null)
     {
         UnityEngine.GameObject selfUnitGo = targetUnit.GameObject;
         selfUnitGo.GetRCInternalComponent <Renderer>("Materials").GetPropertyBlock(s_MaterialPropertyBlock);
         s_MaterialPropertyBlock.SetInt("OutLineWidth", 0);
         selfUnitGo.GetRCInternalComponent <Renderer>("Materials").SetPropertyBlock(s_MaterialPropertyBlock);
     }
 }
示例#19
0
        void UpdateMaterial()
        {
            if (_props == null)
            {
                _props = new MaterialPropertyBlock();
            }

            Debug.Log(DeviceController.ID.PositionMap);
            _props.SetTexture(DeviceController.ID.PositionMap, _device.PositionMap);
            _props.SetBuffer(ShaderID.rTriangles, this.trianglesBuffer);
            _props.SetBuffer(ShaderID.rPoints, this.pointsBuffer);
            _props.SetMatrix("_LocalToWorld", this.transform.localToWorldMatrix);


            this.triangleCounts = new int[] { 0, 1, 0, 0 };
            this.triangleCountsBuffer.SetData(this.triangleCounts);
            ComputeBuffer.CopyCount(this.pointsBuffer, triangleCountsBuffer, 0);
            this.triangleCountsBuffer.GetData(this.triangleCounts);

            Debug.Log("p: " + this.triangleCounts[0]);

            _props.SetInt("_PointCount", this.triangleCounts[0]);


            this.triangleCounts = new int[] { 0, 1, 0, 0 };
            this.triangleCountsBuffer.SetData(this.triangleCounts);
            ComputeBuffer.CopyCount(this.trianglesBuffer, triangleCountsBuffer, 0);
            this.triangleCountsBuffer.GetData(this.triangleCounts);

            Debug.Log("t: " + this.triangleCounts[0]);

/*
 *      Vector3Int[] tri = new Vector3Int[maxPointNum];
 *      this.trianglesBuffer.GetData(tri);
 *      for (int i = 0; i < 10; i++) {
 *          Debug.Log(tri[i]);
 *      }
 *      Vector2Int[] pp = new Vector2Int[maxPointNum];
 *      this.pointsBuffer.GetData(pp);
 *      for (int i = 0; i < 10; i++) {
 *          Debug.Log(pp[i]);
 *      }
 */

            _props.SetInt("_TriangleCount", this.triangleCounts[0]);


            Graphics.DrawProcedural(
                _material,
                new Bounds(this.transform.position, this.transform.lossyScale * 200),
                MeshTopology.Triangles, this.triangleCounts[0] * 3, 1,
                null, _props,
                ShadowCastingMode.TwoSided, true, this.gameObject.layer
                );
        }
示例#20
0
        public override void _WhileLiving(float v)
        {
            // List<int> indicies;
            int baseIndex;

            DoLiving(v);

            if (active)
            {
                if (mainMesh.subMeshCount != materials.Length)
                {
                    DebugThis("your mat count: " + materials.Length + "mesh mat count: " + mainMesh.subMeshCount);
                }
                else
                {
                    baseIndex = 0;

                    mpb.SetInt("_VertCount", verts.count);
                    mpb.SetBuffer("_VertBuffer", verts._buffer);
                    mpb.SetBuffer("_TriBuffer", triangles._buffer);

                    for (int i = 0; i < mainMesh.subMeshCount; i++)
                    {
                        MaterialPropertyBlock mpb1 = new MaterialPropertyBlock();

                        mpb1.SetInt("_VertCount", verts.count);
                        mpb1.SetBuffer("_VertBuffer", verts._buffer);
                        mpb1.SetBuffer("_TriBuffer", triangles._buffer);

                        int[] indicies = mainMesh.GetIndices(i);

                        mpb1.SetInt("_BaseID", baseIndex);
                        mpb1.SetInt("_SubMeshID", i);


                        // Infinit bounds so its always drawn!
                        Graphics.DrawProcedural(
                            materials[i],
                            new Bounds(transform.position, Vector3.one * 50000),
                            MeshTopology.Triangles,
                            indicies.Length,
                            1,
                            null,
                            mpb1,
                            ShadowCastingMode.TwoSided,
                            true,
                            gameObject.layer
                            );


                        baseIndex += indicies.Length;
                    }
                }
            }
        }
示例#21
0
 public bool Tick(float _deltaTime, MaterialPropertyBlock _block, out int curFrame, out int nextFrame, out float framePassed, Action <string> _onEvents = null)
 {
     if (!Tick(_deltaTime, out curFrame, out nextFrame, out framePassed, _onEvents))
     {
         return(false);
     }
     _block.SetInt(ID_FrameBegin, curFrame);
     _block.SetInt(ID_FrameEnd, nextFrame);
     _block.SetFloat(ID_FrameInterpolate, framePassed);
     return(true);
 }
示例#22
0
        static void _getShaderPassAndProps(Vector4 viewport, Matrix3 ctm, Paint paint, float alpha,
                                           out int pass, out MaterialPropertyBlock props)
        {
            props = new MaterialPropertyBlock();
            props.SetVector("_viewport", viewport);
            props.SetFloat("_alpha", alpha);

            switch (paint.shader)
            {
            case null:
                pass = 0;
                props.SetVector("_color", _colorToVector4(paint.color));
                return;

            case _LinearGradient linear:
                pass = 1;
                props.SetMatrix("_shaderMat", linear.getGradientMat(ctm).toMatrix4x4());
                props.SetTexture("_shaderTex", linear.gradientTex.texture);
                props.SetVector("_leftColor", _colorToVector4(linear.leftColor));
                props.SetVector("_rightColor", _colorToVector4(linear.rightColor));
                props.SetInt("_tileMode", (int)linear.tileMode);
                return;

            case _RadialGradient radial:
                pass = 2;
                props.SetMatrix("_shaderMat", radial.getGradientMat(ctm).toMatrix4x4());
                props.SetTexture("_shaderTex", radial.gradientTex.texture);
                props.SetVector("_leftColor", _colorToVector4(radial.leftColor));
                props.SetVector("_rightColor", _colorToVector4(radial.rightColor));
                props.SetInt("_tileMode", (int)radial.tileMode);
                return;

            case _SweepGradient sweep:
                pass = 3;
                props.SetMatrix("_shaderMat", sweep.getGradientMat(ctm).toMatrix4x4());
                props.SetTexture("_shaderTex", sweep.gradientTex.texture);
                props.SetVector("_leftColor", _colorToVector4(sweep.leftColor));
                props.SetVector("_rightColor", _colorToVector4(sweep.rightColor));
                props.SetInt("_tileMode", (int)sweep.tileMode);
                props.SetFloat("_bias", sweep.bias);
                props.SetFloat("_scale", sweep.scale);
                return;

            case ImageShader image:
                pass = 4;
                props.SetMatrix("_shaderMat", image.getShaderMat(ctm).toMatrix4x4());
                props.SetTexture("_shaderTex", image.image.texture);
                props.SetInt("_tileMode", (int)image.tileMode);
                return;

            default:
                throw new Exception("Unknown paint.shader: " + paint.shader);
            }
        }
示例#23
0
    public void UpdateMaterial()
    {
        MaterialPropertyBlock props = new MaterialPropertyBlock();

        props.SetInt("_TileX", X);
        props.SetInt("_TileY", Y);
        props.SetColor("_HighlightColor", _highlightColor);

        Renderer renderer = GetComponent <Renderer>();

        renderer.SetPropertyBlock(props);
    }
示例#24
0
 protected override void ShaderProperty(MaterialPropertyBlock property)
 {
     property.SetInt("_MosaicBlock", mosaicBlock);
     if (concentrated)
     {
         property.SetInt("_Concentrated", 1);
     }
     if (nega)
     {
         property.SetInt("_Nega", 1);
     }
     property.SetFloat("_NegaIntensity", negaIntensity);
 }
示例#25
0
    void ApplyProperties()
    {
        if (propertyBlock == null)
        {
            propertyBlock = new MaterialPropertyBlock();
        }

        renderer_r = GetComponentInChildren <Renderer>();
        propertyBlock.SetInt("_Color", iColorTheme);
        propertyBlock.SetInt("_WallpaperNumber", ReturnOrnamentRow(iOrnamentTheme));
        propertyBlock.SetInt("_WallpaperRow", ReturnOrnamentColumn(iOrnamentTheme));
        renderer_r.SetPropertyBlock(propertyBlock);
    }
示例#26
0
        public override void WhileDebug()
        {
            lineMPB.SetBuffer("_VertBuffer", _buffer);
            lineMPB.SetInt("_Count", count);
            lineMPB.SetInt("_NumVertsPerHair", numVertsPerHair);
            Graphics.DrawProcedural(lineDebugMaterial, new Bounds(transform.position, Vector3.one * 50000), MeshTopology.Lines, count * 2, 1, null, mpb, ShadowCastingMode.Off, true, LayerMask.NameToLayer("Debug"));


            mpb.SetBuffer("_VertBuffer", _buffer);
            mpb.SetInt("_Count", count);
            Graphics.DrawProcedural(debugMaterial, new Bounds(transform.position, Vector3.one * 50000), MeshTopology.Triangles, count * 3 * 2, 1, null, mpb, ShadowCastingMode.Off, true, LayerMask.NameToLayer("Debug"));

            //  Graphics.DrawProceduralNow(MeshTopology.Triangles, count  * 2 );
        }
示例#27
0
    public override void WhileDebug()
    {
        if (mpb == null)
        {
            mpb = new MaterialPropertyBlock();
        }

        mpb.SetBuffer("_VertBuffer", form._buffer);
        mpb.SetInt("_Count", form.count);
        mpb.SetInt("_CountMultiplier", countMultiplier);
        mpb.SetInt("_VertsPerVert", vertsPerVert);

        Graphics.DrawProcedural(material, new Bounds(transform.position, Vector3.one * 5000), MeshTopology.Triangles, form.count * countMultiplier * 3 * 2, 1, null, mpb, ShadowCastingMode.Off, true, LayerMask.NameToLayer("Debug"));
    }
示例#28
0
 public void GetMipMap(RenderTexture depthMipTexture, CommandBuffer buffer)
 {
     for (int i = 1; i < 8; ++i)
     {
         block.SetTexture(ShaderIDs._MainTex, depthMipTexture);
         block.SetInt(ShaderIDs._PreviousLevel, i - 1);
         buffer.SetRenderTarget(backupMip, i);
         buffer.DrawMesh(GraphicsUtility.mesh, Matrix4x4.identity, getLodMat, 0, 0, block);
         block.SetTexture(ShaderIDs._MainTex, backupMip);
         block.SetInt(ShaderIDs._PreviousLevel, i);
         buffer.SetRenderTarget(depthMipTexture, i);
         buffer.DrawMesh(GraphicsUtility.mesh, Matrix4x4.identity, getLodMat, 0, 0, block);
     }
 }
示例#29
0
 void UpdatePropertyBlock()
 {
     if (propertyBlock == null)
     {
         propertyBlock = new MaterialPropertyBlock();
     }
     propertyBlock.SetInt(COLUMN_PROPERTY, tileData.column);
     propertyBlock.SetInt(ROW_PROPERTY, tileData.row);
     propertyBlock.SetColor(COLOR_PROPERTY, tileData.color);
     propertyBlock.SetVector(OFFSET_PROPERTY, new Vector4(tileData.offset.x, tileData.offset.y));
     propertyBlock.SetFloat(ANGLE_PROPERTY, tileData.angle);
     propertyBlock.SetFloat(HORIZONTAL_FLIP_PROPERTY, tileData.horizontalFlip ? 1 : 0);
     renderer.SetPropertyBlock(propertyBlock);
 }
示例#30
0
        public void ToggleWatermark()
        {
            sR.GetPropertyBlock(sphereBlock);
            var curr = sphereBlock.GetInt("_Watermark");

            if (curr == 1)
            {
                sphereBlock.SetInt("_Watermark", 0);
            }
            else
            {
                sphereBlock.SetInt("_Watermark", 1);
            }
            sR.SetPropertyBlock(sphereBlock);
        }