Skip to content

Commit 0dcd4fb

Browse files
committed
radiosity instance map
1 parent 298f43f commit 0dcd4fb

1 file changed

Lines changed: 61 additions & 0 deletions

File tree

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
using CathodeLib;
2+
using System;
3+
using System.Collections.Generic;
4+
using System.IO;
5+
using System.Runtime.InteropServices;
6+
using CathodeLib.Properties;
7+
8+
using System.Linq;
9+
10+
#if UNITY_EDITOR || UNITY_STANDALONE_WIN
11+
using UnityEngine;
12+
#else
13+
using System.Numerics;
14+
#endif
15+
16+
namespace CATHODE
17+
{
18+
/* DATA/ENV/PRODUCTION/x/RENDERABLE/RADIOSITY_INSTANCE_MAP.TXT */
19+
public class RadiosityInstanceMap : CathodeFile
20+
{
21+
public List<Entry> Entries = new List<Entry>();
22+
public static new Implementation Implementation = Implementation.LOAD | Implementation.SAVE | Implementation.CREATE;
23+
public RadiosityInstanceMap(string path) : base(path) { }
24+
25+
#region FILE_IO
26+
override protected bool LoadInternal()
27+
{
28+
string[] radiosityMappings = File.ReadAllLines(_filepath);
29+
foreach (string entry in radiosityMappings)
30+
{
31+
string[] mapping = entry.Split(' ');
32+
Entries.Add(new Entry()
33+
{
34+
lightmap_transform = Convert.ToInt32(mapping[0]),
35+
resource_index = Convert.ToInt32(mapping[1])
36+
});
37+
}
38+
return true;
39+
}
40+
41+
override protected bool SaveInternal()
42+
{
43+
List<string> radiosityMappings = new List<string>();
44+
foreach (Entry entry in Entries)
45+
{
46+
radiosityMappings.Add(entry.lightmap_transform + " " + entry.resource_index);
47+
}
48+
File.WriteAllLines(_filepath, radiosityMappings.ToArray());
49+
return true;
50+
}
51+
#endregion
52+
53+
#region STRUCTURES
54+
public class Entry
55+
{
56+
public int lightmap_transform;
57+
public int resource_index;
58+
}
59+
#endregion
60+
}
61+
}

0 commit comments

Comments
 (0)