Compare commits
18 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1ecf4c8c27 | ||
|
|
3dea2936d7 | ||
|
|
e4533b4ec3 | ||
|
|
9d87fead21 | ||
|
|
14bd7f9789 | ||
|
|
d02a4ea02e | ||
|
|
14829c5e1b | ||
|
|
ef29d220e0 | ||
|
|
14ec7c8259 | ||
|
|
9687f823fb | ||
|
|
bb36839774 | ||
|
|
b0114520a8 | ||
|
|
8a3af0bfba | ||
|
|
65a13e97c4 | ||
|
|
fe6b7760b0 | ||
|
|
b319e92b3e | ||
|
|
06b8fcea64 | ||
|
|
100238d232 |
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
|
|||||||
// You can specify all the values or you can default the Build and Revision Numbers
|
// You can specify all the values or you can default the Build and Revision Numbers
|
||||||
// by using the '*' as shown below:
|
// by using the '*' as shown below:
|
||||||
// [assembly: AssemblyVersion("1.0.*")]
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
[assembly: AssemblyVersion("0.7.0.0")]
|
[assembly: AssemblyVersion("0.8.0.0")]
|
||||||
[assembly: AssemblyFileVersion("0.7.0.0")]
|
[assembly: AssemblyFileVersion("0.8.0.0")]
|
||||||
|
|||||||
120
Unity Studio/Resource1.Designer.cs
generated
Normal file
120
Unity Studio/Resource1.Designer.cs
generated
Normal file
@@ -0,0 +1,120 @@
|
|||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// <auto-generated>
|
||||||
|
// 此代码由工具生成。
|
||||||
|
// 运行时版本:4.0.30319.42000
|
||||||
|
//
|
||||||
|
// 对此文件的更改可能会导致不正确的行为,并且如果
|
||||||
|
// 重新生成代码,这些更改将会丢失。
|
||||||
|
// </auto-generated>
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
namespace Unity_Studio {
|
||||||
|
using System;
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 一个强类型的资源类,用于查找本地化的字符串等。
|
||||||
|
/// </summary>
|
||||||
|
// 此类是由 StronglyTypedResourceBuilder
|
||||||
|
// 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
|
||||||
|
// 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
|
||||||
|
// (以 /str 作为命令选项),或重新生成 VS 项目。
|
||||||
|
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
|
||||||
|
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||||
|
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||||
|
internal class Resource1 {
|
||||||
|
|
||||||
|
private static global::System.Resources.ResourceManager resourceMan;
|
||||||
|
|
||||||
|
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||||
|
|
||||||
|
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||||
|
internal Resource1() {
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 返回此类使用的缓存的 ResourceManager 实例。
|
||||||
|
/// </summary>
|
||||||
|
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||||
|
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||||
|
get {
|
||||||
|
if (object.ReferenceEquals(resourceMan, null)) {
|
||||||
|
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Unity_Studio.Resource1", typeof(Resource1).Assembly);
|
||||||
|
resourceMan = temp;
|
||||||
|
}
|
||||||
|
return resourceMan;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 使用此强类型资源类,为所有资源查找
|
||||||
|
/// 重写当前线程的 CurrentUICulture 属性。
|
||||||
|
/// </summary>
|
||||||
|
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||||
|
internal static global::System.Globalization.CultureInfo Culture {
|
||||||
|
get {
|
||||||
|
return resourceCulture;
|
||||||
|
}
|
||||||
|
set {
|
||||||
|
resourceCulture = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查找类似 #version 140
|
||||||
|
///
|
||||||
|
///in vec3 surfaceNormal;
|
||||||
|
///in vec3 toLightVector;
|
||||||
|
///in vec4 color;
|
||||||
|
///
|
||||||
|
///out vec4 outputColor;
|
||||||
|
///
|
||||||
|
///void main()
|
||||||
|
///{
|
||||||
|
/// vec3 lightColor = vec3(0.5, 0.5, 0.5);
|
||||||
|
///
|
||||||
|
/// // Ambient
|
||||||
|
/// float ambientStrength = 0.9;
|
||||||
|
/// vec3 ambient = ambientStrength * lightColor;
|
||||||
|
///
|
||||||
|
/// // Diffuse
|
||||||
|
/// vec3 unitNormal = normalize(surfaceNormal);
|
||||||
|
/// vec3 unitLightVector = normalize(toLightVector);
|
||||||
|
/// float nDotProduct = dot(unitNormal, unitLightVector);
|
||||||
|
/// float brightness = clamp(nDotProduct, 0, 1); // max(nDotProduct, 0.0);
|
||||||
|
/// vec3 diffuse [字符串的其余部分被截断]"; 的本地化字符串。
|
||||||
|
/// </summary>
|
||||||
|
internal static string fs {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("fs", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查找类似 #version 140
|
||||||
|
///
|
||||||
|
///in vec3 vertexPosition;
|
||||||
|
///in vec3 normalDirection;
|
||||||
|
///in vec4 vertexColor;
|
||||||
|
///uniform mat4 viewMatrix;
|
||||||
|
///
|
||||||
|
///out vec3 surfaceNormal;
|
||||||
|
///out vec3 toLightVector;
|
||||||
|
///out vec4 color;
|
||||||
|
///
|
||||||
|
///void main()
|
||||||
|
///{
|
||||||
|
/// vec3 lightPosition = vec3(200.0, 200.0, 200.0);
|
||||||
|
/// gl_Position = viewMatrix * vec4(vertexPosition, 1.0);
|
||||||
|
/// surfaceNormal = normalDirection;
|
||||||
|
/// toLightVector = lightPosition - vertexPosition;
|
||||||
|
/// color = vertexColor;
|
||||||
|
///} 的本地化字符串。
|
||||||
|
/// </summary>
|
||||||
|
internal static string vs {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("vs", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
170
Unity Studio/Resource1.resx
Normal file
170
Unity Studio/Resource1.resx
Normal file
@@ -0,0 +1,170 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<data name="fs" xml:space="preserve">
|
||||||
|
<value>#version 140
|
||||||
|
|
||||||
|
in vec3 surfaceNormal;
|
||||||
|
in vec3 toLightVector;
|
||||||
|
in vec4 color;
|
||||||
|
|
||||||
|
out vec4 outputColor;
|
||||||
|
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
vec3 lightColor = vec3(0.5, 0.5, 0.5);
|
||||||
|
|
||||||
|
// Ambient
|
||||||
|
float ambientStrength = 0.9;
|
||||||
|
vec3 ambient = ambientStrength * lightColor;
|
||||||
|
|
||||||
|
// Diffuse
|
||||||
|
vec3 unitNormal = normalize(surfaceNormal);
|
||||||
|
vec3 unitLightVector = normalize(toLightVector);
|
||||||
|
float nDotProduct = dot(unitNormal, unitLightVector);
|
||||||
|
float brightness = clamp(nDotProduct, 0, 1); // max(nDotProduct, 0.0);
|
||||||
|
vec3 diffuse = brightness * lightColor;
|
||||||
|
|
||||||
|
// Output Color
|
||||||
|
vec4 result = color * vec4((ambient + diffuse/2), 0.0);
|
||||||
|
outputColor = result;
|
||||||
|
}</value>
|
||||||
|
</data>
|
||||||
|
<data name="vs" xml:space="preserve">
|
||||||
|
<value>#version 140
|
||||||
|
|
||||||
|
in vec3 vertexPosition;
|
||||||
|
in vec3 normalDirection;
|
||||||
|
in vec4 vertexColor;
|
||||||
|
uniform mat4 viewMatrix;
|
||||||
|
|
||||||
|
out vec3 surfaceNormal;
|
||||||
|
out vec3 toLightVector;
|
||||||
|
out vec4 color;
|
||||||
|
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
vec3 lightPosition = vec3(200.0, 200.0, 200.0);
|
||||||
|
gl_Position = viewMatrix * vec4(vertexPosition, 1.0);
|
||||||
|
surfaceNormal = normalDirection;
|
||||||
|
toLightVector = lightPosition - vertexPosition;
|
||||||
|
color = vertexColor;
|
||||||
|
}</value>
|
||||||
|
</data>
|
||||||
|
</root>
|
||||||
90
Unity Studio/ShaderResource.Designer.cs
generated
Normal file
90
Unity Studio/ShaderResource.Designer.cs
generated
Normal file
@@ -0,0 +1,90 @@
|
|||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// <auto-generated>
|
||||||
|
// 此代码由工具生成。
|
||||||
|
// 运行时版本:4.0.30319.42000
|
||||||
|
//
|
||||||
|
// 对此文件的更改可能会导致不正确的行为,并且如果
|
||||||
|
// 重新生成代码,这些更改将会丢失。
|
||||||
|
// </auto-generated>
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
namespace Unity_Studio {
|
||||||
|
using System;
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 一个强类型的资源类,用于查找本地化的字符串等。
|
||||||
|
/// </summary>
|
||||||
|
// 此类是由 StronglyTypedResourceBuilder
|
||||||
|
// 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
|
||||||
|
// 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
|
||||||
|
// (以 /str 作为命令选项),或重新生成 VS 项目。
|
||||||
|
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
|
||||||
|
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||||
|
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||||
|
internal class ShaderResource {
|
||||||
|
|
||||||
|
private static global::System.Resources.ResourceManager resourceMan;
|
||||||
|
|
||||||
|
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||||
|
|
||||||
|
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||||
|
internal ShaderResource() {
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 返回此类使用的缓存的 ResourceManager 实例。
|
||||||
|
/// </summary>
|
||||||
|
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||||
|
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||||
|
get {
|
||||||
|
if (object.ReferenceEquals(resourceMan, null)) {
|
||||||
|
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Unity_Studio.ShaderResource", typeof(ShaderResource).Assembly);
|
||||||
|
resourceMan = temp;
|
||||||
|
}
|
||||||
|
return resourceMan;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 使用此强类型资源类,为所有资源查找
|
||||||
|
/// 重写当前线程的 CurrentUICulture 属性。
|
||||||
|
/// </summary>
|
||||||
|
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||||
|
internal static global::System.Globalization.CultureInfo Culture {
|
||||||
|
get {
|
||||||
|
return resourceCulture;
|
||||||
|
}
|
||||||
|
set {
|
||||||
|
resourceCulture = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查找类似 [{"Level":0,"Type":"string","Name":"m_Name","Size":-1,"Flag":32769},{"Level":1,"Type":"Array","Name":"Array","Size":-1,"Flag":16385},{"Level":2,"Type":"int","Name":"size","Size":4,"Flag":1},{"Level":2,"Type":"char","Name":"data","Size":1,"Flag":1},{"Level":0,"Type":"SerializedShader","Name":"m_ParsedForm","Size":-1,"Flag":32768},{"Level":1,"Type":"SerializedProperties","Name":"m_PropInfo","Size":-1,"Flag":32768},{"Level":2,"Type":"vector","Name":"m_Props","Size":-1,"Flag":32768},{"Level":3,"Type":"Arr... 的本地化字符串。
|
||||||
|
/// </summary>
|
||||||
|
internal static string Shader20171 {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("Shader20171", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查找类似 [{"Level":0,"Type":"string","Name":"m_Name","Size":-1,"Flag":32769},{"Level":1,"Type":"Array","Name":"Array","Size":-1,"Flag":16385},{"Level":2,"Type":"int","Name":"size","Size":4,"Flag":1},{"Level":2,"Type":"char","Name":"data","Size":1,"Flag":1},{"Level":0,"Type":"SerializedShader","Name":"m_ParsedForm","Size":-1,"Flag":32768},{"Level":1,"Type":"SerializedProperties","Name":"m_PropInfo","Size":-1,"Flag":32768},{"Level":2,"Type":"vector","Name":"m_Props","Size":-1,"Flag":32768},{"Level":3,"Type":"Arr... 的本地化字符串。
|
||||||
|
/// </summary>
|
||||||
|
internal static string Shader55 {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("Shader55", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查找类似 [{"Level":0,"Type":"string","Name":"m_Name","Size":-1,"Flag":32769},{"Level":1,"Type":"Array","Name":"Array","Size":-1,"Flag":16385},{"Level":2,"Type":"int","Name":"size","Size":4,"Flag":1},{"Level":2,"Type":"char","Name":"data","Size":1,"Flag":1},{"Level":0,"Type":"SerializedShader","Name":"m_ParsedForm","Size":-1,"Flag":32768},{"Level":1,"Type":"SerializedProperties","Name":"m_PropInfo","Size":-1,"Flag":32768},{"Level":2,"Type":"vector","Name":"m_Props","Size":-1,"Flag":32768},{"Level":3,"Type":"Arr... 的本地化字符串。
|
||||||
|
/// </summary>
|
||||||
|
internal static string Shader56 {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("Shader56", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
129
Unity Studio/ShaderResource.resx
Normal file
129
Unity Studio/ShaderResource.resx
Normal file
File diff suppressed because one or more lines are too long
@@ -60,8 +60,8 @@ namespace Unity_Studio
|
|||||||
{
|
{
|
||||||
int m_Stream = a_Stream.ReadInt32();
|
int m_Stream = a_Stream.ReadInt32();
|
||||||
m_Size = a_Stream.ReadInt32();
|
m_Size = a_Stream.ReadInt32();
|
||||||
|
var asize = m_Size % 4 != 0 ? m_Size + 4 - m_Size % 4 : m_Size;
|
||||||
if (m_Stream > 1)
|
if (m_Stream > 1 && preloadData.Size + preloadData.Offset - a_Stream.Position > asize)
|
||||||
{
|
{
|
||||||
m_Offset = a_Stream.ReadInt32();
|
m_Offset = a_Stream.ReadInt32();
|
||||||
m_Source = sourceFile.filePath + ".resS";
|
m_Source = sourceFile.filePath + ".resS";
|
||||||
|
|||||||
@@ -40,20 +40,21 @@ namespace Unity_Studio
|
|||||||
m_ShaderKeywords[i] = a_Stream.ReadAlignedString(a_Stream.ReadInt32());
|
m_ShaderKeywords[i] = a_Stream.ReadAlignedString(a_Stream.ReadInt32());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (sourceFile.version[0] == 5)
|
else if (sourceFile.version[0] >= 5)//5.0 and up
|
||||||
{
|
{
|
||||||
m_ShaderKeywords = new string[1] { a_Stream.ReadAlignedString(a_Stream.ReadInt32()) };
|
m_ShaderKeywords = new string[1] { a_Stream.ReadAlignedString(a_Stream.ReadInt32()) };
|
||||||
uint m_LightmapFlags = a_Stream.ReadUInt32();
|
uint m_LightmapFlags = a_Stream.ReadUInt32();
|
||||||
if ((sourceFile.version[0] == 5 && sourceFile.version[1] >= 6) || sourceFile.version[0] > 5)//5.6.0 and up
|
if (sourceFile.version[0] == 5 && sourceFile.version[1] >= 6 || sourceFile.version[0] > 5)//5.6.0 and up
|
||||||
{
|
{
|
||||||
var m_EnableInstancingVariants = a_Stream.ReadBoolean();
|
var m_EnableInstancingVariants = a_Stream.ReadBoolean();
|
||||||
|
//var m_DoubleSidedGI = a_Stream.ReadBoolean();//2017.x
|
||||||
a_Stream.AlignStream(4);
|
a_Stream.AlignStream(4);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sourceFile.version[0] > 4 || (sourceFile.version[0] == 4 && sourceFile.version[1] >= 3)) { m_CustomRenderQueue = a_Stream.ReadInt32(); }
|
if (sourceFile.version[0] > 4 || sourceFile.version[0] == 4 && sourceFile.version[1] >= 3) { m_CustomRenderQueue = a_Stream.ReadInt32(); }
|
||||||
|
|
||||||
if (sourceFile.version[0] == 5 && sourceFile.version[1] >= 1)
|
if (sourceFile.version[0] == 5 && sourceFile.version[1] >= 1 || sourceFile.version[0] > 5)//5.1 and up
|
||||||
{
|
{
|
||||||
string[][] stringTagMap = new string[a_Stream.ReadInt32()][];
|
string[][] stringTagMap = new string[a_Stream.ReadInt32()][];
|
||||||
for (int i = 0; i < stringTagMap.Length; i++)
|
for (int i = 0; i < stringTagMap.Length; i++)
|
||||||
|
|||||||
@@ -333,7 +333,7 @@ namespace Unity_Studio
|
|||||||
var version = MeshPD.sourceFile.version;
|
var version = MeshPD.sourceFile.version;
|
||||||
a_Stream = MeshPD.sourceFile.a_Stream;
|
a_Stream = MeshPD.sourceFile.a_Stream;
|
||||||
a_Stream.Position = MeshPD.Offset;
|
a_Stream.Position = MeshPD.Offset;
|
||||||
|
MeshPD.extension = ".obj";
|
||||||
bool m_Use16BitIndices = true; //3.5.0 and newer always uses 16bit indices
|
bool m_Use16BitIndices = true; //3.5.0 and newer always uses 16bit indices
|
||||||
uint m_MeshCompression = 0;
|
uint m_MeshCompression = 0;
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,10 @@
|
|||||||
using System.Text;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Web.Script.Serialization;
|
||||||
|
using Lz4;
|
||||||
|
|
||||||
namespace Unity_Studio
|
namespace Unity_Studio
|
||||||
{
|
{
|
||||||
@@ -6,7 +12,6 @@ namespace Unity_Studio
|
|||||||
{
|
{
|
||||||
public string m_Name;
|
public string m_Name;
|
||||||
public byte[] m_Script;
|
public byte[] m_Script;
|
||||||
public string m_PathName;
|
|
||||||
|
|
||||||
public Shader(AssetPreloadData preloadData, bool readSwitch)
|
public Shader(AssetPreloadData preloadData, bool readSwitch)
|
||||||
{
|
{
|
||||||
@@ -23,50 +28,159 @@ namespace Unity_Studio
|
|||||||
}
|
}
|
||||||
|
|
||||||
m_Name = a_Stream.ReadAlignedString(a_Stream.ReadInt32());
|
m_Name = a_Stream.ReadAlignedString(a_Stream.ReadInt32());
|
||||||
if ((sourceFile.version[0] == 5 && sourceFile.version[1] >= 5) || sourceFile.version[0] > 5)
|
|
||||||
|
if (readSwitch)
|
||||||
{
|
{
|
||||||
if (readSwitch)
|
if (sourceFile.version[0] == 5 && sourceFile.version[1] >= 5 || sourceFile.version[0] > 5)//5.5.0 and up
|
||||||
{
|
{
|
||||||
string str;
|
a_Stream.Position = preloadData.Offset;
|
||||||
if ((str = preloadData.ViewStruct()) != null)
|
var str = (string)ShaderResource.ResourceManager.GetObject($"Shader{sourceFile.version[0]}{sourceFile.version[1]}");
|
||||||
{
|
var members = new JavaScriptSerializer().Deserialize<List<ClassMember>>(str);
|
||||||
m_Script = Encoding.UTF8.GetBytes(preloadData.ViewStruct());
|
m_Script = ReadSerializedShader(members, a_Stream);
|
||||||
}
|
|
||||||
else
|
|
||||||
m_Script = Encoding.UTF8.GetBytes("Serialized Shader can't be read");
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (m_Name != "") { preloadData.Text = m_Name; }
|
m_Script = a_Stream.ReadBytes(a_Stream.ReadInt32());
|
||||||
else { preloadData.Text = preloadData.TypeString + " #" + preloadData.uniqueID; }
|
if (sourceFile.version[0] == 5 && sourceFile.version[1] >= 3) //5.3 - 5.4
|
||||||
preloadData.SubItems.AddRange(new[] { preloadData.TypeString, preloadData.Size.ToString() });
|
{
|
||||||
|
a_Stream.AlignStream(4);
|
||||||
|
a_Stream.ReadAlignedString(a_Stream.ReadInt32());//m_PathName
|
||||||
|
var decompressedSize = a_Stream.ReadUInt32();
|
||||||
|
var m_SubProgramBlob = a_Stream.ReadBytes(a_Stream.ReadInt32());
|
||||||
|
var decompressedBytes = new byte[decompressedSize];
|
||||||
|
using (var mstream = new MemoryStream(m_SubProgramBlob))
|
||||||
|
{
|
||||||
|
var decoder = new Lz4DecoderStream(mstream);
|
||||||
|
decoder.Read(decompressedBytes, 0, (int)decompressedSize);
|
||||||
|
decoder.Dispose();
|
||||||
|
}
|
||||||
|
m_Script = m_Script.Concat(decompressedBytes.ToArray()).ToArray();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int m_Script_size = a_Stream.ReadInt32();
|
if (m_Name != "") { preloadData.Text = m_Name; }
|
||||||
|
else { preloadData.Text = preloadData.TypeString + " #" + preloadData.uniqueID; }
|
||||||
|
preloadData.SubItems.AddRange(new[] { preloadData.TypeString, preloadData.Size.ToString() });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (readSwitch) //asset is read for preview or export
|
private static byte[] ReadSerializedShader(List<ClassMember> members, EndianStream a_Stream)
|
||||||
|
{
|
||||||
|
var offsets = new List<uint>();
|
||||||
|
var compressedLengths = new List<uint>();
|
||||||
|
var decompressedLengths = new List<uint>();
|
||||||
|
for (int i = 0; i < members.Count; i++)
|
||||||
|
{
|
||||||
|
var member = members[i];
|
||||||
|
var level = member.Level;
|
||||||
|
var varTypeStr = member.Type;
|
||||||
|
if (member.Name == "offsets")
|
||||||
{
|
{
|
||||||
m_Script = new byte[m_Script_size];
|
var offsets_size = a_Stream.ReadInt32();
|
||||||
a_Stream.Read(m_Script, 0, m_Script_size);
|
for (int j = 0; j < offsets_size; j++)
|
||||||
|
{
|
||||||
if (m_Script[0] == 93) { m_Script = SevenZip.Compression.LZMA.SevenZipHelper.Decompress(m_Script); }
|
offsets.Add(a_Stream.ReadUInt32());
|
||||||
if (m_Script[0] == 60 || (m_Script[0] == 239 && m_Script[1] == 187 && m_Script[2] == 191 && m_Script[3] == 60)) { preloadData.extension = ".xml"; }
|
}
|
||||||
|
var compressedLengths_size = a_Stream.ReadInt32();
|
||||||
|
for (int j = 0; j < compressedLengths_size; j++)
|
||||||
|
{
|
||||||
|
compressedLengths.Add(a_Stream.ReadUInt32());
|
||||||
|
}
|
||||||
|
var decompressedLengths_size = a_Stream.ReadInt32();
|
||||||
|
for (int j = 0; j < decompressedLengths_size; j++)
|
||||||
|
{
|
||||||
|
decompressedLengths.Add(a_Stream.ReadUInt32());
|
||||||
|
}
|
||||||
|
var compressedBlob = a_Stream.ReadBytes(a_Stream.ReadInt32());
|
||||||
|
var decompressedStream = new MemoryStream();
|
||||||
|
for (int j = 0; j < offsets.Count; j++)
|
||||||
|
{
|
||||||
|
var compressedBytes = new byte[compressedLengths[j]];
|
||||||
|
Array.Copy(compressedBlob, offsets[j], compressedBytes, 0, compressedLengths[j]);
|
||||||
|
var decompressedBytes = new byte[decompressedLengths[j]];
|
||||||
|
using (var mstream = new MemoryStream(compressedBytes))
|
||||||
|
{
|
||||||
|
var decoder = new Lz4DecoderStream(mstream);
|
||||||
|
decoder.Read(decompressedBytes, 0, (int)decompressedLengths[j]);
|
||||||
|
decoder.Dispose();
|
||||||
|
}
|
||||||
|
decompressedStream.Write(decompressedBytes, 0, decompressedBytes.Length);
|
||||||
|
}
|
||||||
|
var decompressedBlob = decompressedStream.ToArray();
|
||||||
|
return decompressedBlob;
|
||||||
|
}
|
||||||
|
var align = (member.Flag & 0x4000) != 0;
|
||||||
|
if (varTypeStr == "SInt8")//sbyte
|
||||||
|
{
|
||||||
|
a_Stream.ReadSByte();
|
||||||
|
}
|
||||||
|
else if (varTypeStr == "UInt8")//byte
|
||||||
|
{
|
||||||
|
a_Stream.ReadByte();
|
||||||
|
}
|
||||||
|
else if (varTypeStr == "short" || varTypeStr == "SInt16")//Int16
|
||||||
|
{
|
||||||
|
a_Stream.ReadInt16();
|
||||||
|
}
|
||||||
|
else if (varTypeStr == "UInt16" || varTypeStr == "unsigned short")//UInt16
|
||||||
|
{
|
||||||
|
a_Stream.ReadUInt16();
|
||||||
|
}
|
||||||
|
else if (varTypeStr == "int" || varTypeStr == "SInt32")//Int32
|
||||||
|
{
|
||||||
|
a_Stream.ReadInt32();
|
||||||
|
}
|
||||||
|
else if (varTypeStr == "UInt32" || varTypeStr == "unsigned int")//UInt32
|
||||||
|
{
|
||||||
|
a_Stream.ReadUInt32();
|
||||||
|
}
|
||||||
|
else if (varTypeStr == "long long" || varTypeStr == "SInt64")//Int64
|
||||||
|
{
|
||||||
|
a_Stream.ReadInt64();
|
||||||
|
}
|
||||||
|
else if (varTypeStr == "UInt64" || varTypeStr == "unsigned long long")//UInt64
|
||||||
|
{
|
||||||
|
a_Stream.ReadUInt64();
|
||||||
|
}
|
||||||
|
else if (varTypeStr == "float")//float
|
||||||
|
{
|
||||||
|
a_Stream.ReadSingle();
|
||||||
|
}
|
||||||
|
else if (varTypeStr == "double")//double
|
||||||
|
{
|
||||||
|
a_Stream.ReadDouble();
|
||||||
|
}
|
||||||
|
else if (varTypeStr == "bool")//bool
|
||||||
|
{
|
||||||
|
a_Stream.ReadBoolean();
|
||||||
|
}
|
||||||
|
else if (varTypeStr == "string")//string
|
||||||
|
{
|
||||||
|
a_Stream.ReadAlignedString(a_Stream.ReadInt32());
|
||||||
|
i += 3;//skip
|
||||||
|
}
|
||||||
|
else if (varTypeStr == "Array")//Array
|
||||||
|
{
|
||||||
|
if ((members[i - 1].Flag & 0x4000) != 0)
|
||||||
|
align = true;
|
||||||
|
var size = a_Stream.ReadInt32();
|
||||||
|
var array = AssetPreloadData.ReadArray(members, level, i);
|
||||||
|
for (int j = 0; j < size; j++)
|
||||||
|
{
|
||||||
|
ReadSerializedShader(array, a_Stream);
|
||||||
|
}
|
||||||
|
i += array.Count + 1;//skip
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
byte lzmaTest = a_Stream.ReadByte();
|
align = false;
|
||||||
|
|
||||||
a_Stream.Position += m_Script_size - 1;
|
|
||||||
|
|
||||||
if (m_Name != "") { preloadData.Text = m_Name; }
|
|
||||||
else { preloadData.Text = preloadData.TypeString + " #" + preloadData.uniqueID; }
|
|
||||||
preloadData.SubItems.AddRange(new[] { preloadData.TypeString, preloadData.Size.ToString() });
|
|
||||||
}
|
}
|
||||||
a_Stream.AlignStream(4);
|
if (align)
|
||||||
m_PathName = a_Stream.ReadAlignedString(a_Stream.ReadInt32());
|
a_Stream.AlignStream(4);
|
||||||
}
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ namespace Unity_Studio
|
|||||||
{
|
{
|
||||||
public string m_Name;
|
public string m_Name;
|
||||||
public byte[] m_Script;
|
public byte[] m_Script;
|
||||||
public string m_PathName;
|
|
||||||
|
|
||||||
public TextAsset(AssetPreloadData preloadData, bool readSwitch)
|
public TextAsset(AssetPreloadData preloadData, bool readSwitch)
|
||||||
{
|
{
|
||||||
@@ -28,36 +27,16 @@ namespace Unity_Studio
|
|||||||
|
|
||||||
m_Name = a_Stream.ReadAlignedString(a_Stream.ReadInt32());
|
m_Name = a_Stream.ReadAlignedString(a_Stream.ReadInt32());
|
||||||
|
|
||||||
int m_Script_size = a_Stream.ReadInt32();
|
if (readSwitch)
|
||||||
|
|
||||||
if (readSwitch) //asset is read for preview or export
|
|
||||||
{
|
{
|
||||||
m_Script = new byte[m_Script_size];
|
m_Script = a_Stream.ReadBytes(a_Stream.ReadInt32());
|
||||||
a_Stream.Read(m_Script, 0, m_Script_size);
|
|
||||||
|
|
||||||
if (m_Script[0] == 93)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
m_Script = SevenZip.Compression.LZMA.SevenZipHelper.Decompress(m_Script);
|
|
||||||
}
|
|
||||||
catch { }
|
|
||||||
}
|
|
||||||
if (m_Script[0] == 60 || (m_Script[0] == 239 && m_Script[1] == 187 && m_Script[2] == 191 && m_Script[3] == 60)) { preloadData.extension = ".xml"; }
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
byte lzmaTest = a_Stream.ReadByte();
|
|
||||||
|
|
||||||
a_Stream.Position += m_Script_size - 1;
|
|
||||||
|
|
||||||
if (m_Name != "") { preloadData.Text = m_Name; }
|
if (m_Name != "") { preloadData.Text = m_Name; }
|
||||||
else { preloadData.Text = preloadData.TypeString + " #" + preloadData.uniqueID; }
|
else { preloadData.Text = preloadData.TypeString + " #" + preloadData.uniqueID; }
|
||||||
preloadData.SubItems.AddRange(new[] { preloadData.TypeString, preloadData.Size.ToString() });
|
preloadData.SubItems.AddRange(new[] { preloadData.TypeString, preloadData.Size.ToString() });
|
||||||
}
|
}
|
||||||
a_Stream.AlignStream(4);
|
|
||||||
|
|
||||||
m_PathName = a_Stream.ReadAlignedString(a_Stream.ReadInt32());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -136,7 +136,11 @@ namespace Unity_Studio
|
|||||||
m_Aniso = a_Stream.ReadInt32();
|
m_Aniso = a_Stream.ReadInt32();
|
||||||
m_MipBias = a_Stream.ReadSingle();
|
m_MipBias = a_Stream.ReadSingle();
|
||||||
m_WrapMode = a_Stream.ReadInt32();
|
m_WrapMode = a_Stream.ReadInt32();
|
||||||
|
if (sourceFile.version[0] == 2017)//2017.x
|
||||||
|
{
|
||||||
|
int m_WrapV = a_Stream.ReadInt32();
|
||||||
|
int m_WrapW = a_Stream.ReadInt32();
|
||||||
|
}
|
||||||
if (sourceFile.version[0] >= 3)
|
if (sourceFile.version[0] >= 3)
|
||||||
{
|
{
|
||||||
m_LightmapFormat = a_Stream.ReadInt32();
|
m_LightmapFormat = a_Stream.ReadInt32();
|
||||||
@@ -986,9 +990,26 @@ namespace Unity_Studio
|
|||||||
|
|
||||||
private Bitmap RGB565ToBitmap()
|
private Bitmap RGB565ToBitmap()
|
||||||
{
|
{
|
||||||
var hObject = GCHandle.Alloc(image_data, GCHandleType.Pinned);
|
//stride = m_Width * 2 + m_Width * 2 % 4
|
||||||
|
//所以m_Width * 2不为4的倍数时,需要在每行补上相应的像素
|
||||||
|
byte[] buff;
|
||||||
|
var padding = m_Width * 2 % 4;
|
||||||
|
var stride = m_Width * 2 + padding;
|
||||||
|
if (padding != 0)
|
||||||
|
{
|
||||||
|
buff = new byte[stride * m_Height];
|
||||||
|
for (int i = 0; i < m_Height; i++)
|
||||||
|
{
|
||||||
|
Array.Copy(image_data, i * m_Width * 2, buff, i * stride, m_Width * 2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
buff = image_data;
|
||||||
|
}
|
||||||
|
var hObject = GCHandle.Alloc(buff, GCHandleType.Pinned);
|
||||||
var pObject = hObject.AddrOfPinnedObject();
|
var pObject = hObject.AddrOfPinnedObject();
|
||||||
var bitmap = new Bitmap(m_Width, m_Height, m_Width * 2, PixelFormat.Format16bppRgb565, pObject);
|
var bitmap = new Bitmap(m_Width, m_Height, stride, PixelFormat.Format16bppRgb565, pObject);
|
||||||
hObject.Free();
|
hObject.Free();
|
||||||
return bitmap;
|
return bitmap;
|
||||||
}
|
}
|
||||||
@@ -1075,6 +1096,7 @@ public enum TextureFormat
|
|||||||
RGFloat,
|
RGFloat,
|
||||||
RGBAFloat,
|
RGBAFloat,
|
||||||
YUY2,
|
YUY2,
|
||||||
|
RGB9e5Float,
|
||||||
BC4 = 26,
|
BC4 = 26,
|
||||||
BC5,
|
BC5,
|
||||||
BC6H = 24,
|
BC6H = 24,
|
||||||
@@ -1108,7 +1130,9 @@ public enum TextureFormat
|
|||||||
ASTC_RGBA_10x10,
|
ASTC_RGBA_10x10,
|
||||||
ASTC_RGBA_12x12,
|
ASTC_RGBA_12x12,
|
||||||
ETC_RGB4_3DS,
|
ETC_RGB4_3DS,
|
||||||
ETC_RGBA8_3DS
|
ETC_RGBA8_3DS,
|
||||||
|
RG16,
|
||||||
|
R8
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class KTXHeader
|
public static class KTXHeader
|
||||||
|
|||||||
@@ -127,7 +127,7 @@ namespace Unity_Studio
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static List<ClassMember> ReadArray(List<ClassMember> members, int level, int index)
|
public static List<ClassMember> ReadArray(List<ClassMember> members, int level, int index)
|
||||||
{
|
{
|
||||||
var member2 = new List<ClassMember>();
|
var member2 = new List<ClassMember>();
|
||||||
for (int i = index + 2; i < members.Count; i++)//skip int size
|
for (int i = index + 2; i < members.Count; i++)//skip int size
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
|
||||||
namespace Unity_Studio
|
namespace Unity_Studio
|
||||||
{
|
{
|
||||||
@@ -9,8 +11,10 @@ namespace Unity_Studio
|
|||||||
{
|
{
|
||||||
public EndianStream a_Stream;
|
public EndianStream a_Stream;
|
||||||
public string filePath;
|
public string filePath;
|
||||||
|
public string bundlePath;
|
||||||
public string fileName;
|
public string fileName;
|
||||||
public int fileGen;
|
public int fileGen;
|
||||||
|
public bool valid;
|
||||||
public string m_Version = "2.5.0f5";
|
public string m_Version = "2.5.0f5";
|
||||||
public int[] version = new int[4] { 0, 0, 0, 0 };
|
public int[] version = new int[4] { 0, 0, 0, 0 };
|
||||||
public string[] buildType;
|
public string[] buildType;
|
||||||
@@ -31,7 +35,6 @@ namespace Unity_Studio
|
|||||||
private List<int[]> classIDs = new List<int[]>();//use for 5.5.0
|
private List<int[]> classIDs = new List<int[]>();//use for 5.5.0
|
||||||
|
|
||||||
public static string[] buildTypeSplit = { ".", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9" };
|
public static string[] buildTypeSplit = { ".", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9" };
|
||||||
public static string[] strverSplit = { ".", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "\n", "-", "_" };
|
|
||||||
|
|
||||||
#region cmmon string
|
#region cmmon string
|
||||||
private static Dictionary<int, string> baseStrings = new Dictionary<int, string>()
|
private static Dictionary<int, string> baseStrings = new Dictionary<int, string>()
|
||||||
@@ -148,211 +151,270 @@ namespace Unity_Studio
|
|||||||
|
|
||||||
public AssetsFile(string fullName, EndianStream fileStream)
|
public AssetsFile(string fullName, EndianStream fileStream)
|
||||||
{
|
{
|
||||||
//if (memFile != null) { Stream = new EndianStream(memFile, endianType); }
|
|
||||||
//else { Stream = new EndianStream(File.OpenRead(fileName), endianType); }
|
|
||||||
a_Stream = fileStream;
|
a_Stream = fileStream;
|
||||||
|
|
||||||
filePath = fullName;
|
filePath = fullName;
|
||||||
fileName = Path.GetFileName(fullName);
|
fileName = Path.GetFileName(fullName);
|
||||||
int tableSize = a_Stream.ReadInt32();
|
try
|
||||||
int dataEnd = a_Stream.ReadInt32();
|
|
||||||
fileGen = a_Stream.ReadInt32();
|
|
||||||
uint dataOffset = a_Stream.ReadUInt32();
|
|
||||||
sharedAssetsList[0].fileName = Path.GetFileName(fullName); //reference itself because sharedFileIDs start from 1
|
|
||||||
|
|
||||||
switch (fileGen)
|
|
||||||
{
|
{
|
||||||
case 6://2.5.0 - 2.6.1
|
int tableSize = a_Stream.ReadInt32();
|
||||||
{
|
int dataEnd = a_Stream.ReadInt32();
|
||||||
a_Stream.Position = (dataEnd - tableSize);
|
fileGen = a_Stream.ReadInt32();
|
||||||
a_Stream.Position += 1;
|
uint dataOffset = a_Stream.ReadUInt32();
|
||||||
|
sharedAssetsList[0].fileName = Path.GetFileName(fullName); //reference itself because sharedFileIDs start from 1
|
||||||
|
|
||||||
|
switch (fileGen)
|
||||||
|
{
|
||||||
|
case 6: //2.5.0 - 2.6.1
|
||||||
|
{
|
||||||
|
a_Stream.Position = (dataEnd - tableSize);
|
||||||
|
a_Stream.Position += 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 7: //3.0.0 beta
|
||||||
|
{
|
||||||
|
a_Stream.Position = (dataEnd - tableSize);
|
||||||
|
a_Stream.Position += 1;
|
||||||
|
m_Version = a_Stream.ReadStringToNull();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 8: //3.0.0 - 3.4.2
|
||||||
|
{
|
||||||
|
a_Stream.Position = (dataEnd - tableSize);
|
||||||
|
a_Stream.Position += 1;
|
||||||
|
m_Version = a_Stream.ReadStringToNull();
|
||||||
|
platform = a_Stream.ReadInt32();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 9: //3.5.0 - 4.6.x
|
||||||
|
{
|
||||||
|
a_Stream.Position += 4; //azero
|
||||||
|
m_Version = a_Stream.ReadStringToNull();
|
||||||
|
platform = a_Stream.ReadInt32();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 14: //5.0.0 beta and final
|
||||||
|
case 15: //5.0.1 - 5.4
|
||||||
|
case 16: //??.. no sure
|
||||||
|
case 17: //5.5.0 and up
|
||||||
|
{
|
||||||
|
a_Stream.Position += 4; //azero
|
||||||
|
m_Version = a_Stream.ReadStringToNull();
|
||||||
|
platform = a_Stream.ReadInt32();
|
||||||
|
baseDefinitions = a_Stream.ReadBoolean();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
//MessageBox.Show("Unsupported Unity version!" + fileGen, "Unity Studio Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (platform > 255 || platform < 0)
|
||||||
|
{
|
||||||
|
byte[] b32 = BitConverter.GetBytes(platform);
|
||||||
|
Array.Reverse(b32);
|
||||||
|
platform = BitConverter.ToInt32(b32, 0);
|
||||||
|
//endianType = EndianType.LittleEndian;
|
||||||
|
a_Stream.endian = EndianType.LittleEndian;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (platform)
|
||||||
|
{
|
||||||
|
case -2:
|
||||||
|
platformStr = "Unity Package";
|
||||||
break;
|
break;
|
||||||
}
|
case 4:
|
||||||
case 7://3.0.0 beta
|
platformStr = "OSX";
|
||||||
{
|
|
||||||
a_Stream.Position = (dataEnd - tableSize);
|
|
||||||
a_Stream.Position += 1;
|
|
||||||
m_Version = a_Stream.ReadStringToNull();
|
|
||||||
break;
|
break;
|
||||||
}
|
case 5:
|
||||||
case 8://3.0.0 - 3.4.2
|
platformStr = "PC";
|
||||||
{
|
|
||||||
a_Stream.Position = (dataEnd - tableSize);
|
|
||||||
a_Stream.Position += 1;
|
|
||||||
m_Version = a_Stream.ReadStringToNull();
|
|
||||||
platform = a_Stream.ReadInt32();
|
|
||||||
break;
|
break;
|
||||||
}
|
case 6:
|
||||||
case 9://3.5.0 - 4.6.x
|
platformStr = "Web";
|
||||||
{
|
|
||||||
a_Stream.Position += 4;//azero
|
|
||||||
m_Version = a_Stream.ReadStringToNull();
|
|
||||||
platform = a_Stream.ReadInt32();
|
|
||||||
break;
|
break;
|
||||||
}
|
case 7:
|
||||||
case 14://5.0.0 beta and final
|
platformStr = "Web streamed";
|
||||||
case 15://5.0.1 - 5.4
|
|
||||||
case 16://??.. no sure
|
|
||||||
case 17://5.5.0 and up
|
|
||||||
{
|
|
||||||
a_Stream.Position += 4;//azero
|
|
||||||
m_Version = a_Stream.ReadStringToNull();
|
|
||||||
platform = a_Stream.ReadInt32();
|
|
||||||
baseDefinitions = a_Stream.ReadBoolean();
|
|
||||||
break;
|
break;
|
||||||
}
|
case 9:
|
||||||
default:
|
platformStr = "iOS";
|
||||||
|
break;
|
||||||
|
case 10:
|
||||||
|
platformStr = "PS3";
|
||||||
|
break;
|
||||||
|
case 11:
|
||||||
|
platformStr = "Xbox 360";
|
||||||
|
break;
|
||||||
|
case 13:
|
||||||
|
platformStr = "Android";
|
||||||
|
break;
|
||||||
|
case 16:
|
||||||
|
platformStr = "Google NaCl";
|
||||||
|
break;
|
||||||
|
case 19:
|
||||||
|
platformStr = "CollabPreview";
|
||||||
|
break;
|
||||||
|
case 21:
|
||||||
|
platformStr = "WP8";
|
||||||
|
break;
|
||||||
|
case 25:
|
||||||
|
platformStr = "Linux";
|
||||||
|
break;
|
||||||
|
case 29:
|
||||||
|
platformStr = "Wii U";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
platformStr = "Unknown Platform";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
int baseCount = a_Stream.ReadInt32();
|
||||||
|
for (int i = 0; i < baseCount; i++)
|
||||||
|
{
|
||||||
|
if (fileGen < 14)
|
||||||
{
|
{
|
||||||
//MessageBox.Show("Unsupported Unity version!" + fileGen, "Unity Studio Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
int classID = a_Stream.ReadInt32();
|
||||||
return;
|
string baseType = a_Stream.ReadStringToNull();
|
||||||
|
string baseName = a_Stream.ReadStringToNull();
|
||||||
|
a_Stream.Position += 20;
|
||||||
|
int memberCount = a_Stream.ReadInt32();
|
||||||
|
|
||||||
|
var cb = new List<ClassMember>();
|
||||||
|
for (int m = 0; m < memberCount; m++)
|
||||||
|
{
|
||||||
|
readBase(cb, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
var aClass = new ClassStruct() { ID = classID, Text = (baseType + " " + baseName), members = cb };
|
||||||
|
aClass.SubItems.Add(classID.ToString());
|
||||||
|
ClassStructures.Add(classID, aClass);
|
||||||
}
|
}
|
||||||
}
|
else
|
||||||
|
|
||||||
if (platform > 255 || platform < 0)
|
|
||||||
{
|
|
||||||
byte[] b32 = BitConverter.GetBytes(platform);
|
|
||||||
Array.Reverse(b32);
|
|
||||||
platform = BitConverter.ToInt32(b32, 0);
|
|
||||||
//endianType = EndianType.LittleEndian;
|
|
||||||
a_Stream.endian = EndianType.LittleEndian;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (platform)
|
|
||||||
{
|
|
||||||
case -2: platformStr = "Unity Package"; break;
|
|
||||||
case 4: platformStr = "OSX"; break;
|
|
||||||
case 5: platformStr = "PC"; break;
|
|
||||||
case 6: platformStr = "Web"; break;
|
|
||||||
case 7: platformStr = "Web streamed"; break;
|
|
||||||
case 9: platformStr = "iOS"; break;
|
|
||||||
case 10: platformStr = "PS3"; break;
|
|
||||||
case 11: platformStr = "Xbox 360"; break;
|
|
||||||
case 13: platformStr = "Android"; break;
|
|
||||||
case 16: platformStr = "Google NaCl"; break;
|
|
||||||
case 21: platformStr = "WP8"; break;
|
|
||||||
case 25: platformStr = "Linux"; break;
|
|
||||||
case 29: platformStr = "Wii U"; break;
|
|
||||||
default: platformStr = "Unknown Platform"; break;
|
|
||||||
}
|
|
||||||
|
|
||||||
int baseCount = a_Stream.ReadInt32();
|
|
||||||
for (int i = 0; i < baseCount; i++)
|
|
||||||
{
|
|
||||||
if (fileGen < 14)
|
|
||||||
{
|
|
||||||
int classID = a_Stream.ReadInt32();
|
|
||||||
string baseType = a_Stream.ReadStringToNull();
|
|
||||||
string baseName = a_Stream.ReadStringToNull();
|
|
||||||
a_Stream.Position += 20;
|
|
||||||
int memberCount = a_Stream.ReadInt32();
|
|
||||||
|
|
||||||
var cb = new List<ClassMember>();
|
|
||||||
for (int m = 0; m < memberCount; m++) { readBase(cb, 1); }
|
|
||||||
|
|
||||||
var aClass = new ClassStruct() { ID = classID, Text = (baseType + " " + baseName), members = cb };
|
|
||||||
aClass.SubItems.Add(classID.ToString());
|
|
||||||
ClassStructures.Add(classID, aClass);
|
|
||||||
}
|
|
||||||
else { readBase5(); }
|
|
||||||
}
|
|
||||||
|
|
||||||
if (fileGen >= 7 && fileGen < 14) { a_Stream.Position += 4; }//azero
|
|
||||||
|
|
||||||
int assetCount = a_Stream.ReadInt32();
|
|
||||||
|
|
||||||
#region asset preload table
|
|
||||||
string assetIDfmt = "D" + assetCount.ToString().Length; //format for unique ID
|
|
||||||
|
|
||||||
for (int i = 0; i < assetCount; i++)
|
|
||||||
{
|
|
||||||
//each table entry is aligned individually, not the whole table
|
|
||||||
if (fileGen >= 14) { a_Stream.AlignStream(4); }
|
|
||||||
|
|
||||||
AssetPreloadData asset = new AssetPreloadData();
|
|
||||||
if (fileGen < 14) { asset.m_PathID = a_Stream.ReadInt32(); }
|
|
||||||
else { asset.m_PathID = a_Stream.ReadInt64(); }
|
|
||||||
asset.Offset = a_Stream.ReadUInt32();
|
|
||||||
asset.Offset += dataOffset;
|
|
||||||
asset.Size = a_Stream.ReadInt32();
|
|
||||||
if (fileGen > 15)
|
|
||||||
{
|
|
||||||
int index = a_Stream.ReadInt32();
|
|
||||||
asset.Type1 = classIDs[index][0];
|
|
||||||
asset.Type2 = (ushort)classIDs[index][1];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
asset.Type1 = a_Stream.ReadInt32();
|
|
||||||
asset.Type2 = a_Stream.ReadUInt16();
|
|
||||||
a_Stream.Position += 2;
|
|
||||||
}
|
|
||||||
if (fileGen == 15)
|
|
||||||
{
|
|
||||||
byte unknownByte = a_Stream.ReadByte();
|
|
||||||
//this is a single byte, not an int32
|
|
||||||
//the next entry is aligned after this
|
|
||||||
//but not the last!
|
|
||||||
if (unknownByte != 0)
|
|
||||||
{
|
{
|
||||||
//bool investigate = true;
|
readBase5();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
string typeString;
|
if (fileGen >= 7 && fileGen < 14)
|
||||||
if (ClassIDReference.Names.TryGetValue(asset.Type2, out typeString))
|
|
||||||
{
|
{
|
||||||
asset.TypeString = typeString;
|
a_Stream.Position += 4; //azero
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
asset.TypeString = "Unknown Type " + asset.Type2;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
asset.uniqueID = i.ToString(assetIDfmt);
|
int assetCount = a_Stream.ReadInt32();
|
||||||
|
|
||||||
asset.sourceFile = this;
|
#region asset preload table
|
||||||
|
string assetIDfmt = "D" + assetCount.ToString().Length; //format for unique ID
|
||||||
|
|
||||||
preloadTable.Add(asset.m_PathID, asset);
|
for (int i = 0; i < assetCount; i++)
|
||||||
|
|
||||||
#region read BuildSettings to get version for unity 2.x files
|
|
||||||
if (asset.Type2 == 141 && fileGen == 6)
|
|
||||||
{
|
{
|
||||||
long nextAsset = a_Stream.Position;
|
//each table entry is aligned individually, not the whole table
|
||||||
|
if (fileGen >= 14)
|
||||||
|
{
|
||||||
|
a_Stream.AlignStream(4);
|
||||||
|
}
|
||||||
|
|
||||||
BuildSettings BSettings = new BuildSettings(asset);
|
AssetPreloadData asset = new AssetPreloadData();
|
||||||
m_Version = BSettings.m_Version;
|
if (fileGen < 14)
|
||||||
|
{
|
||||||
|
asset.m_PathID = a_Stream.ReadInt32();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
asset.m_PathID = a_Stream.ReadInt64();
|
||||||
|
}
|
||||||
|
asset.Offset = a_Stream.ReadUInt32();
|
||||||
|
asset.Offset += dataOffset;
|
||||||
|
asset.Size = a_Stream.ReadInt32();
|
||||||
|
if (fileGen > 15)
|
||||||
|
{
|
||||||
|
int index = a_Stream.ReadInt32();
|
||||||
|
asset.Type1 = classIDs[index][0];
|
||||||
|
asset.Type2 = (ushort)classIDs[index][1];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
asset.Type1 = a_Stream.ReadInt32();
|
||||||
|
asset.Type2 = a_Stream.ReadUInt16();
|
||||||
|
a_Stream.Position += 2;
|
||||||
|
}
|
||||||
|
if (fileGen == 15)
|
||||||
|
{
|
||||||
|
byte unknownByte = a_Stream.ReadByte();
|
||||||
|
//this is a single byte, not an int32
|
||||||
|
//the next entry is aligned after this
|
||||||
|
//but not the last!
|
||||||
|
if (unknownByte != 0)
|
||||||
|
{
|
||||||
|
//bool investigate = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
a_Stream.Position = nextAsset;
|
string typeString;
|
||||||
|
if (ClassIDReference.Names.TryGetValue(asset.Type2, out typeString))
|
||||||
|
{
|
||||||
|
asset.TypeString = typeString;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
asset.TypeString = "Unknown Type " + asset.Type2;
|
||||||
|
}
|
||||||
|
|
||||||
|
asset.uniqueID = i.ToString(assetIDfmt);
|
||||||
|
|
||||||
|
asset.sourceFile = this;
|
||||||
|
|
||||||
|
preloadTable.Add(asset.m_PathID, asset);
|
||||||
|
|
||||||
|
#region read BuildSettings to get version for unity 2.x files
|
||||||
|
if (asset.Type2 == 141 && fileGen == 6)
|
||||||
|
{
|
||||||
|
long nextAsset = a_Stream.Position;
|
||||||
|
|
||||||
|
BuildSettings BSettings = new BuildSettings(asset);
|
||||||
|
m_Version = BSettings.m_Version;
|
||||||
|
|
||||||
|
a_Stream.Position = nextAsset;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
buildType = m_Version.Split(buildTypeSplit, StringSplitOptions.RemoveEmptyEntries);
|
buildType = m_Version.Split(buildTypeSplit, StringSplitOptions.RemoveEmptyEntries);
|
||||||
var strver = m_Version.Split(strverSplit, StringSplitOptions.RemoveEmptyEntries);
|
var strver = from Match m in Regex.Matches(m_Version, @"[0-9]") select m.Value;
|
||||||
version = Array.ConvertAll(strver, int.Parse);
|
version = Array.ConvertAll(strver.ToArray(), int.Parse);
|
||||||
|
if (version[0] == 2 && version[1] == 0 && version[2] == 1 && version[3] == 7)//2017.x
|
||||||
if (fileGen >= 14)
|
|
||||||
{
|
|
||||||
//this looks like a list of assets that need to be preloaded in memory before anytihng else
|
|
||||||
int someCount = a_Stream.ReadInt32();
|
|
||||||
for (int i = 0; i < someCount; i++)
|
|
||||||
{
|
{
|
||||||
int num1 = a_Stream.ReadInt32();
|
var nversion = new int[version.Length - 3];
|
||||||
a_Stream.AlignStream(4);
|
nversion[0] = 2017;
|
||||||
long m_PathID = a_Stream.ReadInt64();
|
Array.Copy(version, 4, nversion, 1, version.Length - 4);
|
||||||
|
version = nversion;
|
||||||
|
}
|
||||||
|
if (fileGen >= 14)
|
||||||
|
{
|
||||||
|
//this looks like a list of assets that need to be preloaded in memory before anytihng else
|
||||||
|
int someCount = a_Stream.ReadInt32();
|
||||||
|
for (int i = 0; i < someCount; i++)
|
||||||
|
{
|
||||||
|
int num1 = a_Stream.ReadInt32();
|
||||||
|
a_Stream.AlignStream(4);
|
||||||
|
long m_PathID = a_Stream.ReadInt64();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
int sharedFileCount = a_Stream.ReadInt32();
|
int sharedFileCount = a_Stream.ReadInt32();
|
||||||
for (int i = 0; i < sharedFileCount; i++)
|
for (int i = 0; i < sharedFileCount; i++)
|
||||||
|
{
|
||||||
|
UnityShared shared = new UnityShared();
|
||||||
|
shared.aName = a_Stream.ReadStringToNull();
|
||||||
|
a_Stream.Position += 20;
|
||||||
|
string sharedFileName = a_Stream.ReadStringToNull(); //relative path
|
||||||
|
shared.fileName = sharedFileName.Replace("/", "\\");
|
||||||
|
sharedAssetsList.Add(shared);
|
||||||
|
}
|
||||||
|
valid = true;
|
||||||
|
}
|
||||||
|
catch
|
||||||
{
|
{
|
||||||
UnityShared shared = new UnityShared();
|
|
||||||
shared.aName = a_Stream.ReadStringToNull();
|
|
||||||
a_Stream.Position += 20;
|
|
||||||
string sharedFileName = a_Stream.ReadStringToNull(); //relative path
|
|
||||||
shared.fileName = sharedFileName.Replace("/", "\\");
|
|
||||||
sharedAssetsList.Add(shared);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -149,7 +149,7 @@ namespace Unity_Studio
|
|||||||
{
|
{
|
||||||
var bytes = new List<byte>();
|
var bytes = new List<byte>();
|
||||||
byte b;
|
byte b;
|
||||||
while ((b = ReadByte()) != 0)
|
while (BaseStream.Position != BaseStream.Length && (b = ReadByte()) != 0)
|
||||||
bytes.Add(b);
|
bytes.Add(b);
|
||||||
return Encoding.UTF8.GetString(bytes.ToArray());
|
return Encoding.UTF8.GetString(bytes.ToArray());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ using System.Runtime.InteropServices;
|
|||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using System.Drawing.Imaging;
|
using System.Drawing.Imaging;
|
||||||
using System.Web.Script.Serialization;
|
using System.Web.Script.Serialization;
|
||||||
using ManagedFbx;
|
|
||||||
|
|
||||||
|
|
||||||
namespace Unity_Studio
|
namespace Unity_Studio
|
||||||
@@ -131,35 +130,20 @@ namespace Unity_Studio
|
|||||||
|
|
||||||
foreach (var memFile in b_File.MemoryAssetsFileList) //filter unity files
|
foreach (var memFile in b_File.MemoryAssetsFileList) //filter unity files
|
||||||
{
|
{
|
||||||
bool validAssetsFile = false;
|
|
||||||
switch (Path.GetExtension(memFile.fileName))
|
|
||||||
{
|
|
||||||
case ".assets":
|
|
||||||
case ".sharedAssets":
|
|
||||||
validAssetsFile = true;
|
|
||||||
break;
|
|
||||||
case "":
|
|
||||||
validAssetsFile = (memFile.fileName == "mainData" ||
|
|
||||||
Regex.IsMatch(memFile.fileName, "level.*?") ||
|
|
||||||
Regex.IsMatch(memFile.fileName, "CustomAssetBundle-.*?") ||
|
|
||||||
Regex.IsMatch(memFile.fileName, "CAB-.*?") ||
|
|
||||||
Regex.IsMatch(memFile.fileName, "BuildPlayer-.*?"));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
StatusStripUpdate("Loading " + memFile.fileName);
|
StatusStripUpdate("Loading " + memFile.fileName);
|
||||||
//create dummy path to be used for asset extraction
|
//create dummy path to be used for asset extraction
|
||||||
memFile.fileName = Path.GetDirectoryName(bundleFileName) + "\\" + memFile.fileName;
|
memFile.fileName = Path.GetDirectoryName(bundleFileName) + "\\" + memFile.fileName;
|
||||||
|
|
||||||
AssetsFile assetsFile = new AssetsFile(memFile.fileName, new EndianStream(memFile.memStream, EndianType.BigEndian));
|
AssetsFile assetsFile = new AssetsFile(memFile.fileName, new EndianStream(memFile.memStream, EndianType.BigEndian));
|
||||||
if (assetsFile.fileGen == 6 && Path.GetFileName(bundleFileName) != "mainData") //2.6.x and earlier don't have a string version before the preload table
|
if (assetsFile.valid)
|
||||||
{
|
|
||||||
//make use of the bundle file version
|
|
||||||
assetsFile.m_Version = b_File.versionEngine;
|
|
||||||
assetsFile.version = Array.ConvertAll((b_File.versionEngine.Split(AssetsFile.strverSplit, StringSplitOptions.RemoveEmptyEntries)), int.Parse);
|
|
||||||
assetsFile.buildType = b_File.versionEngine.Split(AssetsFile.buildTypeSplit, StringSplitOptions.RemoveEmptyEntries);
|
|
||||||
}
|
|
||||||
if (validAssetsFile)
|
|
||||||
{
|
{
|
||||||
|
assetsFile.bundlePath = bundleFileName;
|
||||||
|
if (assetsFile.fileGen == 6 && Path.GetFileName(bundleFileName) != "mainData") //2.6.x and earlier don't have a string version before the preload table
|
||||||
|
{
|
||||||
|
//make use of the bundle file version
|
||||||
|
assetsFile.m_Version = b_File.versionEngine;
|
||||||
|
assetsFile.version = Array.ConvertAll((from Match m in Regex.Matches(assetsFile.m_Version, @"[0-9]") select m.Value).ToArray(), int.Parse);
|
||||||
|
assetsFile.buildType = b_File.versionEngine.Split(AssetsFile.buildTypeSplit, StringSplitOptions.RemoveEmptyEntries);
|
||||||
|
}
|
||||||
b_assetsfileList.Add(assetsFile);
|
b_assetsfileList.Add(assetsFile);
|
||||||
}
|
}
|
||||||
assetsfileandstream[assetsFile.fileName] = assetsFile.a_Stream;
|
assetsfileandstream[assetsFile.fileName] = assetsFile.a_Stream;
|
||||||
@@ -381,7 +365,10 @@ namespace Unity_Studio
|
|||||||
{
|
{
|
||||||
var replacename = ab?.m_Container.Find(y => y.second.asset.m_PathID == x.m_PathID)?.first;
|
var replacename = ab?.m_Container.Find(y => y.second.asset.m_PathID == x.m_PathID)?.first;
|
||||||
if (!string.IsNullOrEmpty(replacename))
|
if (!string.IsNullOrEmpty(replacename))
|
||||||
x.Text = replacename.Replace(Path.GetExtension(replacename), "");
|
{
|
||||||
|
var ex = Path.GetExtension(replacename);
|
||||||
|
x.Text = !string.IsNullOrEmpty(ex) ? replacename.Replace(ex, "") : replacename;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
exportableAssets.AddRange(assetsFile.exportableAssets);
|
exportableAssets.AddRange(assetsFile.exportableAssets);
|
||||||
@@ -1304,16 +1291,29 @@ namespace Unity_Studio
|
|||||||
//ob.Append(string.Join(",", m_Mesh.m_Colors));
|
//ob.Append(string.Join(",", m_Mesh.m_Colors));
|
||||||
|
|
||||||
lineSplit = ob.Length;
|
lineSplit = ob.Length;
|
||||||
for (int i = 0; i < m_Mesh.m_VertexCount; i++)
|
if (m_Mesh.m_Colors.Length == m_Mesh.m_VertexCount * 3)
|
||||||
{
|
{
|
||||||
ob.AppendFormat("{0},{1},{2},{3},", m_Mesh.m_Colors[i * 2], m_Mesh.m_Colors[i * 2 + 1], m_Mesh.m_Colors[i * 2 + 2], m_Mesh.m_Colors[i * 2 + 3]);
|
for (int i = 0; i < m_Mesh.m_VertexCount; i++)
|
||||||
|
|
||||||
if (ob.Length - lineSplit > 2000)
|
|
||||||
{
|
{
|
||||||
ob.Append("\n");
|
ob.AppendFormat("{0},{1},{2},{3},", m_Mesh.m_Colors[i * 3], m_Mesh.m_Colors[i * 3 + 1], m_Mesh.m_Colors[i * 3 + 2], 1.0f);
|
||||||
lineSplit = ob.Length;
|
if (ob.Length - lineSplit > 2000)
|
||||||
|
{
|
||||||
|
ob.Append("\n");
|
||||||
|
lineSplit = ob.Length;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (int i = 0; i < m_Mesh.m_VertexCount; i++)
|
||||||
|
{
|
||||||
|
ob.AppendFormat("{0},{1},{2},{3},", m_Mesh.m_Colors[i * 4], m_Mesh.m_Colors[i * 4 + 1], m_Mesh.m_Colors[i * 4 + 2], m_Mesh.m_Colors[i * 4 + 3]);
|
||||||
|
if (ob.Length - lineSplit > 2000)
|
||||||
|
{
|
||||||
|
ob.Append("\n");
|
||||||
|
lineSplit = ob.Length;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
ob.Length--;//remove last comma
|
ob.Length--;//remove last comma
|
||||||
|
|
||||||
@@ -1753,127 +1753,63 @@ namespace Unity_Studio
|
|||||||
|
|
||||||
public static void ExportMesh(Mesh m_Mesh, string exportPath)
|
public static void ExportMesh(Mesh m_Mesh, string exportPath)
|
||||||
{
|
{
|
||||||
Scene m_scene = Scene.CreateScene("Scene");
|
var sb = new StringBuilder();
|
||||||
SceneNode root = m_scene.RootNode;
|
sb.AppendLine("g " + m_Mesh.m_Name);
|
||||||
SceneNode meshnode = Scene.CreateNode(m_scene, m_Mesh.m_Name);
|
#region Vertices
|
||||||
SceneNode.AddChild(root, meshnode);
|
int c = 3;
|
||||||
ManagedFbx.Mesh mesh = Scene.CreateMesh(m_scene, meshnode, "Mesh");
|
if (m_Mesh.m_Vertices.Length == m_Mesh.m_VertexCount * 4)
|
||||||
if (m_Mesh.m_VertexCount > 0)
|
{
|
||||||
|
c = 4;
|
||||||
|
}
|
||||||
|
for (int v = 0; v < m_Mesh.m_VertexCount; v++)
|
||||||
|
{
|
||||||
|
sb.AppendFormat("v {0} {1} {2}\r\n", -m_Mesh.m_Vertices[v * c], m_Mesh.m_Vertices[v * c + 1], m_Mesh.m_Vertices[v * c + 2]);
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region UV
|
||||||
|
if (m_Mesh.m_UV1 != null && m_Mesh.m_UV1.Length == m_Mesh.m_VertexCount * 2)
|
||||||
{
|
{
|
||||||
#region Vertices
|
|
||||||
int count = 3;
|
|
||||||
if (m_Mesh.m_Vertices.Length == m_Mesh.m_VertexCount * 4)
|
|
||||||
{
|
|
||||||
count = 4;
|
|
||||||
}
|
|
||||||
var vertices = new Vector3[m_Mesh.m_VertexCount];
|
|
||||||
for (int v = 0; v < m_Mesh.m_VertexCount; v++)
|
for (int v = 0; v < m_Mesh.m_VertexCount; v++)
|
||||||
{
|
{
|
||||||
vertices[v] = new Vector3(
|
sb.AppendFormat("vt {0} {1}\r\n", m_Mesh.m_UV1[v * 2], m_Mesh.m_UV1[v * 2 + 1]);
|
||||||
m_Mesh.m_Vertices[v * count],
|
|
||||||
m_Mesh.m_Vertices[v * count + 1],
|
|
||||||
m_Mesh.m_Vertices[v * count + 2]);
|
|
||||||
}
|
}
|
||||||
mesh.Vertices = vertices;
|
|
||||||
#endregion
|
|
||||||
#region Indicies
|
|
||||||
List<int> indices = new List<int>();
|
|
||||||
for (int i = 0; i < m_Mesh.m_Indices.Count; i = i + 3)
|
|
||||||
{
|
|
||||||
indices.Add((int)m_Mesh.m_Indices[i]);
|
|
||||||
indices.Add((int)m_Mesh.m_Indices[i + 1]);
|
|
||||||
indices.Add((int)m_Mesh.m_Indices[i + 2]);
|
|
||||||
}
|
|
||||||
mesh.AddPolygons(indices, 0);
|
|
||||||
#endregion
|
|
||||||
#region Normals
|
|
||||||
if (m_Mesh.m_Normals != null && m_Mesh.m_Normals.Length > 0)
|
|
||||||
{
|
|
||||||
if (m_Mesh.m_Normals.Length == m_Mesh.m_VertexCount * 3)
|
|
||||||
{
|
|
||||||
count = 3;
|
|
||||||
}
|
|
||||||
else if (m_Mesh.m_Normals.Length == m_Mesh.m_VertexCount * 4)
|
|
||||||
{
|
|
||||||
count = 4;
|
|
||||||
}
|
|
||||||
|
|
||||||
var normals = new Vector3[m_Mesh.m_VertexCount];
|
|
||||||
for (int n = 0; n < m_Mesh.m_VertexCount; n++)
|
|
||||||
{
|
|
||||||
normals[n] = new Vector3(
|
|
||||||
m_Mesh.m_Normals[n * count],
|
|
||||||
m_Mesh.m_Normals[n * count + 1],
|
|
||||||
m_Mesh.m_Normals[n * count + 2]);
|
|
||||||
}
|
|
||||||
mesh.Normals = normals;
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
#region Colors
|
|
||||||
if (m_Mesh.m_Colors == null)
|
|
||||||
{
|
|
||||||
var colors = new Colour[m_Mesh.m_VertexCount];
|
|
||||||
for (int c = 0; c < m_Mesh.m_VertexCount; c++)
|
|
||||||
{
|
|
||||||
colors[c] = new Colour(
|
|
||||||
0.5f, 0.5f, 0.5f, 1.0f);
|
|
||||||
}
|
|
||||||
mesh.VertexColours = colors;
|
|
||||||
}
|
|
||||||
else if (m_Mesh.m_Colors.Length == m_Mesh.m_VertexCount * 3)
|
|
||||||
{
|
|
||||||
var colors = new Colour[m_Mesh.m_VertexCount];
|
|
||||||
for (int c = 0; c < m_Mesh.m_VertexCount; c++)
|
|
||||||
{
|
|
||||||
colors[c] = new Colour(
|
|
||||||
m_Mesh.m_Colors[c * 4],
|
|
||||||
m_Mesh.m_Colors[c * 4 + 1],
|
|
||||||
m_Mesh.m_Colors[c * 4 + 2],
|
|
||||||
1.0f);
|
|
||||||
}
|
|
||||||
mesh.VertexColours = colors;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
var colors = new Colour[m_Mesh.m_VertexCount];
|
|
||||||
for (int c = 0; c < m_Mesh.m_VertexCount; c++)
|
|
||||||
{
|
|
||||||
colors[c] = new Colour(
|
|
||||||
m_Mesh.m_Colors[c * 4],
|
|
||||||
m_Mesh.m_Colors[c * 4 + 1],
|
|
||||||
m_Mesh.m_Colors[c * 4 + 2],
|
|
||||||
m_Mesh.m_Colors[c * 4 + 3]);
|
|
||||||
}
|
|
||||||
mesh.VertexColours = colors;
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
#region UV
|
|
||||||
if (m_Mesh.m_UV1 != null && m_Mesh.m_UV1.Length == m_Mesh.m_VertexCount * 2)
|
|
||||||
{
|
|
||||||
var uv = new Vector2[m_Mesh.m_VertexCount];
|
|
||||||
for (int c = 0; c < m_Mesh.m_VertexCount; c++)
|
|
||||||
{
|
|
||||||
uv[c] = new Vector2(m_Mesh.m_UV1[c * 2], m_Mesh.m_UV1[c * 2 + 1]);
|
|
||||||
}
|
|
||||||
mesh.TextureCoords = uv;
|
|
||||||
}
|
|
||||||
else if (m_Mesh.m_UV2 != null && m_Mesh.m_UV2.Length == m_Mesh.m_VertexCount * 2)
|
|
||||||
{
|
|
||||||
var uv = new Vector2[m_Mesh.m_VertexCount];
|
|
||||||
for (int c = 0; c < m_Mesh.m_VertexCount; c++)
|
|
||||||
{
|
|
||||||
uv[c] = new Vector2(m_Mesh.m_UV2[c * 2], m_Mesh.m_UV2[c * 2 + 1]);
|
|
||||||
}
|
|
||||||
mesh.TextureCoords = uv;
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
}
|
}
|
||||||
SceneNode.AddMesh(meshnode, mesh);
|
else if (m_Mesh.m_UV2 != null && m_Mesh.m_UV2.Length == m_Mesh.m_VertexCount * 2)
|
||||||
|
{
|
||||||
|
for (int v = 0; v < m_Mesh.m_VertexCount; v++)
|
||||||
|
{
|
||||||
|
sb.AppendFormat("vt {0} {1}\r\n", m_Mesh.m_UV2[v * 2], m_Mesh.m_UV2[v * 2 + 1]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
//m_scene.Save(exportPath); //default is .fbx
|
#region Normals
|
||||||
//m_scene.Save(exportPath + ".fbx");
|
if (m_Mesh.m_Normals != null && m_Mesh.m_Normals.Length > 0)
|
||||||
m_scene.Save(exportPath + ".obj");
|
{
|
||||||
//m_scene.Save(exportPath + ".dae");
|
if (m_Mesh.m_Normals.Length == m_Mesh.m_VertexCount * 3)
|
||||||
|
{
|
||||||
|
c = 3;
|
||||||
|
}
|
||||||
|
else if (m_Mesh.m_Normals.Length == m_Mesh.m_VertexCount * 4)
|
||||||
|
{
|
||||||
|
c = 4;
|
||||||
|
}
|
||||||
|
for (int v = 0; v < m_Mesh.m_VertexCount; v++)
|
||||||
|
{
|
||||||
|
sb.AppendFormat("vn {0} {1} {2}\r\n", -m_Mesh.m_Normals[v * c], m_Mesh.m_Normals[v * c + 1], m_Mesh.m_Normals[v * c + 2]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Face
|
||||||
|
for (int f = 0; f < m_Mesh.m_Indices.Count / 3; f++)
|
||||||
|
{
|
||||||
|
sb.AppendFormat("f {0}/{0}/{0} {1}/{1}/{1} {2}/{2}/{2}\r\n", m_Mesh.m_Indices[f * 3 + 2] + 1, m_Mesh.m_Indices[f * 3 + 1] + 1, m_Mesh.m_Indices[f * 3] + 1);
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
File.WriteAllText(exportPath, sb.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool ExportFileExists(string filename)
|
public static bool ExportFileExists(string filename)
|
||||||
|
|||||||
@@ -55,11 +55,6 @@
|
|||||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="ManagedFbx, Version=0.0.0.0, Culture=neutral, processorArchitecture=AMD64">
|
|
||||||
<SpecificVersion>False</SpecificVersion>
|
|
||||||
<HintPath>library\x86\ManagedFbx.dll</HintPath>
|
|
||||||
<Private>False</Private>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="OpenTK, Version=2.0.0.0, Culture=neutral, PublicKeyToken=bad199fe84eb3df4, processorArchitecture=MSIL">
|
<Reference Include="OpenTK, Version=2.0.0.0, Culture=neutral, PublicKeyToken=bad199fe84eb3df4, processorArchitecture=MSIL">
|
||||||
<SpecificVersion>False</SpecificVersion>
|
<SpecificVersion>False</SpecificVersion>
|
||||||
<HintPath>library\OpenTK.dll</HintPath>
|
<HintPath>library\OpenTK.dll</HintPath>
|
||||||
@@ -141,6 +136,16 @@
|
|||||||
<Compile Include="AboutBox.Designer.cs">
|
<Compile Include="AboutBox.Designer.cs">
|
||||||
<DependentUpon>AboutBox.cs</DependentUpon>
|
<DependentUpon>AboutBox.cs</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="Resource1.Designer.cs">
|
||||||
|
<DependentUpon>Resource1.resx</DependentUpon>
|
||||||
|
<AutoGen>True</AutoGen>
|
||||||
|
<DesignTime>True</DesignTime>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="ShaderResource.Designer.cs">
|
||||||
|
<DependentUpon>ShaderResource.resx</DependentUpon>
|
||||||
|
<AutoGen>True</AutoGen>
|
||||||
|
<DesignTime>True</DesignTime>
|
||||||
|
</Compile>
|
||||||
<Compile Include="Unity Classes\AssetBundle.cs" />
|
<Compile Include="Unity Classes\AssetBundle.cs" />
|
||||||
<Compile Include="Unity Studio Classes\AssetPreloadData.cs" />
|
<Compile Include="Unity Studio Classes\AssetPreloadData.cs" />
|
||||||
<Compile Include="Unity Classes\AudioClip.cs" />
|
<Compile Include="Unity Classes\AudioClip.cs" />
|
||||||
@@ -203,14 +208,19 @@
|
|||||||
<DependentUpon>Resources.resx</DependentUpon>
|
<DependentUpon>Resources.resx</DependentUpon>
|
||||||
<DesignTime>True</DesignTime>
|
<DesignTime>True</DesignTime>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<EmbeddedResource Include="Resource1.resx">
|
||||||
|
<Generator>ResXFileCodeGenerator</Generator>
|
||||||
|
<LastGenOutput>Resource1.Designer.cs</LastGenOutput>
|
||||||
|
</EmbeddedResource>
|
||||||
|
<EmbeddedResource Include="ShaderResource.resx">
|
||||||
|
<Generator>ResXFileCodeGenerator</Generator>
|
||||||
|
<LastGenOutput>ShaderResource.Designer.cs</LastGenOutput>
|
||||||
|
</EmbeddedResource>
|
||||||
<EmbeddedResource Include="UnityStudioForm.resx">
|
<EmbeddedResource Include="UnityStudioForm.resx">
|
||||||
<DependentUpon>UnityStudioForm.cs</DependentUpon>
|
<DependentUpon>UnityStudioForm.cs</DependentUpon>
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
</EmbeddedResource>
|
</EmbeddedResource>
|
||||||
<None Include="app.config" />
|
<None Include="app.config" />
|
||||||
<None Include="fs.glsl">
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</None>
|
|
||||||
<None Include="Properties\Settings.settings">
|
<None Include="Properties\Settings.settings">
|
||||||
<Generator>SettingsSingleFileGenerator</Generator>
|
<Generator>SettingsSingleFileGenerator</Generator>
|
||||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||||
@@ -220,9 +230,6 @@
|
|||||||
<DependentUpon>Settings.settings</DependentUpon>
|
<DependentUpon>Settings.settings</DependentUpon>
|
||||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||||
</Compile>
|
</Compile>
|
||||||
<None Include="vs.glsl">
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</None>
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<BootstrapperPackage Include=".NETFramework,Version=v4.0,Profile=Client">
|
<BootstrapperPackage Include=".NETFramework,Version=v4.0,Profile=Client">
|
||||||
|
|||||||
@@ -55,11 +55,6 @@
|
|||||||
<RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent>
|
<RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="ManagedFbx, Version=0.0.0.0, Culture=neutral, processorArchitecture=AMD64">
|
|
||||||
<SpecificVersion>False</SpecificVersion>
|
|
||||||
<HintPath>library\x64\ManagedFbx.dll</HintPath>
|
|
||||||
<Private>False</Private>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="OpenTK, Version=2.0.0.0, Culture=neutral, PublicKeyToken=bad199fe84eb3df4, processorArchitecture=MSIL">
|
<Reference Include="OpenTK, Version=2.0.0.0, Culture=neutral, PublicKeyToken=bad199fe84eb3df4, processorArchitecture=MSIL">
|
||||||
<SpecificVersion>False</SpecificVersion>
|
<SpecificVersion>False</SpecificVersion>
|
||||||
<HintPath>library\OpenTK.dll</HintPath>
|
<HintPath>library\OpenTK.dll</HintPath>
|
||||||
@@ -141,6 +136,16 @@
|
|||||||
<Compile Include="AboutBox.Designer.cs">
|
<Compile Include="AboutBox.Designer.cs">
|
||||||
<DependentUpon>AboutBox.cs</DependentUpon>
|
<DependentUpon>AboutBox.cs</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="Resource1.Designer.cs">
|
||||||
|
<AutoGen>True</AutoGen>
|
||||||
|
<DesignTime>True</DesignTime>
|
||||||
|
<DependentUpon>Resource1.resx</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="ShaderResource.Designer.cs">
|
||||||
|
<AutoGen>True</AutoGen>
|
||||||
|
<DesignTime>True</DesignTime>
|
||||||
|
<DependentUpon>ShaderResource.resx</DependentUpon>
|
||||||
|
</Compile>
|
||||||
<Compile Include="Unity Classes\AssetBundle.cs" />
|
<Compile Include="Unity Classes\AssetBundle.cs" />
|
||||||
<Compile Include="Unity Studio Classes\AssetPreloadData.cs" />
|
<Compile Include="Unity Studio Classes\AssetPreloadData.cs" />
|
||||||
<Compile Include="Unity Classes\AudioClip.cs" />
|
<Compile Include="Unity Classes\AudioClip.cs" />
|
||||||
@@ -203,14 +208,19 @@
|
|||||||
<DependentUpon>Resources.resx</DependentUpon>
|
<DependentUpon>Resources.resx</DependentUpon>
|
||||||
<DesignTime>True</DesignTime>
|
<DesignTime>True</DesignTime>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<EmbeddedResource Include="Resource1.resx">
|
||||||
|
<Generator>ResXFileCodeGenerator</Generator>
|
||||||
|
<LastGenOutput>Resource1.Designer.cs</LastGenOutput>
|
||||||
|
</EmbeddedResource>
|
||||||
|
<EmbeddedResource Include="ShaderResource.resx">
|
||||||
|
<Generator>ResXFileCodeGenerator</Generator>
|
||||||
|
<LastGenOutput>ShaderResource.Designer.cs</LastGenOutput>
|
||||||
|
</EmbeddedResource>
|
||||||
<EmbeddedResource Include="UnityStudioForm.resx">
|
<EmbeddedResource Include="UnityStudioForm.resx">
|
||||||
<DependentUpon>UnityStudioForm.cs</DependentUpon>
|
<DependentUpon>UnityStudioForm.cs</DependentUpon>
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
</EmbeddedResource>
|
</EmbeddedResource>
|
||||||
<None Include="app.config" />
|
<None Include="app.config" />
|
||||||
<None Include="fs.glsl">
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</None>
|
|
||||||
<None Include="Properties\Settings.settings">
|
<None Include="Properties\Settings.settings">
|
||||||
<Generator>SettingsSingleFileGenerator</Generator>
|
<Generator>SettingsSingleFileGenerator</Generator>
|
||||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||||
@@ -220,9 +230,6 @@
|
|||||||
<DependentUpon>Settings.settings</DependentUpon>
|
<DependentUpon>Settings.settings</DependentUpon>
|
||||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||||
</Compile>
|
</Compile>
|
||||||
<None Include="vs.glsl">
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</None>
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<BootstrapperPackage Include=".NETFramework,Version=v4.0,Profile=Client">
|
<BootstrapperPackage Include=".NETFramework,Version=v4.0,Profile=Client">
|
||||||
|
|||||||
22
Unity Studio/UnityStudioForm.Designer.cs
generated
22
Unity Studio/UnityStudioForm.Designer.cs
generated
@@ -105,6 +105,8 @@
|
|||||||
this.saveFileDialog1 = new System.Windows.Forms.SaveFileDialog();
|
this.saveFileDialog1 = new System.Windows.Forms.SaveFileDialog();
|
||||||
this.saveFolderDialog1 = new System.Windows.Forms.SaveFileDialog();
|
this.saveFolderDialog1 = new System.Windows.Forms.SaveFileDialog();
|
||||||
this.treeTip = new System.Windows.Forms.ToolTip(this.components);
|
this.treeTip = new System.Windows.Forms.ToolTip(this.components);
|
||||||
|
this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components);
|
||||||
|
this.showOriginalFileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.menuStrip1.SuspendLayout();
|
this.menuStrip1.SuspendLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
|
||||||
this.splitContainer1.Panel1.SuspendLayout();
|
this.splitContainer1.Panel1.SuspendLayout();
|
||||||
@@ -122,6 +124,7 @@
|
|||||||
this.classPreviewPanel.SuspendLayout();
|
this.classPreviewPanel.SuspendLayout();
|
||||||
this.statusStrip1.SuspendLayout();
|
this.statusStrip1.SuspendLayout();
|
||||||
this.tabPage3.SuspendLayout();
|
this.tabPage3.SuspendLayout();
|
||||||
|
this.contextMenuStrip1.SuspendLayout();
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
//
|
//
|
||||||
// menuStrip1
|
// menuStrip1
|
||||||
@@ -498,6 +501,7 @@
|
|||||||
this.assetListView.ColumnClick += new System.Windows.Forms.ColumnClickEventHandler(this.assetListView_ColumnClick);
|
this.assetListView.ColumnClick += new System.Windows.Forms.ColumnClickEventHandler(this.assetListView_ColumnClick);
|
||||||
this.assetListView.ItemSelectionChanged += new System.Windows.Forms.ListViewItemSelectionChangedEventHandler(this.selectAsset);
|
this.assetListView.ItemSelectionChanged += new System.Windows.Forms.ListViewItemSelectionChangedEventHandler(this.selectAsset);
|
||||||
this.assetListView.RetrieveVirtualItem += new System.Windows.Forms.RetrieveVirtualItemEventHandler(this.assetListView_RetrieveVirtualItem);
|
this.assetListView.RetrieveVirtualItem += new System.Windows.Forms.RetrieveVirtualItemEventHandler(this.assetListView_RetrieveVirtualItem);
|
||||||
|
this.assetListView.MouseClick += new System.Windows.Forms.MouseEventHandler(this.assetListView_MouseClick);
|
||||||
//
|
//
|
||||||
// columnHeaderName
|
// columnHeaderName
|
||||||
//
|
//
|
||||||
@@ -851,6 +855,21 @@
|
|||||||
this.saveFolderDialog1.RestoreDirectory = true;
|
this.saveFolderDialog1.RestoreDirectory = true;
|
||||||
this.saveFolderDialog1.Title = "Browse for folder";
|
this.saveFolderDialog1.Title = "Browse for folder";
|
||||||
//
|
//
|
||||||
|
// contextMenuStrip1
|
||||||
|
//
|
||||||
|
this.contextMenuStrip1.ImageScalingSize = new System.Drawing.Size(20, 20);
|
||||||
|
this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||||
|
this.showOriginalFileToolStripMenuItem});
|
||||||
|
this.contextMenuStrip1.Name = "contextMenuStrip1";
|
||||||
|
this.contextMenuStrip1.Size = new System.Drawing.Size(202, 56);
|
||||||
|
//
|
||||||
|
// showOriginalFileToolStripMenuItem
|
||||||
|
//
|
||||||
|
this.showOriginalFileToolStripMenuItem.Name = "showOriginalFileToolStripMenuItem";
|
||||||
|
this.showOriginalFileToolStripMenuItem.Size = new System.Drawing.Size(201, 24);
|
||||||
|
this.showOriginalFileToolStripMenuItem.Text = "show original file";
|
||||||
|
this.showOriginalFileToolStripMenuItem.Click += new System.EventHandler(this.showOriginalFileToolStripMenuItem_Click);
|
||||||
|
//
|
||||||
// UnityStudioForm
|
// UnityStudioForm
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||||
@@ -891,6 +910,7 @@
|
|||||||
this.statusStrip1.ResumeLayout(false);
|
this.statusStrip1.ResumeLayout(false);
|
||||||
this.statusStrip1.PerformLayout();
|
this.statusStrip1.PerformLayout();
|
||||||
this.tabPage3.ResumeLayout(false);
|
this.tabPage3.ResumeLayout(false);
|
||||||
|
this.contextMenuStrip1.ResumeLayout(false);
|
||||||
this.ResumeLayout(false);
|
this.ResumeLayout(false);
|
||||||
this.PerformLayout();
|
this.PerformLayout();
|
||||||
|
|
||||||
@@ -973,6 +993,8 @@
|
|||||||
private System.Windows.Forms.Label FMODcopyright;
|
private System.Windows.Forms.Label FMODcopyright;
|
||||||
private System.Windows.Forms.ToolStripMenuItem all3DObjectssplitToolStripMenuItem;
|
private System.Windows.Forms.ToolStripMenuItem all3DObjectssplitToolStripMenuItem;
|
||||||
private OpenTK.GLControl glControl1;
|
private OpenTK.GLControl glControl1;
|
||||||
|
private System.Windows.Forms.ContextMenuStrip contextMenuStrip1;
|
||||||
|
private System.Windows.Forms.ToolStripMenuItem showOriginalFileToolStripMenuItem;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -69,6 +69,8 @@ namespace Unity_Studio
|
|||||||
|
|
||||||
private PrivateFontCollection pfc = new PrivateFontCollection();
|
private PrivateFontCollection pfc = new PrivateFontCollection();
|
||||||
|
|
||||||
|
private AssetPreloadData selectasset;
|
||||||
|
|
||||||
[DllImport("gdi32.dll")]
|
[DllImport("gdi32.dll")]
|
||||||
private static extern IntPtr AddFontMemResourceEx(IntPtr pbFont, uint cbFont, IntPtr pdv, [In] ref uint pcFonts);
|
private static extern IntPtr AddFontMemResourceEx(IntPtr pbFont, uint cbFont, IntPtr pdv, [In] ref uint pcFonts);
|
||||||
|
|
||||||
@@ -876,6 +878,7 @@ namespace Unity_Studio
|
|||||||
Shader m_TextAsset = new Shader(asset, true);
|
Shader m_TextAsset = new Shader(asset, true);
|
||||||
string m_Script_Text = Encoding.UTF8.GetString(m_TextAsset.m_Script);
|
string m_Script_Text = Encoding.UTF8.GetString(m_TextAsset.m_Script);
|
||||||
m_Script_Text = Regex.Replace(m_Script_Text, "(?<!\r)\n", "\r\n");
|
m_Script_Text = Regex.Replace(m_Script_Text, "(?<!\r)\n", "\r\n");
|
||||||
|
m_Script_Text = m_Script_Text.Replace("\0", "\\0");
|
||||||
textPreviewBox.Text = m_Script_Text;
|
textPreviewBox.Text = m_Script_Text;
|
||||||
textPreviewBox.Visible = true;
|
textPreviewBox.Visible = true;
|
||||||
break;
|
break;
|
||||||
@@ -997,14 +1000,9 @@ namespace Unity_Studio
|
|||||||
if (m_Mesh.m_Normals != null && m_Mesh.m_Normals.Length > 0)
|
if (m_Mesh.m_Normals != null && m_Mesh.m_Normals.Length > 0)
|
||||||
{
|
{
|
||||||
if (m_Mesh.m_Normals.Length == m_Mesh.m_VertexCount * 3)
|
if (m_Mesh.m_Normals.Length == m_Mesh.m_VertexCount * 3)
|
||||||
{
|
|
||||||
count = 3;
|
count = 3;
|
||||||
}
|
|
||||||
else if (m_Mesh.m_Normals.Length == m_Mesh.m_VertexCount * 4)
|
else if (m_Mesh.m_Normals.Length == m_Mesh.m_VertexCount * 4)
|
||||||
{
|
|
||||||
count = 4;
|
count = 4;
|
||||||
}
|
|
||||||
|
|
||||||
normalData = new Vector3[m_Mesh.m_VertexCount];
|
normalData = new Vector3[m_Mesh.m_VertexCount];
|
||||||
for (int n = 0; n < m_Mesh.m_VertexCount; n++)
|
for (int n = 0; n < m_Mesh.m_VertexCount; n++)
|
||||||
{
|
{
|
||||||
@@ -1014,6 +1012,8 @@ namespace Unity_Studio
|
|||||||
m_Mesh.m_Normals[n * count + 2]);
|
m_Mesh.m_Normals[n * count + 2]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
normalData = null;
|
||||||
#endregion
|
#endregion
|
||||||
#region Colors
|
#region Colors
|
||||||
if (m_Mesh.m_Colors == null)
|
if (m_Mesh.m_Colors == null)
|
||||||
@@ -1031,9 +1031,9 @@ namespace Unity_Studio
|
|||||||
for (int c = 0; c < m_Mesh.m_VertexCount; c++)
|
for (int c = 0; c < m_Mesh.m_VertexCount; c++)
|
||||||
{
|
{
|
||||||
colorData[c] = new Vector4(
|
colorData[c] = new Vector4(
|
||||||
m_Mesh.m_Colors[c * 4],
|
m_Mesh.m_Colors[c * 3],
|
||||||
m_Mesh.m_Colors[c * 4 + 1],
|
m_Mesh.m_Colors[c * 3 + 1],
|
||||||
m_Mesh.m_Colors[c * 4 + 2],
|
m_Mesh.m_Colors[c * 3 + 2],
|
||||||
1.0f);
|
1.0f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1401,6 +1401,7 @@ namespace Unity_Studio
|
|||||||
//防止主界面假死
|
//防止主界面假死
|
||||||
ThreadPool.QueueUserWorkItem(delegate
|
ThreadPool.QueueUserWorkItem(delegate
|
||||||
{
|
{
|
||||||
|
Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");
|
||||||
sceneTreeView.Invoke(new Action(() =>
|
sceneTreeView.Invoke(new Action(() =>
|
||||||
{
|
{
|
||||||
//挂起控件防止更新
|
//挂起控件防止更新
|
||||||
@@ -1508,6 +1509,7 @@ namespace Unity_Studio
|
|||||||
|
|
||||||
ThreadPool.QueueUserWorkItem(delegate
|
ThreadPool.QueueUserWorkItem(delegate
|
||||||
{
|
{
|
||||||
|
Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");
|
||||||
var savePath = saveFolderDialog1.FileName;
|
var savePath = saveFolderDialog1.FileName;
|
||||||
if (Path.GetFileName(savePath) == "Select folder or write folder name to create")
|
if (Path.GetFileName(savePath) == "Select folder or write folder name to create")
|
||||||
{ savePath = Path.GetDirectoryName(saveFolderDialog1.FileName); }
|
{ savePath = Path.GetDirectoryName(saveFolderDialog1.FileName); }
|
||||||
@@ -1577,7 +1579,7 @@ namespace Unity_Studio
|
|||||||
Mesh m_Mesh = new Mesh(asset, true);
|
Mesh m_Mesh = new Mesh(asset, true);
|
||||||
if (!ExportFileExists(exportpath + asset.Text + asset.extension))
|
if (!ExportFileExists(exportpath + asset.Text + asset.extension))
|
||||||
{
|
{
|
||||||
ExportMesh(m_Mesh, exportpath + asset.Text);
|
ExportMesh(m_Mesh, exportpath + asset.Text + asset.extension);
|
||||||
exportedCount++;
|
exportedCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1711,8 +1713,8 @@ namespace Unity_Studio
|
|||||||
GL.Viewport(0, 0, glControl1.ClientSize.Width, glControl1.ClientSize.Height);
|
GL.Viewport(0, 0, glControl1.ClientSize.Width, glControl1.ClientSize.Height);
|
||||||
GL.ClearColor(Color.CadetBlue);
|
GL.ClearColor(Color.CadetBlue);
|
||||||
pgmID = GL.CreateProgram();
|
pgmID = GL.CreateProgram();
|
||||||
loadShader("vs.glsl", ShaderType.VertexShader, pgmID, out vsID);
|
loadShader("vs", ShaderType.VertexShader, pgmID, out vsID);
|
||||||
loadShader("fs.glsl", ShaderType.FragmentShader, pgmID, out fsID);
|
loadShader("fs", ShaderType.FragmentShader, pgmID, out fsID);
|
||||||
GL.LinkProgram(pgmID);
|
GL.LinkProgram(pgmID);
|
||||||
GL.UseProgram(pgmID);
|
GL.UseProgram(pgmID);
|
||||||
attributeVertexPosition = GL.GetAttribLocation(pgmID, "vertexPosition");
|
attributeVertexPosition = GL.GetAttribLocation(pgmID, "vertexPosition");
|
||||||
@@ -1725,10 +1727,8 @@ namespace Unity_Studio
|
|||||||
private void loadShader(string filename, ShaderType type, int program, out int address)
|
private void loadShader(string filename, ShaderType type, int program, out int address)
|
||||||
{
|
{
|
||||||
address = GL.CreateShader(type);
|
address = GL.CreateShader(type);
|
||||||
using (StreamReader sr = new StreamReader(filename))
|
var str = (string)Resource1.ResourceManager.GetObject(filename);
|
||||||
{
|
GL.ShaderSource(address, str);
|
||||||
GL.ShaderSource(address, sr.ReadToEnd());
|
|
||||||
}
|
|
||||||
GL.CompileShader(address);
|
GL.CompileShader(address);
|
||||||
GL.AttachShader(program, address);
|
GL.AttachShader(program, address);
|
||||||
GL.DeleteShader(address);
|
GL.DeleteShader(address);
|
||||||
@@ -1738,7 +1738,7 @@ namespace Unity_Studio
|
|||||||
{
|
{
|
||||||
GL.GenBuffers(1, out vboAddress);
|
GL.GenBuffers(1, out vboAddress);
|
||||||
GL.BindBuffer(BufferTarget.ArrayBuffer, vboAddress);
|
GL.BindBuffer(BufferTarget.ArrayBuffer, vboAddress);
|
||||||
GL.BufferData<Vector3>(BufferTarget.ArrayBuffer,
|
GL.BufferData(BufferTarget.ArrayBuffer,
|
||||||
(IntPtr)(data.Length * Vector3.SizeInBytes),
|
(IntPtr)(data.Length * Vector3.SizeInBytes),
|
||||||
data,
|
data,
|
||||||
BufferUsageHint.StaticDraw);
|
BufferUsageHint.StaticDraw);
|
||||||
@@ -1750,7 +1750,7 @@ namespace Unity_Studio
|
|||||||
{
|
{
|
||||||
GL.GenBuffers(1, out vboAddress);
|
GL.GenBuffers(1, out vboAddress);
|
||||||
GL.BindBuffer(BufferTarget.ArrayBuffer, vboAddress);
|
GL.BindBuffer(BufferTarget.ArrayBuffer, vboAddress);
|
||||||
GL.BufferData<Vector4>(BufferTarget.ArrayBuffer,
|
GL.BufferData(BufferTarget.ArrayBuffer,
|
||||||
(IntPtr)(data.Length * Vector4.SizeInBytes),
|
(IntPtr)(data.Length * Vector4.SizeInBytes),
|
||||||
data,
|
data,
|
||||||
BufferUsageHint.StaticDraw);
|
BufferUsageHint.StaticDraw);
|
||||||
@@ -1781,7 +1781,8 @@ namespace Unity_Studio
|
|||||||
GL.GenVertexArrays(1, out vao);
|
GL.GenVertexArrays(1, out vao);
|
||||||
GL.BindVertexArray(vao);
|
GL.BindVertexArray(vao);
|
||||||
createVBO(out vboPositions, vertexData, attributeVertexPosition);
|
createVBO(out vboPositions, vertexData, attributeVertexPosition);
|
||||||
createVBO(out vboNormals, normalData, attributeNormalDirection);
|
if (normalData != null)
|
||||||
|
createVBO(out vboNormals, normalData, attributeNormalDirection);
|
||||||
createVBO(out vboColors, colorData, attributeVertexColor);
|
createVBO(out vboColors, colorData, attributeVertexColor);
|
||||||
createVBO(out vboViewMatrix, viewMatrixData, uniformViewMatrix);
|
createVBO(out vboViewMatrix, viewMatrixData, uniformViewMatrix);
|
||||||
createEBO(out eboElements, indiceData);
|
createEBO(out eboElements, indiceData);
|
||||||
@@ -1858,5 +1859,21 @@ namespace Unity_Studio
|
|||||||
FMODreset();
|
FMODreset();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void showOriginalFileToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
var args = $"/select, {selectasset.sourceFile.bundlePath ?? selectasset.sourceFile.filePath}";
|
||||||
|
var pfi = new ProcessStartInfo("explorer.exe", args);
|
||||||
|
Process.Start(pfi);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void assetListView_MouseClick(object sender, MouseEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.Button == MouseButtons.Right)
|
||||||
|
{
|
||||||
|
selectasset = (AssetPreloadData)assetListView.Items[assetListView.SelectedIndices[0]];
|
||||||
|
contextMenuStrip1.Show(assetListView, e.X, e.Y);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -149,7 +149,7 @@ The quick brown fox jumps over the lazy dog. 1234567890</value>
|
|||||||
<value>636, 17</value>
|
<value>636, 17</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="openFileDialog1.Filter" xml:space="preserve">
|
<data name="openFileDialog1.Filter" xml:space="preserve">
|
||||||
<value>Unity asset files|level*; globalgamemanagers; mainData; CustomAssetBundle-*; CAB-*; BuildPlayer-*; *.assets; *.sharedAssets|Unity bundle files|*.unity3d; *.unity3d.lz4; *.assetbundle; *.bundle; *.bytes|Unity asset files|*.*|Unity bundle files|*.*</value>
|
<value>Unity asset files|*.*|Unity bundle files|*.*|Unity asset files|level*; globalgamemanagers; mainData; CustomAssetBundle-*; CAB-*; BuildPlayer-*; *.assets; *.sharedAssets|Unity bundle files|*.unity3d; *.unity3d.lz4; *.assetbundle; *.bundle; *.bytes</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="openFolderDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing">
|
<data name="openFolderDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing">
|
||||||
<value>169, 17</value>
|
<value>169, 17</value>
|
||||||
|
|||||||
@@ -1,27 +0,0 @@
|
|||||||
#version 140
|
|
||||||
|
|
||||||
in vec3 surfaceNormal;
|
|
||||||
in vec3 toLightVector;
|
|
||||||
in vec4 color;
|
|
||||||
|
|
||||||
out vec4 outputColor;
|
|
||||||
|
|
||||||
void main()
|
|
||||||
{
|
|
||||||
vec3 lightColor = vec3(0.5, 0.5, 0.5);
|
|
||||||
|
|
||||||
// Ambient
|
|
||||||
float ambientStrength = 0.9;
|
|
||||||
vec3 ambient = ambientStrength * lightColor;
|
|
||||||
|
|
||||||
// Diffuse
|
|
||||||
vec3 unitNormal = normalize(surfaceNormal);
|
|
||||||
vec3 unitLightVector = normalize(toLightVector);
|
|
||||||
float nDotProduct = dot(unitNormal, unitLightVector);
|
|
||||||
float brightness = clamp(nDotProduct, 0, 1); // max(nDotProduct, 0.0);
|
|
||||||
vec3 diffuse = brightness * lightColor;
|
|
||||||
|
|
||||||
// Output Color
|
|
||||||
vec4 result = color * vec4((ambient + diffuse/2), 0.0);
|
|
||||||
outputColor = result;
|
|
||||||
}
|
|
||||||
Binary file not shown.
Binary file not shown.
@@ -1,19 +0,0 @@
|
|||||||
#version 140
|
|
||||||
|
|
||||||
in vec3 vertexPosition;
|
|
||||||
in vec3 normalDirection;
|
|
||||||
in vec4 vertexColor;
|
|
||||||
uniform mat4 viewMatrix;
|
|
||||||
|
|
||||||
out vec3 surfaceNormal;
|
|
||||||
out vec3 toLightVector;
|
|
||||||
out vec4 color;
|
|
||||||
|
|
||||||
void main()
|
|
||||||
{
|
|
||||||
vec3 lightPosition = vec3(200.0, 200.0, 200.0);
|
|
||||||
gl_Position = viewMatrix * vec4(vertexPosition, 1.0);
|
|
||||||
surfaceNormal = normalDirection;
|
|
||||||
toLightVector = lightPosition - vertexPosition;
|
|
||||||
color = vertexColor;
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user