我们创建了 Fontainebleau 演示来说明摄影photogrammetry流程和 LayeredLit 着色器的使用。
您最多选择25个主题 主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 

41 行
1.3 KiB

using UnityEngine;
using UnityEditor;
using System.Collections;
using System;
using System.Linq;
using System.Reflection;
// https://gist.github.com/MattRix/9205bc62d558fef98045
namespace JBooth.VertexPainterPro
{
[InitializeOnLoad]
public class RXLookingGlass
{
public static Type type_HandleUtility;
protected static MethodInfo meth_IntersectRayMesh;
static RXLookingGlass()
{
var editorTypes = typeof(Editor).Assembly.GetTypes();
type_HandleUtility = editorTypes.FirstOrDefault(t => t.Name == "HandleUtility");
meth_IntersectRayMesh = type_HandleUtility.GetMethod("IntersectRayMesh",(BindingFlags.Static | BindingFlags.NonPublic));
}
public static bool IntersectRayMesh(Ray ray, MeshFilter meshFilter, out RaycastHit hit)
{
return IntersectRayMesh(ray,meshFilter.sharedMesh,meshFilter.transform.localToWorldMatrix,out hit);
}
static object[] parameters = new object[4];
public static bool IntersectRayMesh(Ray ray, Mesh mesh, Matrix4x4 matrix, out RaycastHit hit)
{
parameters[0] = ray;
parameters[1] = mesh;
parameters[2] = matrix;
parameters[3] = null;
bool result = (bool)meth_IntersectRayMesh.Invoke(null, parameters);
hit = (RaycastHit)parameters[3];
return result;
}
}
}