Beispiel #1
0
        public override void PostCreateActor(NexusEngine.NActor actor)
        {
            base.PostCreateActor(actor);

            //创建体积雾部件
            actor.CreateComponent("WaterComponent", "nwater_component");

            //创建显示用部件
            NResourceLoc         res      = new NResourceLoc("engine_data", "/editor_res/ball.nmdl");
            NActorComponent      comp     = actor.CreateComponent("WaterSignBoard", "nstatic_editor_mesh_component");
            NStaticMeshComponent meshComp = comp as NStaticMeshComponent;

            meshComp.ResetResource(res);
        }
Beispiel #2
0
        public override void PostCreateActor(NexusEngine.NActor actor)
        {
            base.PostCreateActor(actor);

            //创建光源部件
            actor.CreateComponent("DirectionalLightComponent", "ndirectional_light_component");

            //创建显示用部件
            NResourceLoc         res      = new NResourceLoc("engine_data", "/editor_res/light.nmdl");
            NActorComponent      comp     = actor.CreateComponent("LightSignBoard", "nstatic_editor_mesh_component");
            NStaticMeshComponent meshComp = comp as NStaticMeshComponent;

            meshComp.ResetResource(res);
        }
Beispiel #3
0
        static private void CreateActorComponent(NActor newActor, NResourceLoc res)
        {
            try
            {
                switch (res.FileExtension)
                {
                case "nmdl":
                {
                    NActorComponent comp = newActor.CreateComponent(
                        MakeComponentName("StaticMesh_", res),
                        "nstatic_mesh_component");
                    NStaticMeshComponent meshComp = comp as NStaticMeshComponent;
                    meshComp.ResetResource(res);
                }
                break;

                case "spt":
                {
                    NActorComponent comp = newActor.CreateComponent(
                        MakeComponentName("SPTComp_", res),
                        "nspeed_tree_component");
                    NSpeedTreeComponent sptComp = comp as NSpeedTreeComponent;
                    sptComp.Create(res);
                }
                break;

                case "nam":
                {
                    NActorComponent comp = newActor.CreateComponent(
                        MakeComponentName("AnimMeshComp_", res),
                        "nanim_mesh_component");
                    NAnimMeshComponent meshComp = comp as NAnimMeshComponent;
                    meshComp.ResetResource(res);
                }
                break;
                }// end of switch
            }
            catch (System.Exception e)
            {
                NexusEditor.Program.ShowException(e, "Create Resource Actor Component FAILED!");
            }
        }
        public void ShowStaticMesh(NResourceStaticMesh mesh)
        {
            try
            {
                m_level.DestroyAllActors();

                //-- create a actor for mesh
                NActor               meshActor = m_level.CreateActor("StaticMeshActor", "nactor");
                NActorComponent      comp      = meshActor.CreateComponent("MeshComp", "nstatic_mesh_component");
                NStaticMeshComponent meshComp  = comp as NStaticMeshComponent;
                meshComp.ResetResource(mesh);
                m_actorBox = meshComp.GetBoundingBox();

                //-- add default light
                AddDefaultLight();
            }
            catch (System.Exception e)
            {
                NexusEditor.Program.ShowException(e, "Static Mesh Preview Open FAILED!");
            }
        }