-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit b9f5c89
Showing
28 changed files
with
1,978 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
* -text | ||
|
||
*.cs text eol=lf diff=csharp | ||
*.shader text eol=lf | ||
*.cginc text eol=lf | ||
*.hlsl text eol=lf | ||
*.compute text eol=lf | ||
|
||
*.meta text eol=lf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Windows | ||
Thumbs.db | ||
Desktop.ini | ||
|
||
# macOS | ||
.DS_Store | ||
|
||
# Code Editors | ||
/.idea | ||
/.vscode | ||
/*.csproj | ||
/*.sln | ||
*.swp | ||
*.vcxproj.user | ||
|
||
# Unity | ||
/Library | ||
/Logs | ||
/Temp |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
using UnityEngine; | ||
using UnityEngine.Rendering; | ||
using UnityEditor; | ||
using UnityEditor.Experimental.AssetImporters; | ||
using Path = System.IO.Path; | ||
|
||
namespace Mgi | ||
{ | ||
[ScriptedImporter(1, "mgi")] | ||
class MgiImporter : ScriptedImporter | ||
{ | ||
#region ScriptedImporter implementation | ||
|
||
public override void OnImportAsset(AssetImportContext context) | ||
{ | ||
var gameObject = new GameObject(); | ||
var mesh = ImportAsMesh(context.assetPath); | ||
|
||
var meshFilter = gameObject.AddComponent<MeshFilter>(); | ||
meshFilter.sharedMesh = mesh; | ||
|
||
var meshRenderer = gameObject.AddComponent<MeshRenderer>(); | ||
meshRenderer.sharedMaterial = | ||
AssetDatabase.GetBuiltinExtraResource<Material>("Default-Diffuse.mat"); | ||
|
||
context.AddObjectToAsset("prefab", gameObject); | ||
if (mesh != null) context.AddObjectToAsset("mesh", mesh); | ||
|
||
context.SetMainObject(gameObject); | ||
} | ||
|
||
#endregion | ||
|
||
#region Reader implementation | ||
|
||
Mesh ImportAsMesh(string path) | ||
{ | ||
var mesh = new Mesh(); | ||
mesh.name = Path.GetFileNameWithoutExtension(path); | ||
mesh.SetVertices(new [] { new Vector3(0, 0, 0), new Vector3(0, 1, 0), new Vector3(1, 0, 0) }); | ||
mesh.SetIndices(new [] { 0, 1, 2 }, MeshTopology.Triangles, 0); | ||
mesh.UploadMeshData(true); | ||
return mesh; | ||
} | ||
|
||
#endregion | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.