public void Read(AssetStream stream) { Stream = stream.ReadByte(); Offset = stream.ReadByte(); Format = (ChannelFormat)stream.ReadByte(); Dimension = stream.ReadByte(); }
public void Read(AssetStream stream) { BlobIndex = stream.ReadUInt32(); Channels.Read(stream); m_keywordIndices = stream.ReadUInt16Array(); if (IsAlignKeywordIndices(stream.Version)) { stream.AlignStream(AlignType.Align4); } ShaderHardwareTier = stream.ReadByte(); GpuProgramType = (ShaderGpuProgramType)stream.ReadByte(); stream.AlignStream(AlignType.Align4); m_vectorParams = stream.ReadArray <VectorParameter>(); m_matrixParams = stream.ReadArray <MatrixParameter>(); m_textureParams = stream.ReadArray <TextureParameter>(); m_bufferParams = stream.ReadArray <BufferBinding>(); m_constantBuffers = stream.ReadArray <ConstantBuffer>(); m_constantBufferBindings = stream.ReadArray <BufferBinding>(); m_UAVParams = stream.ReadArray <UAVParameter>(); if (IsReadSamplers(stream.Version)) { m_samplers = stream.ReadArray <SamplerParameter>(); } if (IsReadShaderRequirements(stream.Version)) { ShaderRequirements = stream.ReadInt32(); } }
public void Read(AssetStream stream) { NameIndex = stream.ReadInt32(); Index = stream.ReadInt32(); ArraySize = stream.ReadInt32(); Type = (ShaderParamType)stream.ReadByte(); RowCount = stream.ReadByte(); stream.AlignStream(AlignType.Align4); }
public void Read(AssetStream stream) { Start.Read(stream); End.Read(stream); Radius = stream.ReadSingle(); LinkType = stream.ReadUInt16(); Area = stream.ReadByte(); LinkDirection = stream.ReadByte(); }
public override void Read(AssetStream stream) { base.Read(stream); if (IsReadBodyType(stream.Version)) { BodyType = (RigidbodyType2D)stream.ReadInt32(); Simulated = stream.ReadBoolean(); UseFullKinematicContacts = stream.ReadBoolean(); } if (IsReadUseAutoMass(stream.Version)) { UseAutoMass = stream.ReadBoolean(); stream.AlignStream(AlignType.Align4); } Mass = stream.ReadSingle(); LinearDrag = stream.ReadSingle(); AngularDrag = stream.ReadSingle(); GravityScale = stream.ReadSingle(); if (IsReadMaterial(stream.Version)) { Material.Read(stream); } if (IsReadFixedAngle(stream.Version)) { bool fixedAngle = stream.ReadBoolean(); Constraints = fixedAngle ? RigidbodyConstraints2D.FreezeRotation : RigidbodyConstraints2D.None; } if (IsReadIsKinematic(stream.Version)) { bool isKinematic = stream.ReadBoolean(); BodyType = isKinematic ? RigidbodyType2D.Kinematic : RigidbodyType2D.Static; Interpolate = (RigidbodyInterpolation2D)stream.ReadByte(); SleepingMode = (RigidbodySleepMode2D)stream.ReadByte(); CollisionDetection = (CollisionDetectionMode2D)stream.ReadByte(); stream.AlignStream(AlignType.Align4); } if (IsReadInterpolate(stream.Version)) { Interpolate = (RigidbodyInterpolation2D)stream.ReadInt32(); SleepingMode = (RigidbodySleepMode2D)stream.ReadInt32(); CollisionDetection = (CollisionDetectionMode2D)stream.ReadInt32(); } if (!IsReadFixedAngle(stream.Version)) { Constraints = (RigidbodyConstraints2D)stream.ReadInt32(); } }
public void Read(AssetStream stream) { if (IsColor32(stream.Version)) { Key32_0.Read(stream); Key32_1.Read(stream); Key32_2.Read(stream); Key32_3.Read(stream); Key32_4.Read(stream); Key32_5.Read(stream); Key32_6.Read(stream); Key32_7.Read(stream); } else { Key0.Read(stream); Key1.Read(stream); Key2.Read(stream); Key3.Read(stream); Key4.Read(stream); Key5.Read(stream); Key6.Read(stream); Key7.Read(stream); } Ctime0 = stream.ReadUInt16(); Ctime1 = stream.ReadUInt16(); Ctime2 = stream.ReadUInt16(); Ctime3 = stream.ReadUInt16(); Ctime4 = stream.ReadUInt16(); Ctime5 = stream.ReadUInt16(); Ctime6 = stream.ReadUInt16(); Ctime7 = stream.ReadUInt16(); Atime0 = stream.ReadUInt16(); Atime1 = stream.ReadUInt16(); Atime2 = stream.ReadUInt16(); Atime3 = stream.ReadUInt16(); Atime4 = stream.ReadUInt16(); Atime5 = stream.ReadUInt16(); Atime6 = stream.ReadUInt16(); Atime7 = stream.ReadUInt16(); if (IsReadMode(stream.Version)) { Mode = stream.ReadInt32(); } NumColorKeys = stream.ReadByte(); NumAlphaKeys = stream.ReadByte(); stream.AlignStream(AlignType.Align4); }
public override void Read(AssetStream stream) { base.Read(stream); Mass = stream.ReadSingle(); Drag = stream.ReadSingle(); AngularDrag = stream.ReadSingle(); UseGravity = stream.ReadBoolean(); IsKinematic = stream.ReadBoolean(); if (IsReadInterpolate(stream.Version)) { Interpolate = (RigidbodyInterpolation)stream.ReadByte(); if (IsAlign(stream.Version)) { stream.AlignStream(AlignType.Align4); } } if (IsReadFreezeRotation(stream.Version)) { bool freezeRotation = stream.ReadBoolean(); Constraints = freezeRotation ? RigidbodyConstraints.FreezeRotation : RigidbodyConstraints.None; } else { Constraints = (RigidbodyConstraints)stream.ReadInt32(); } if (IsReadCollisionDetection(stream.Version)) { CollisionDetection = (CollisionDetectionMode)stream.ReadInt32(); } }
public override void Read(AssetStream stream) { base.Read(stream); IsEnabled = stream.ReadByte(); stream.AlignStream(AlignType.Align4); }
public void Read(AssetStream stream) { ChannelMask = stream.ReadUInt32(); Offset = stream.ReadUInt32(); if (IsReadAlign(stream.Version)) { Stride = stream.ReadUInt32(); Align = stream.ReadUInt32(); } else { Stride = stream.ReadByte(); DividerOp = stream.ReadByte(); Frequency = stream.ReadUInt16(); } }
public void Read(AssetStream stream) { NumItems = stream.ReadUInt32(); m_data = stream.ReadByteArray(); stream.AlignStream(AlignType.Align4); BitSize = stream.ReadByte(); stream.AlignStream(AlignType.Align4); }
public void OnButtonStreamRead1() { if (_stream == null) { _stream = new AssetStream(TEST_FILE); } char data = (char)_stream.ReadByte(); result.text += data; }
public override void Read(AssetStream stream) { base.Read(stream); if (IsReadType(stream.Version)) { Type = stream.ReadInt32(); } RateOverTime.Read(stream); if (IsReadRateOverDistance(stream.Version)) { RateOverDistance.Read(stream); } if (IsReadCnt(stream.Version)) { Cnt0 = IsIntCount(stream.Version) ? stream.ReadInt32() : stream.ReadUInt16(); Cnt1 = IsIntCount(stream.Version) ? stream.ReadInt32() : stream.ReadUInt16(); Cnt2 = IsIntCount(stream.Version) ? stream.ReadInt32() : stream.ReadUInt16(); Cnt3 = IsIntCount(stream.Version) ? stream.ReadInt32() : stream.ReadUInt16(); } if (IsReadCntMax(stream.Version)) { CntMax0 = IsIntCount(stream.Version) ? stream.ReadInt32() : stream.ReadUInt16(); CntMax1 = IsIntCount(stream.Version) ? stream.ReadInt32() : stream.ReadUInt16(); CntMax2 = IsIntCount(stream.Version) ? stream.ReadInt32() : stream.ReadUInt16(); CntMax3 = IsIntCount(stream.Version) ? stream.ReadInt32() : stream.ReadUInt16(); } if (IsReadTime(stream.Version)) { Time0 = stream.ReadSingle(); Time1 = stream.ReadSingle(); Time2 = stream.ReadSingle(); Time3 = stream.ReadSingle(); } if (IsIntCount(stream.Version)) { BurstCount = stream.ReadInt32(); } else { BurstCount = stream.ReadByte(); } stream.AlignStream(AlignType.Align4); if (IsReadBursts(stream.Version)) { m_bursts = stream.ReadArray <ParticleSystemEmissionBurst>(); } }
public void Read(AssetStream stream) { Path = stream.ReadUInt32(); Attribute = stream.ReadUInt32(); Script.Read(stream); if (IsInt32ID(stream.Version)) { ClassID = (ClassIDType)stream.ReadInt32(); } else { ClassID = (ClassIDType)stream.ReadUInt16(); } CustomType = stream.ReadByte(); IsPPtrCurve = stream.ReadByte(); if (IsAlign(stream.Version)) { stream.AlignStream(AlignType.Align4); } }
public void Read(AssetStream stream) { NameIndex = stream.ReadInt32(); Index = stream.ReadInt32(); SamplerIndex = stream.ReadInt32(); if (IsReadMultiSampled(stream.Version)) { MultiSampled = stream.ReadBoolean(); } Dim = stream.ReadByte(); stream.AlignStream(AlignType.Align4); }
public override void Read(AssetStream stream) { base.Read(stream); if (IsReadAlpha(stream.Version)) { Alpha = stream.ReadSingle(); } RenderMode = (RenderMode)stream.ReadInt32(); Camera.Read(stream); if (IsReadNormals(stream.Version)) { Normals = stream.ReadBoolean(); PositionUVs = stream.ReadBoolean(); } if (IsReadPlaneDistance(stream.Version)) { PlaneDistance = stream.ReadSingle(); } PixelPerfect = stream.ReadBoolean(); if (IsReadRecievesEvents(stream.Version)) { RecievesEvents = stream.ReadBoolean(); OverrideSorting = stream.ReadBoolean(); OverridePixelPerfect = stream.ReadBoolean(); if (IsReadSortingBucketNormalizedSize(stream.Version)) { SortingBucketNormalizedSize = stream.ReadSingle(); } if (IsReadAdditionalShaderChannelsFlag(stream.Version)) { AdditionalShaderChannelsFlag = stream.ReadInt32(); } stream.AlignStream(AlignType.Align4); SortingLayerID = stream.ReadInt32(); SortingOrder = stream.ReadInt16(); } if (IsReadTargetDisplay(stream.Version)) { TargetDisplay = stream.ReadByte(); } }
public void Read(AssetStream stream) { Source = (ShaderChannel)stream.ReadByte(); Target = (VertexComponent)stream.ReadByte(); }
public override void Read(AssetStream stream) { base.Read(stream); if (IsReadLODData(stream.Version)) { m_LODData = stream.ReadArray <LOD>(); } if (IsReadIndicesUsage(stream.Version)) { Use16bitIndices = stream.ReadInt32() > 0; } if (IsReadIndexBuffer(stream.Version)) { if (IsReadIndexBufferFirst(stream.Version)) { m_indexBuffer = stream.ReadByteArray(); stream.AlignStream(AlignType.Align4); } } if (IsReadSubMeshes(stream.Version)) { m_subMeshes = stream.ReadArray <SubMesh>(); } if (IsReadBlendShapes(stream.Version)) { Shapes.Read(stream); } if (IsReadBindPosesFirst(stream.Version)) { m_bindPoses = stream.ReadArray <Matrix4x4f>(); } if (IsReadBoneNameHashes(stream.Version)) { m_boneNameHashes = stream.ReadUInt32Array(); RootBoneNameHash = stream.ReadUInt32(); } if (IsReadMeshCompression(stream.Version)) { MeshCompression = stream.ReadByte(); } if (IsReadStreamCompression(stream.Version)) { StreamCompression = stream.ReadByte(); } if (IsReadIsReadable(stream.Version)) { IsReadable = stream.ReadBoolean(); KeepVertices = stream.ReadBoolean(); KeepIndices = stream.ReadBoolean(); } if (IsAlign(stream.Version)) { stream.AlignStream(AlignType.Align4); } if (IsReadIndexFormat(stream.Version)) { if (IsReadIndexFormatCondition(stream.Version)) { if (MeshCompression == 0) { IndexFormat = stream.ReadInt32(); } } else { IndexFormat = stream.ReadInt32(); } } if (IsReadIndexBuffer(stream.Version)) { if (!IsReadIndexBufferFirst(stream.Version)) { m_indexBuffer = stream.ReadByteArray(); stream.AlignStream(AlignType.Align4); } } if (IsReadVertices(stream.Version)) { if (IsReadVertexData(stream.Version)) { if (MeshCompression != 0) { m_vertices = stream.ReadArray <Vector3f>(); } } else { m_vertices = stream.ReadArray <Vector3f>(); } } if (IsReadSkin(stream.Version)) { m_skin = stream.ReadArray <BoneWeights4>(); } if (IsReadBindPoses(stream.Version)) { if (!IsReadBindPosesFirst(stream.Version)) { m_bindPoses = stream.ReadArray <Matrix4x4f>(); } } if (IsReadVertexData(stream.Version)) { if (IsReadOnlyVertexData(stream.Version)) { VertexData.Read(stream); } else { if (MeshCompression == 0) { VertexData.Read(stream); } else { m_UV = stream.ReadArray <Vector2f>(); m_UV1 = stream.ReadArray <Vector2f>(); m_tangents = stream.ReadArray <Vector4f>(); m_normals = stream.ReadArray <Vector3f>(); m_colors = stream.ReadArray <ColorRGBA32>(); } } } else { m_UV = stream.ReadArray <Vector2f>(); if (IsReadUV1(stream.Version)) { m_UV1 = stream.ReadArray <Vector2f>(); } if (IsReadTangentSpace(stream.Version)) { m_tangentSpace = stream.ReadArray <Tangent>(); } else { m_tangents = stream.ReadArray <Vector4f>(); m_normals = stream.ReadArray <Vector3f>(); } } if (IsReadAlign(stream.Version)) { stream.AlignStream(AlignType.Align4); } if (IsReadCompressedMesh(stream.Version)) { CompressedMesh.Read(stream); } LocalAABB.Read(stream); if (IsReadColors(stream.Version)) { if (!IsReadVertexData(stream.Version)) { m_colors = stream.ReadArray <ColorRGBA32>(); } } if (IsReadCollisionTriangles(stream.Version)) { m_collisionTriangles = stream.ReadUInt32Array(); CollisionVertexCount = stream.ReadInt32(); } if (IsReadMeshUsageFlags(stream.Version)) { MeshUsageFlags = stream.ReadInt32(); } if (IsReadCollision(stream.Version)) { CollisionData.Read(stream); } if (IsReadMeshMetrics(stream.Version)) { m_meshMetrics = new float[2]; m_meshMetrics[0] = stream.ReadSingle(); m_meshMetrics[1] = stream.ReadSingle(); } }
public override void Read(AssetStream stream) { base.Read(stream); Enabled = stream.ReadBoolean(); if (IsAlignEnabled(stream.Version)) { stream.AlignStream(AlignType.Align4); } CastShadows = stream.ReadByte(); ReceiveShadows = stream.ReadByte(); if (IsAlignEnabled(stream.Version)) { stream.AlignStream(AlignType.Align4); } if (IsReadMotionVector(stream.Version)) { MotionVectors = stream.ReadByte(); LightProbeUsage = stream.ReadByte(); ReflectionProbeUsage = stream.ReadByte(); stream.AlignStream(AlignType.Align4); } if (IsReadRenderingLayerMask(stream.Version)) { RenderingLayerMask = stream.ReadUInt32(); } if (IsReadLightmapIndex(stream.Version)) { LightmapIndex = IsByteLightIndex(stream.Version) ? stream.ReadByte() : stream.ReadUInt16(); } if (IsReadLightDynamic(stream.Version)) { LightmapIndexDynamic = stream.ReadUInt16(); } if (IsReadMaterialFirst(stream.Version)) { m_materials = stream.ReadArray <PPtr <Material> >(); } if (IsReadTileOffset(stream.Version)) { LightmapTilingOffset.Read(stream); } if (IsReadTileDynamic(stream.Version)) { LightmapTilingOffsetDynamic.Read(stream); } if (!IsReadMaterialFirst(stream.Version)) { m_materials = stream.ReadArray <PPtr <Material> >(); } if (IsReadSubsetIndices(stream.Version)) { m_subsetIndices = stream.ReadUInt32Array(); } if (IsReadStaticBatchInfo(stream.Version)) { StaticBatchInfo.Read(stream); } if (IsReadStaticBatchRoot(stream.Version)) { StaticBatchRoot.Read(stream); } if (IsReadUseLight(stream.Version)) { UseLightProbes = stream.ReadBoolean(); stream.AlignStream(AlignType.Align4); } if (IsReadReflectUsage(stream.Version)) { ReflectionProbeUsage = stream.ReadInt32(); } if (IsReadProbeAnchor(stream.Version)) { ProbeAnchor.Read(stream); } if (IsReadLightOverride(stream.Version)) { LightProbeVolumeOverride.Read(stream); } if (IsAlignLightProbe(stream.Version)) { stream.AlignStream(AlignType.Align4); } if (IsReadSortingLayerID(stream.Version)) { SortingLayerID = stream.ReadInt32(); } if (IsReadSortingLayer(stream.Version)) { SortingLayer = stream.ReadInt16(); } if (IsReadSortingOrder(stream.Version)) { SortingOrder = stream.ReadInt16(); } if (IsAlignSortingOrder(stream.Version)) { stream.AlignStream(AlignType.Align4); } }
public void Read(AssetStream stream) { switch (Type.Type) { case PrimitiveType.Bool: if (IsArray) { Value = stream.ReadBooleanArray(); } else { Value = stream.ReadBoolean(); } stream.AlignStream(AlignType.Align4); break; case PrimitiveType.Byte: if (IsArray) { Value = stream.ReadByteArray(); } else { Value = stream.ReadByte(); } stream.AlignStream(AlignType.Align4); break; case PrimitiveType.Char: if (IsArray) { Value = stream.ReadCharArray(); } else { Value = stream.ReadChar(); } stream.AlignStream(AlignType.Align4); break; case PrimitiveType.Short: if (IsArray) { Value = stream.ReadInt16Array(); } else { Value = stream.ReadInt16(); } stream.AlignStream(AlignType.Align4); break; case PrimitiveType.UShort: if (IsArray) { Value = stream.ReadUInt16Array(); } else { Value = stream.ReadUInt16(); } stream.AlignStream(AlignType.Align4); break; case PrimitiveType.Int: if (IsArray) { Value = stream.ReadInt32Array(); } else { Value = stream.ReadInt32(); } break; case PrimitiveType.UInt: if (IsArray) { Value = stream.ReadUInt32Array(); } else { Value = stream.ReadUInt32(); } break; case PrimitiveType.Long: if (IsArray) { Value = stream.ReadInt64Array(); } else { Value = stream.ReadInt64(); } break; case PrimitiveType.ULong: if (IsArray) { Value = stream.ReadUInt64Array(); } else { Value = stream.ReadUInt64(); } break; case PrimitiveType.Single: if (IsArray) { Value = stream.ReadSingleArray(); } else { Value = stream.ReadSingle(); } break; case PrimitiveType.Double: if (IsArray) { Value = stream.ReadDoubleArray(); } else { Value = stream.ReadDouble(); } break; case PrimitiveType.String: if (IsArray) { Value = stream.ReadStringArray(); } else { Value = stream.ReadStringAligned(); } break; case PrimitiveType.Complex: if (IsArray) { int count = stream.ReadInt32(); IScriptStructure[] structures = new IScriptStructure[count]; for (int i = 0; i < count; i++) { IScriptStructure structure = Type.ComplexType.CreateCopy(); structure.Read(stream); structures[i] = structure; } Value = structures; } else { IScriptStructure structure = Type.ComplexType.CreateCopy(); structure.Read(stream); Value = structure; } break; default: throw new NotImplementedException($"Unknown {nameof(PrimitiveType)} '{Type.Type}'"); } }
public void Read(AssetStream stream) { Flags = stream.ReadByte(); stream.AlignStream(AlignType.Align4); }