示例#1
0
 /// <summary>
 /// Deserialize
 /// </summary>
 /// <param name="binaryReader">BinaryReader</param>
 public override void Deserialize(BinaryReader binaryReader)
 {
     base.Deserialize(binaryReader);
     m_bounds      = SerializerKun.DesirializeObject <BoundsKun>(binaryReader);
     contactOffset = binaryReader.ReadSingle();
     enabled       = binaryReader.ReadBoolean();
     isTrigger     = binaryReader.ReadBoolean();
     material      = binaryReader.ReadString();
 }
        /// <summary>
        /// Deserialize
        /// </summary>
        /// <param name="binaryReader">BinaryReader</param>
        public override void Deserialize(BinaryReader binaryReader)
        {
            base.Deserialize(binaryReader);

            m_sharedMesh = binaryReader.ReadString();
            m_quality    = (SkinQuality)binaryReader.ReadInt32();
            m_forceMatrixRecalculationPerRender = binaryReader.ReadBoolean();
            m_skinnedMotionVectors = binaryReader.ReadBoolean();
            m_updateWhenOffscreen  = binaryReader.ReadBoolean();
            m_localBounds          = SerializerKun.DesirializeObject <BoundsKun>(binaryReader);
            m_bones = SerializerKun.DesirializeObjects <TransformKun>(binaryReader);
        }
示例#3
0
 /// <summary>
 /// コンストラクタ
 /// </summary>
 /// <param name="collider">元となるColliderオブジェクト</param>
 public ColliderKun(Collider collider) : base(collider)
 {
     componentKunType = ComponentKunType.Collider;
     boundsKun        = new BoundsKun();
     material         = "None";
     if (collider != null)
     {
         boundsKun     = new BoundsKun(collider.bounds);
         contactOffset = collider.contactOffset;
         enabled       = collider.enabled;
         isTrigger     = collider.isTrigger;
         material      = collider.material.name;
     }
 }
示例#4
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);
        }
示例#5
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;
            }
        }