//加载静态模型并将当前材质赋给模型 public void LoadStaticMesh(string pkg, string file) { try { using (NexusEngineExtension.NWaitCursor wc = new NexusEngineExtension.NWaitCursor(this)) { NResourceLoc resLoc = new NResourceLoc(pkg, file); m_resStaticMesh = NResourceManager.Instance.LoadStaticMesh( resLoc, EResourceIOMode.Block, EResourceIOPriority.Normal ); for (int i = 0; i < m_resStaticMesh.GetNumLOD(); ++i) { for (int j = 0; j < m_resStaticMesh.GetNumSection(i); ++j) { m_resStaticMesh.ImportSetMaterial(i, j, m_Material); } } m_preview.ShowStaticMesh(m_resStaticMesh); m_Sphere = null; } } catch (System.Exception ex) { NexusEditor.Program.ShowException(ex, "Load Static Mesh FAILED"); } }
public NShapeComponent ShowSphereShapeComponent(float radius, int numRings, int numSections) { try { m_level.DestroyAllActors(); //-- create a actor for mesh NActor meshActor = m_level.CreateActor("StaticMeshActor", "nactor"); NActorComponent comp = meshActor.CreateComponent("MeshComp", "nshape_component"); NShapeComponent meshComp = comp as NShapeComponent; meshComp.CreateSphere(radius, numRings, numSections); m_actorBox = meshComp.GetBoundingBox(); //-- add default light AddDefaultLight(); m_resActorComp = comp; return(meshComp); } catch (System.Exception e) { NexusEditor.Program.ShowException(e, "Static Mesh Preview Open FAILED!"); return(null); } }
public void LoadSphere() { m_Sphere = m_preview.ShowSphereShapeComponent(500, 18, 18); if (m_Material != null) { m_Sphere.SetMaterial(m_Material); } m_resStaticMesh = null; }
public new void Close() { if (m_resStaticMesh != null) { m_resStaticMesh.Dispose(); m_resStaticMesh = null; } m_Sphere = null; m_preview.Dispose(); m_finalClose = true; base.Close(); }