-
Notifications
You must be signed in to change notification settings - Fork 68
Expand file tree
/
Copy pathTexture2D.cs
More file actions
32 lines (29 loc) · 1.15 KB
/
Texture2D.cs
File metadata and controls
32 lines (29 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
using UnityDataTools.FileSystem.TypeTreeReaders;
using System.Text.Json;
namespace UnityDataTools.Analyzer.SerializedObjects;
public class Texture2D
{
public string Name { get; init; }
public int StreamDataSize { get; init; }
public int Width { get; init; }
public int Height { get; init; }
public int ImageCount { get; init; }
public int Format { get; init; }
public int MipCount { get; init; }
public bool RwEnabled { get; init; }
private Texture2D() {}
public static Texture2D Read(RandomAccessReader reader)
{
return new Texture2D()
{
Name = reader["m_Name"].GetValue<string>(),
Width = reader["m_Width"].GetValue<int>(),
Height = reader["m_Height"].GetValue<int>(),
ImageCount = reader["m_ImageCount"].GetValue<int>(),
Format = reader["m_TextureFormat"].GetValue<int>(),
RwEnabled = reader["m_IsReadable"].GetValue<int>() != 0,
MipCount = reader["m_MipCount"].GetValue<int>(),
StreamDataSize = reader["image data"].GetArraySize() == 0 ? reader["m_StreamData"]["size"].GetValue<int>() : 0
};
}
}