/// <summary>
        /// コンストラクタ
        /// </summary>
        /// <param name="component"></param>
        public SkinnedMeshRendererKun(Component component) : base(component)
        {
            componentKunType = ComponentKunType.SkinnedMeshMeshRenderer;
            m_sharedMesh     = "";

            var skinnedMeshRenderer = component as SkinnedMeshRenderer;

            if (skinnedMeshRenderer)
            {
                if (skinnedMeshRenderer.bones != null)
                {
                    bones = new TransformKun[skinnedMeshRenderer.bones.Length];
                    for (var i = 0; i < bones.Length; i++)
                    {
                        bones[i] = new TransformKun(skinnedMeshRenderer.bones[i]);
                    }
                }
                forceMatrixRecalculationPerRender = skinnedMeshRenderer.forceMatrixRecalculationPerRender;
                localBounds          = skinnedMeshRenderer.localBounds;
                quality              = skinnedMeshRenderer.quality;
                sharedMesh           = skinnedMeshRenderer.sharedMesh.ToString();
                skinnedMotionVectors = skinnedMeshRenderer.skinnedMotionVectors;
                updateWhenOffscreen  = skinnedMeshRenderer.updateWhenOffscreen;
            }
        }
Esempio n. 2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="binaryReader"></param>
        public override void Deserialize(BinaryReader binaryReader)
        {
            base.Deserialize(binaryReader);

#if UNITY_2019_1_OR_NEWER
            m_forceRenderingOff = binaryReader.ReadBoolean();
            m_rayTracingMode    = (UnityEngine.Experimental.Rendering.RayTracingMode)binaryReader.ReadInt32();
#endif
            m_lightProbeUsage            = (UnityEngine.Rendering.LightProbeUsage)binaryReader.ReadInt32();
            m_motionVectorGenerationMode = (MotionVectorGenerationMode)binaryReader.ReadInt32();
            m_reflectionProbeUsage       = (UnityEngine.Rendering.ReflectionProbeUsage)binaryReader.ReadInt32();
            m_shadowCastingMode          = (UnityEngine.Rendering.ShadowCastingMode)binaryReader.ReadInt32();
            m_lightmapIndex                 = binaryReader.ReadInt32();
            m_rendererPriority              = binaryReader.ReadInt32();
            m_realtimeLightmapIndex         = binaryReader.ReadInt32();
            m_sortingLayerID                = binaryReader.ReadInt32();
            m_sortingOrder                  = binaryReader.ReadInt32();
            m_renderingLayerMask            = binaryReader.ReadUInt32();
            m_lightProbeProxyVolumeOverride = binaryReader.ReadString();
            m_sortingLayerName              = binaryReader.ReadString();
            m_receiveShadows                = binaryReader.ReadBoolean();
            m_allowOcclusionWhenDynamic     = binaryReader.ReadBoolean();
            m_enabled             = binaryReader.ReadBoolean();
            m_isPartOfStaticBatch = binaryReader.ReadBoolean();
            m_isVisible           = binaryReader.ReadBoolean();
            m_bounds                      = SerializerKun.DesirializeObject <BoundsKun>(binaryReader);
            m_probeAnchor                 = SerializerKun.DesirializeObject <TransformKun>(binaryReader);
            m_lightmapScaleOffset         = SerializerKun.DesirializeObject <Vector4Kun>(binaryReader);
            m_realtimeLightmapScaleOffset = SerializerKun.DesirializeObject <Vector4Kun>(binaryReader);
            m_localToWorldMatrix          = SerializerKun.DesirializeObject <Matrix4x4Kun>(binaryReader);
            m_worldToLocalMatrix          = SerializerKun.DesirializeObject <Matrix4x4Kun>(binaryReader);
            m_material                    = SerializerKun.DesirializeObject <MaterialKun>(binaryReader);
            m_sharedMaterial              = SerializerKun.DesirializeObject <MaterialKun>(binaryReader);
            m_materials                   = SerializerKun.DesirializeObjects <MaterialKun>(binaryReader);
            m_sharedMaterials             = SerializerKun.DesirializeObjects <MaterialKun>(binaryReader);
        }
Esempio n. 3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="component"></param>
        public RendererKun(Component component) : base(component)
        {
            componentKunType                = ComponentKunType.Renderer;
            m_bounds                        = new BoundsKun();
            m_lightmapScaleOffset           = new Vector4Kun();
            m_lightProbeProxyVolumeOverride = "";
            m_localToWorldMatrix            = new Matrix4x4Kun();
            m_probeAnchor                   = new TransformKun();
            m_realtimeLightmapScaleOffset   = new Vector4Kun();
            m_worldToLocalMatrix            = new Matrix4x4Kun();

            m_sortingLayerName = "";


            var renderer = component as Renderer;

            if (renderer)
            {
                #if UNITY_2019_1_OR_NEWER
                forceRenderingOff = renderer.forceRenderingOff;
                rayTracingMode    = renderer.rayTracingMode;
                #endif

                allowOcclusionWhenDynamic = renderer.allowOcclusionWhenDynamic;
                bounds  = renderer.bounds;
                enabled = renderer.enabled;

                isPartOfStaticBatch = renderer.isPartOfStaticBatch;
                isVisible           = renderer.isVisible;
                lightmapIndex       = renderer.lightmapIndex;
                lightmapScaleOffset = renderer.lightmapScaleOffset;
                if (renderer.lightProbeProxyVolumeOverride)
                {
                    lightProbeProxyVolumeOverride = renderer.lightProbeProxyVolumeOverride.ToString();
                }
                lightProbeUsage    = renderer.lightProbeUsage;
                localToWorldMatrix = renderer.localToWorldMatrix;
#if !UNITY_EDITOR
                if (renderer.material != null)
                {
                    material = new MaterialKun(renderer.material);
                }

                if (renderer.materials != null)
                {
                    materials = new MaterialKun[renderer.materials.Length];
                    for (var i = 0; i < renderer.materials.Length; i++)
                    {
                        materials[i] = new MaterialKun(renderer.materials[i]);
                    }
                }
#endif
                motionVectorGenerationMode = renderer.motionVectorGenerationMode;
                if (renderer.probeAnchor != null)
                {
                    probeAnchor = new TransformKun(renderer.probeAnchor);
                }

                realtimeLightmapIndex       = renderer.realtimeLightmapIndex;
                realtimeLightmapScaleOffset = renderer.realtimeLightmapScaleOffset;
                rendererPriority            = renderer.rendererPriority;
                renderingLayerMask          = renderer.renderingLayerMask;
                shadowCastingMode           = renderer.shadowCastingMode;
                sharedMaterial = new MaterialKun(renderer.sharedMaterial);
                if (renderer.sharedMaterials != null)
                {
                    sharedMaterials = new MaterialKun[renderer.sharedMaterials.Length];
                    for (var i = 0; i < renderer.sharedMaterials.Length; i++)
                    {
                        sharedMaterials[i] = new MaterialKun(renderer.sharedMaterials[i]);
                    }
                }
                sortingLayerID     = renderer.sortingLayerID;
                sortingLayerName   = renderer.sortingLayerName;
                sortingOrder       = renderer.sortingOrder;
                worldToLocalMatrix = renderer.worldToLocalMatrix;
            }
        }