public override async Task <bool> SetInitializer(CRenderContext rc, GamePlay.IEntity host, GamePlay.Component.IComponentContainer hostContainer, GComponentInitializer v) { if (await base.SetInitializer(rc, host, hostContainer, v) == false) { return(false); } mMeshComponent = new GamePlay.Component.GMeshComponent(); var meshCompInit = new GamePlay.Component.GMeshComponent.GMeshComponentInitializer(); meshCompInit.SpecialName = "VisualMesh"; meshCompInit.MeshName = CEngineDesc.PlayerStartMesh; await mMeshComponent.SetInitializer(rc, Host, Host, meshCompInit); //var mat = host.Placement.WorldMatrix; //mMeshComponent.OnUpdateDrawMatrix(ref mat); AgentGeomBoxInitializer = v as AgentGeomBoxComponentInitializer; if (AgentGeomBoxInitializer != null) { AgentGridSize = AgentGeomBoxInitializer.AgentGridSize; StartPos = AgentGeomBoxInitializer.StartPos; } else { AgentGeomBoxInitializer = new AgentGeomBoxComponentInitializer(); } return(true); }
public override async Task <bool> SetInitializer(CRenderContext rc, GActor host, GComponentInitializer v) { if (await base.SetInitializer(rc, host, v) == false) { return(false); } mMeshComponent = new GamePlay.Component.GMeshComponent(); var meshCompInit = new GamePlay.Component.GMeshComponent.GMeshComponentInitializer(); meshCompInit.SpecialName = "VisualMesh"; meshCompInit.MeshName = RName.GetRName("editor/icon/icon_3D/mesh/play_start.gms", RName.enRNameType.Game); await mMeshComponent.SetInitializer(rc, Host, meshCompInit); //var mat = host.Placement.WorldMatrix; //mMeshComponent.OnUpdateDrawMatrix(ref mat); Initializer = v as AgentGeomBoxComponentInitializer; if (Initializer != null) { AgentGridSize = Initializer.AgentGridSize; StartPos = Initializer.StartPos; } else { Initializer = new AgentGeomBoxComponentInitializer(); } return(true); }
public async System.Threading.Tasks.Task InitGraphLines() { LinesGen.Interval = 0.1f; LinesGen.Segement = 0.2f; GraphLines.LinesGen = LinesGen; EngineNS.Graphics.CGfxMaterialInstance mtl = await EngineNS.CEngine.Instance.MaterialInstanceManager.GetMaterialInstanceAsync( EngineNS.CEngine.Instance.RenderContext, EngineNS.RName.GetRName("editor/volume/mi_volume_octree.instmtl"));//rotator EngineNS.Vector3 p1 = Vector3.Lerp(CStartPos, CEndPos, 0.3f); p1.Y = p1.Y + 5.0f; EngineNS.Vector3 p2 = Vector3.Lerp(CStartPos, CEndPos, 0.7f); p2.Y = p1.Y; LinesGen.SetBezier3D(CStartPos, p1, p2, CEndPos, 100); var init = await GraphLines.Init(mtl, 0.0f); //GraphLines.GraphActor.Placement.Location = EngineNS.Vector3.Zero; mLineMeshComponent = GraphLines.GraphActor.GetComponent <GamePlay.Component.GMeshComponent>(); }