コード例 #1
0
        void Update()
        {
            var enumer = drawDataDict.GetEnumerator();

            if (isInstanced)
            {
                while (enumer.MoveNext())
                {
                    DrawData data = enumer.Current.Value;

                    data.UpdateMatrix();
                    data.UpdateMaterialblcok();

                    Graphics.DrawMeshInstanced(
                        data.mesh,
                        0,
                        material,
                        data.mainMatrixList,
                        data.block,
                        castShadow ?
                        UnityEngine.Rendering.ShadowCastingMode.On :
                        UnityEngine.Rendering.ShadowCastingMode.Off,
                        receiveShadow,
                        drawLayerNumber,
                        drawCamera
                        );
                }
            }
            else
            {
                while (enumer.MoveNext())
                {
                    DrawData data = enumer.Current.Value;

                    data.UpdateMatrix();
                    data.UpdateMaterialblcok();

                    data.mainMatrixList.ForEach(
                        (matrix) =>
                    {
                        Graphics.DrawMesh(data.mesh, matrix, material, drawLayerNumber, drawCamera, 0, data.block);
                    }
                        );
                }
            }
        }