public void Read(AssetReader reader) { Texture.Read(reader); if (IsReadAlphaTexture(reader.Version)) { AlphaTexture.Read(reader); } if (IsReadSecondaryTextures(reader.Version)) { m_secondaryTextures = reader.ReadAssetArray <SecondarySpriteTexture>(); } if (IsReadVertices(reader.Version)) { m_vertices = reader.ReadAssetArray <SpriteVertex>(); m_indices = reader.ReadUInt16Array(); reader.AlignStream(AlignType.Align4); } else { m_subMeshes = reader.ReadAssetArray <SubMesh>(); m_indexBuffer = reader.ReadByteArray(); reader.AlignStream(AlignType.Align4); VertexData.Read(reader); } if (IsReadBindpose(reader.Version)) { m_bindpose = reader.ReadAssetArray <Matrix4x4f>(); } if (IsReadSourceSkin(reader.Version)) { m_sourceSkin = reader.ReadAssetArray <BoneWeights4>(); } TextureRect.Read(reader); TextureRectOffset.Read(reader); if (IsReadAtlasRectOffset(reader.Version)) { AtlasRectOffset.Read(reader); } SettingsRaw = reader.ReadUInt32(); if (IsReadUVTransform(reader.Version)) { UVTransform.Read(reader); } if (IsReadDownscaleMultiplier(reader.Version)) { DownscaleMultiplier = reader.ReadSingle(); } }
public YAMLNode ExportYAML(IExportContainer container) { YAMLMappingNode node = new YAMLMappingNode(); node.Add(TextureName, Texture.ExportYAML(container)); node.Add(AlphaTextureName, AlphaTexture.ExportYAML(container)); node.Add(TextureRectName, TextureRect.ExportYAML(container)); node.Add(TextureRectOffsetName, TextureRectOffset.ExportYAML(container)); node.Add(AtlasRectOffsetName, AtlasRectOffset.ExportYAML(container)); node.Add(UVTransformName, UVTransform.ExportYAML(container)); node.Add(DownscaleMultiplierName, DownscaleMultiplier); node.Add(SettingsRawName, SettingsRaw); return(node); }
public void Read(AssetReader reader) { Texture.Read(reader); AlphaTexture.Read(reader); TextureRect.Read(reader); TextureRectOffset.Read(reader); if (HasAtlasRectOffset(reader.Version)) { AtlasRectOffset.Read(reader); } UVTransform.Read(reader); DownscaleMultiplier = reader.ReadSingle(); SettingsRaw = reader.ReadUInt32(); }
public void Read(AssetStream stream) { Texture.Read(stream); AlphaTexture.Read(stream); Texture.Read(stream); TextureRectOffset.Read(stream); if (IsReadAtlasRectOffset(stream.Version)) { AtlasRectOffset.Read(stream); } UVTransform.Read(stream); DownscaleMultiplier = stream.ReadSingle(); SettingsRaw = stream.ReadUInt32(); }
public void Write(AssetsWriter writer) { Texture.Write(writer); AlphaTexture.Write(writer); writer.WriteArrayOf(SubMeshes, (o, w) => o.Write(w)); writer.WriteArray(IndexBuffer); writer.AlignTo(4); VertexData.Write(writer); writer.WriteArrayOf(BindPose, (o, w) => w.Write(o)); TextureRect.Write(writer); TextureRectOffset.Write(writer); AtlasRectOffset.Write(writer); writer.Write(SettingsRaw); UVTransform.Write(writer); writer.Write(DownscaleMultiplier); }
public void Read(AssetStream stream) { Texture.Read(stream); if (IsReadAlphaTexture(stream.Version)) { AlphaTexture.Read(stream); } if (IsReadVertices(stream.Version)) { m_vertices = stream.ReadArray <SpriteVertex>(); m_indices = stream.ReadUInt16Array(); stream.AlignStream(AlignType.Align4); } else { m_subMeshes = stream.ReadArray <SubMesh>(); m_indexBuffer = stream.ReadByteArray(); stream.AlignStream(AlignType.Align4); VertexData.Read(stream); } if (IsReadBindpose(stream.Version)) { m_bindpose = stream.ReadArray <Matrix4x4f>(); } if (IsReadSourceSkin(stream.Version)) { m_sourceSkin = stream.ReadArray <BoneWeights4>(); } TextureRect.Read(stream); TextureRectOffset.Read(stream); if (IsReadAtlasRectOffset(stream.Version)) { AtlasRectOffset.Read(stream); } SettingsRaw = stream.ReadUInt32(); if (IsReadUVTransform(stream.Version)) { UVTransform.Read(stream); } if (IsReadDownscaleMultiplier(stream.Version)) { DownscaleMultiplier = stream.ReadSingle(); } }
public IEnumerable <Object> FetchDependencies(ISerializedFile file, bool isLog = false) { yield return(Texture.FetchDependency(file, isLog, () => nameof(SpriteRenderData), "Texture")); yield return(AlphaTexture.FetchDependency(file, isLog, () => nameof(SpriteRenderData), "AlphaTexture")); if (IsReadSecondaryTextures(file.Version)) { foreach (SecondarySpriteTexture secondaryTexture in SecondaryTextures) { foreach (Object asset in secondaryTexture.FetchDependencies(file, isLog)) { yield return(asset); } } } }
public IEnumerable <Object> FetchDependencies(ISerializedFile file, bool isLog = false) { yield return(Texture.FetchDependency(file, isLog, () => nameof(SpriteRenderData), "Texture")); yield return(AlphaTexture.FetchDependency(file, isLog, () => nameof(SpriteRenderData), "AlphaTexture")); }
public bool Use() { var prg = GetShaderProgram(); if (lastUserProgram == null) { lastUserProgram = ShaderProgram.Current; } ShaderProgram.SwitchResult res = prg.Use(); //prg.SetUniform("MaterialIndex", BufferOffset); prg.SetUniform("IsTessellatedTerrain", Type == MaterialType.TessellatedTerrain); prg.SetUniform("TessellationMultiplier", TessellationMultiplier); prg.SetUniform("InvertUVy", InvertUVy); prg.SetUniform("IsBillboard", IsBillboard); prg.SetUniform("SpecularColor", SpecularColor); prg.SetUniform("DiffuseColor", DiffuseColor); prg.SetUniform("ParallaxHeightMultiplier", ParallaxHeightMultiplier); prg.SetUniform("Roughness", Roughness); prg.SetUniform("Alpha", Alpha); prg.SetUniform("NormalTexEnabled", NormalsTexture != null); prg.SetUniform("BumpTexEnabled", BumpTexture != null); prg.SetUniform("AlphaTexEnabled", AlphaTexture != null); prg.SetUniform("RoughnessTexEnabled", RoughnessTexture != null); prg.SetUniform("DiffuseTexEnabled", DiffuseTexture != null); prg.SetUniform("SpecularTexEnabled", SpecularTexture != null); if (NormalsTexture != null) { NormalsTexture.Use(prg.getConstInt("normalsTexBind")); } if (BumpTexture != null) { BumpTexture.Use(prg.getConstInt("bumpTexBind")); } if (AlphaTexture != null) { AlphaTexture.Use(prg.getConstInt("alphaTexBind")); } if (RoughnessTexture != null) { RoughnessTexture.Use(prg.getConstInt("roughnessTexBind")); } if (DiffuseTexture != null) { DiffuseTexture.Use(prg.getConstInt("diffuseTexBind")); } if (SpecularTexture != null) { SpecularTexture.Use(prg.getConstInt("specularTexBind")); } return(true); }