forked from alvani/Unity-glTF-Exporter
-
Notifications
You must be signed in to change notification settings - Fork 14
/
GlTF_Program.cs
36 lines (33 loc) · 948 Bytes
/
GlTF_Program.cs
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
33
34
35
36
#if UNITY_EDITOR
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class GlTF_Program : GlTF_Writer {
public List<string> attributes = new List<string>();
public string vertexShader = "";
public string fragmentShader = "";
public static string GetNameFromObject(Object o)
{
return "program_" + GlTF_Writer.GetNameFromObject(o);
}
public override void Write()
{
Indent(); jsonWriter.Write ("{\n");
IndentIn();
Indent(); jsonWriter.Write ("\"attributes\": [\n");
IndentIn();
foreach (var a in attributes)
{
CommaNL();
Indent(); jsonWriter.Write ("\"" + a + "\"");
}
jsonWriter.Write ("\n");
IndentOut();
Indent(); jsonWriter.Write ("],\n");
Indent(); jsonWriter.Write ("\"vertexShader\": \"" + vertexShader + "\",\n");
Indent(); jsonWriter.Write ("\"fragmentShader\": \"" + fragmentShader + "\"\n");
IndentOut();
Indent(); jsonWriter.Write ("}");
}
}
#endif