static int _s_set_sharedMesh(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); UnityEngine.MeshFilter gen_to_be_invoked = (UnityEngine.MeshFilter)translator.FastGetCSObj(L, 1); gen_to_be_invoked.sharedMesh = (UnityEngine.Mesh)translator.GetObject(L, 2, typeof(UnityEngine.Mesh)); } catch (System.Exception gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + gen_e)); } return(0); }
static int _g_get_mesh(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); UnityEngine.MeshFilter gen_to_be_invoked = (UnityEngine.MeshFilter)translator.FastGetCSObj(L, 1); translator.Push(L, gen_to_be_invoked.mesh); } catch (System.Exception gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + gen_e)); } return(1); }
static StackObject *get_mesh_2(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj) { CSHotFix.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject *ptr_of_this_method; StackObject *__ret = ILIntepreter.Minus(__esp, 1); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); UnityEngine.MeshFilter instance_of_this_method = (UnityEngine.MeshFilter) typeof(UnityEngine.MeshFilter).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); var result_of_this_method = instance_of_this_method.mesh; return(ILIntepreter.PushObject(__ret, __mStack, result_of_this_method)); }
/// <summary> /// copies components from parent object /// </summary> public void Start() { childGameObject = new UnityEngine.GameObject(); childGameObject.transform.parent = transform; childGameObject.transform.localPosition = offset; childGameObject.transform.localScale = UnityEngine.Vector3.one; childGameObject.transform.localRotation = UnityEngine.Quaternion.identity; childlineRend = childGameObject.AddComponent <UnityEngine.LineRenderer>(); childmeshFilt = childGameObject.AddComponent <UnityEngine.MeshFilter>(); copyLine(); copyMesh(); }
public unsafe void Convert(Entity entity, EntityManager dstManager, GameObjectConversionSystem conversionSystem) { UnityEngine.MeshFilter meshFilter = this.GetComponent <UnityEngine.MeshFilter>(); PhysicsCollider physicsCollider = new PhysicsCollider { Value = BoxCollider.Create ( CollisionGeomeotrySingleton.Instance.CreateOrGetBoxGeometry(meshFilter.mesh.bounds.size), CollisionFilterSingleton.Instance.BelongsToPlayerFilter ) }; dstManager.AddComponentData(entity, physicsCollider); }
/// <summary> /// Sends the mesh filter's triangles and their acoustic texture to Spatial Audio /// </summary> /// <param name="acousticTexture"></param> /// <param name="meshFilter"></param> public static void AddGeometrySet(AK.Wwise.AcousticTexture acousticTexture, UnityEngine.MeshFilter meshFilter) { if (meshFilter == null) { UnityEngine.Debug.Log(meshFilter.name + ": No mesh found!"); } else { var mesh = meshFilter.sharedMesh; var vertices = mesh.vertices; var triangles = mesh.triangles; var count = mesh.triangles.Length / 3; using (var triangleArray = new AkTriangleArray(count)) { for (var i = 0; i < count; ++i) { using (var triangle = triangleArray.GetTriangle(i)) { var point0 = meshFilter.transform.TransformPoint(vertices[triangles[3 * i + 0]]); var point1 = meshFilter.transform.TransformPoint(vertices[triangles[3 * i + 1]]); var point2 = meshFilter.transform.TransformPoint(vertices[triangles[3 * i + 2]]); triangle.point0.X = point0.x; triangle.point0.Y = point0.y; triangle.point0.Z = point0.z; triangle.point1.X = point1.x; triangle.point1.Y = point1.y; triangle.point1.Z = point1.z; triangle.point2.X = point2.x; triangle.point2.Y = point2.y; triangle.point2.Z = point2.z; triangle.textureID = (uint)acousticTexture.ID; triangle.reflectorChannelMask = unchecked ((uint)-1); triangle.strName = meshFilter.gameObject.name + "_" + i; } } AkSoundEngine.SetGeometry((ulong)meshFilter.GetInstanceID(), triangleArray, (uint)count); } } }
static int __CreateInstance(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); if (LuaAPI.lua_gettop(L) == 1) { UnityEngine.MeshFilter gen_ret = new UnityEngine.MeshFilter(); translator.Push(L, gen_ret); return(1); } } catch (System.Exception gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + gen_e)); } return(LuaAPI.luaL_error(L, "invalid arguments to UnityEngine.MeshFilter constructor!")); }
static StackObject *set_sharedMesh_1(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj) { CSHotFix.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject *ptr_of_this_method; StackObject *__ret = ILIntepreter.Minus(__esp, 2); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); UnityEngine.Mesh @value = (UnityEngine.Mesh) typeof(UnityEngine.Mesh).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); ptr_of_this_method = ILIntepreter.Minus(__esp, 2); UnityEngine.MeshFilter instance_of_this_method = (UnityEngine.MeshFilter) typeof(UnityEngine.MeshFilter).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); instance_of_this_method.sharedMesh = value; return(__ret); }
static int _m_GetMeshFilter(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); Pathfinding.RecastMeshObj gen_to_be_invoked = (Pathfinding.RecastMeshObj)translator.FastGetCSObj(L, 1); { UnityEngine.MeshFilter gen_ret = gen_to_be_invoked.GetMeshFilter( ); translator.Push(L, gen_ret); return(1); } } catch (System.Exception gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + gen_e)); } }
private void Awake() { #if UNITY_EDITOR if (UnityEditor.BuildPipeline.isBuildingPlayer || AkUtilities.IsMigrating) { return; } var reference = AkUtilities.DragAndDropObjectReference; if (reference) { UnityEngine.GUIUtility.hotControl = 0; AcousticTexture.ObjectReference = reference; } if (!UnityEditor.EditorApplication.isPlaying) { return; } #endif MeshFilter = GetComponent <UnityEngine.MeshFilter>(); }
private void Awake() { MeshFilter = GetComponent <UnityEngine.MeshFilter>(); }
/// <summary> /// Sends the mesh filter's triangles and their acoustic texture to Spatial Audio /// </summary> /// <param name="acousticTexture"></param> /// <param name="meshFilter"></param> public static void AddGeometrySet(AK.Wwise.AcousticTexture acousticTexture, UnityEngine.MeshFilter meshFilter, ulong roomID, bool enableDiffraction, bool enableDiffractionOnBoundaryEdges) { if (!AkSoundEngine.IsInitialized()) { return; } if (meshFilter == null) { UnityEngine.Debug.Log("AddGeometrySet(): No mesh found!"); } else { var mesh = meshFilter.sharedMesh; var vertices = mesh.vertices; var triangles = mesh.triangles; // Remove duplicate vertices var vertRemap = new int[vertices.Length]; var uniqueVerts = new System.Collections.Generic.List <UnityEngine.Vector3>(); var vertDict = new System.Collections.Generic.Dictionary <UnityEngine.Vector3, int>(); for (var v = 0; v < vertices.Length; ++v) { int vertIdx = 0; if (!vertDict.TryGetValue(vertices[v], out vertIdx)) { vertIdx = uniqueVerts.Count; uniqueVerts.Add(vertices[v]); vertDict.Add(vertices[v], vertIdx); } vertRemap[v] = vertIdx; } int vertexCount = uniqueVerts.Count; using (var surfaceArray = new AkAcousticSurfaceArray(1)) { var surface = surfaceArray[0]; surface.textureID = acousticTexture.Id; surface.reflectorChannelMask = unchecked ((uint)-1); surface.strName = meshFilter.gameObject.name; using (var vertexArray = new AkVertexArray(vertexCount)) { for (var v = 0; v < vertexCount; ++v) { var point = meshFilter.transform.TransformPoint(uniqueVerts[v]); using (var akVert = vertexArray[v]) { akVert.X = point.x; akVert.Y = point.y; akVert.Z = point.z; } } var numTriangles = mesh.triangles.Length / 3; using (var triangleArray = new AkTriangleArray(numTriangles)) { for (var i = 0; i < numTriangles; ++i) { using (var triangle = triangleArray[i]) { triangle.point0 = (ushort)vertRemap[triangles[3 * i + 0]]; triangle.point1 = (ushort)vertRemap[triangles[3 * i + 1]]; triangle.point2 = (ushort)vertRemap[triangles[3 * i + 2]]; triangle.surface = (ushort)0; } } AkSoundEngine.SetGeometry(GetAkGeometrySetID(meshFilter), triangleArray, (uint)triangleArray.Count(), vertexArray, (uint)vertexArray.Count(), surfaceArray, (uint)surfaceArray.Count(), roomID, enableDiffraction, enableDiffractionOnBoundaryEdges); } } } } }
public static ulong GetAkGeometrySetID(UnityEngine.MeshFilter meshFilter) { return((ulong)meshFilter.GetInstanceID()); }
//--------------------------------------------------------------------------- #endregion //--------------------------------------------------------------------------- #region Private Member Functions //--------------------------------------------------------------------------- /// <summary> /// Initializes this instance. Set default values here. /// </summary> private void Initialize() { _filter = GetComponent<UnityEngine.MeshFilter>(); }
//--------------------------------------------------------------------------- #endregion //--------------------------------------------------------------------------- #region Private Member Functions //--------------------------------------------------------------------------- /// <summary> /// Initializes this instance. Set default values here. /// </summary> private void Initialize() { _filter = GetComponent <UnityEngine.MeshFilter>(); }