Skip to content
This repository has been archived by the owner on Aug 24, 2020. It is now read-only.

Commit

Permalink
Merge branch 'master' into feature/3d-render-texture
Browse files Browse the repository at this point in the history
  • Loading branch information
vertxxyz committed Aug 26, 2019
2 parents 203a13c + c14a306 commit 862dc91
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 5 deletions.
3 changes: 3 additions & 0 deletions Editor/N3DTexturePreview.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System.Reflection;
using UnityEditor;
using UnityEngine;
using Object = UnityEngine.Object;

#if !UNITY_2018_1_OR_NEWER
using System.Linq;
Expand Down Expand Up @@ -89,6 +90,8 @@ protected override void OnDisable()

public override void OnInspectorGUI() => defaultEditor.OnInspectorGUI();

public override Texture2D RenderStaticPreview(string assetPath, Object[] subAssets, int width, int height) => defaultEditor.RenderStaticPreview(assetPath, subAssets, width, height);

private float zoom = 3f;

protected float x = 1, y = 1, z = 1;
Expand Down
3 changes: 3 additions & 0 deletions Editor/NRenderTexturePreview.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Reflection;
using UnityEditor;
using UnityEngine;
using Object = UnityEngine.Object;

namespace Vertx
{
Expand All @@ -27,5 +28,7 @@ protected override void OnDisable()
}

public override void OnInspectorGUI() => defaultEditor.OnInspectorGUI();

public override Texture2D RenderStaticPreview(string assetPath, Object[] subAssets, int width, int height) => defaultEditor.RenderStaticPreview(assetPath, subAssets, width, height);
}
}
3 changes: 3 additions & 0 deletions Editor/NTexturePreview.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using UnityEditor.AnimatedValues;
using UnityEngine;
using UnityEngine.Rendering;
using Object = UnityEngine.Object;

namespace Vertx
{
Expand Down Expand Up @@ -103,6 +104,8 @@ protected override void OnDisable()

public override void OnInspectorGUI() => defaultEditor.OnInspectorGUI();

public override Texture2D RenderStaticPreview(string assetPath, Object[] subAssets, int width, int height) => defaultEditor.RenderStaticPreview(assetPath, subAssets, width, height);

public override bool HasPreviewGUI() => target != null;

private float zoomLevel;
Expand Down
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2018 Thomas Ingram

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
7 changes: 7 additions & 0 deletions LICENSE.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,29 +11,29 @@ Enhanced Texture Previewer for Unity
- Matching Filter Mode (default preview is always Point-filtered)
- Normal Map Diffuse Preview (Right-Mouse, Right-Mouse+Scroll)

![gif](http://vertx.xyz/wp-content/uploads/2018/04/2dTexturePreview.gif)
![gif](http://vertx.xyz/Images/NTexturePreview/2dTexturePreview2.gif)

![gif](http://vertx.xyz/wp-content/uploads/2018/04/NormalMapPreview2.gif)
![gif](http://vertx.xyz/Images/NTexturePreview/NormalMapPreview2.gif)

### 3D Materials

#### Default Material
- Cube preview (default was sphere)
- XYZ Axis Preview Sliders

![gif](http://vertx.xyz/wp-content/uploads/2018/04/3dTexturePreview4.gif)
![gif](http://vertx.xyz/Images/NTexturePreview/3dTexturePreview4.gif)

#### Overrides
You can override the Material used for the 3D Texture Preview. This is done by inheriting from N3DTexturePreview.I3DMaterialOverride.

An example is provided at NTexturePreview/Examples/Custom 3D/Editor/N3DTexturePreviewExample.cs. The file specifically operates on Texture3D assets named "3DTexturePreviewExample", but a method of your own might perform any logic to provide a custom preview material.

![gif](http://vertx.xyz/wp-content/uploads/2018/04/3dTexturePreview2.gif)
![gif](http://vertx.xyz/Images/NTexturePreview/3dTexturePreview2.gif)


## Installation
Ensure your project is on .NET 4.x by navigating to Edit>Project Settings>Player>Configuration>Scripting Runtime Version and switching to .NET 4.x Equivalent.

Pull the project locally and use the Package Manager (Window>Package Manager), adding the package.json file present in the root of the folder with the `+` button.

Or edit your Package.json file to contain `"com.vertx.ntexturepreview": "https://github.com/vertxxyz/NTexturePreview.git",`
Or edit your Package.json file to contain `"com.vertx.ntexturepreview": "https://github.com/vertxxyz/NTexturePreview.git",`

0 comments on commit 862dc91

Please sign in to comment.