模型预览透明背景
This commit is contained in:
@@ -13,7 +13,8 @@ namespace NBF
|
||||
{
|
||||
private ModelViewerSettings _viewerSettings;
|
||||
public Transform modelRoot { get; private set; }
|
||||
|
||||
public Camera Camera => _camera;
|
||||
|
||||
Camera _camera;
|
||||
Image _image;
|
||||
Transform _root;
|
||||
@@ -23,7 +24,7 @@ namespace NBF
|
||||
int _width;
|
||||
int _height;
|
||||
bool _cacheTexture;
|
||||
float _rotating;
|
||||
Vector3 _rotating;
|
||||
|
||||
const int RENDER_LAYER = 0;
|
||||
const int HIDDEN_LAYER = 10;
|
||||
@@ -102,7 +103,7 @@ namespace NBF
|
||||
_model = null;
|
||||
}
|
||||
|
||||
_rotating = 0;
|
||||
_rotating = Vector3.zero;
|
||||
}
|
||||
|
||||
|
||||
@@ -168,10 +169,7 @@ namespace NBF
|
||||
};
|
||||
// _renderTexture.Create();
|
||||
_image.texture = new NTexture(_renderTexture);
|
||||
_image.shader = "Unlit/Transparent"; //Shader.Find("Unlit/Transparent");
|
||||
// _material = new Material(Shader.Find("Unlit/Transparent"));
|
||||
// _image.blendMode = BlendMode.Off;
|
||||
// _image.blendMode = BlendMode.Normal;
|
||||
_image.shader = "Unlit/Transparent";
|
||||
}
|
||||
|
||||
void DestroyTexture()
|
||||
@@ -206,10 +204,10 @@ namespace NBF
|
||||
|
||||
void Render(object param = null)
|
||||
{
|
||||
if (_rotating != 0 && modelRoot != null)
|
||||
if (_rotating != Vector3.zero && this.modelRoot != null)
|
||||
{
|
||||
Vector3 localRotation = modelRoot.localRotation.eulerAngles;
|
||||
localRotation.y += _rotating;
|
||||
localRotation += _rotating;
|
||||
modelRoot.localRotation = Quaternion.Euler(localRotation);
|
||||
}
|
||||
|
||||
@@ -236,6 +234,19 @@ namespace NBF
|
||||
}
|
||||
}
|
||||
|
||||
#region 旋转
|
||||
|
||||
public void StartRotate(Vector3 delta)
|
||||
{
|
||||
_rotating = delta;
|
||||
}
|
||||
|
||||
public void StopRotate()
|
||||
{
|
||||
_rotating = Vector3.zero;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region MyRegion
|
||||
|
||||
|
||||
Reference in New Issue
Block a user