/// <summary> /// Initializes the radar behavior /// </summary> protected override void Initialize() { base.Initialize(); this.screenplay = this.EntityManager.Find("ScreenplayManager").FindComponent<ScreenplayManager>(); foreach (var fighter in this.screenplay.FighterList) { if (fighter.State == FighterState.Player) { continue; } Transform3D radarTickTransform; StandardMaterial radarTickMaterial; Entity radarTick = new Entity() .AddComponent(radarTickTransform = new Transform3D()) .AddComponent(new Model("Content/Models/Hud/HudRadarTick.FBX")) .AddComponent(new ModelRenderer()) .AddComponent(new MaterialsMap(radarTickMaterial = new StandardMaterial(typeof(CockpitAdditiveLayer), "Content/Textures/Hud/RadarTick.png") { DiffuseColor = colors[(int)fighter.State] })) ; radarTick.Enabled = false; this.Owner.AddChild(radarTick); this.radarTicks.Add(radarTickTransform); this.radarTickMaterials.Add(radarTickMaterial); } }
protected override void CreateScene() { this.Load(WaveContent.Scenes.MyScene); // First, retrieve the RenderTargetScene from the current context. var renderTargetScene = WaveServices.ScreenContextManager.CurrentContext.FindScene<RenderTargetScene>(); // Creates a Material that uses the RenderTarget as diffuse texture. var renderTargetMaterial = new StandardMaterial(DefaultLayers.Opaque, renderTargetScene.SmallTarget); // Finally, retrieve the cube from the current scene, and set the marial. var cube = this.EntityManager.Find("cube"); cube.FindComponent<MaterialsMap>().DefaultMaterial = renderTargetMaterial; }
/// <summary> /// Loads the specified page. /// </summary> /// <param name="page">The page.</param> /// <param name="path">The path.</param> public void Load(AtlasPage page, string path) { var material = new StandardMaterial() { LightingEnabled = false, DiffusePath = path, VertexColorEnable = true }; material.Initialize(this.assets); var texture = material.Diffuse; page.rendererObject = material; page.width = texture.Width; page.height = texture.Height; }
/// <summary> /// Initializes the instance. /// </summary> protected override void Initialize() { base.Initialize(); this.material = new StandardMaterial() { DiffuseColor = Color.White, LightingEnabled = false, LayerType = DefaultLayers.Alpha }; }
/// <summary> /// Creates a new layer mesh /// </summary> /// <param name="startIndex">Start index.</param> /// <param name="count">Count indices</param> /// <param name="image">Mesh material</param> private void NewMesh(int startIndex, int count, Texture2D image) { Mesh mesh = new Mesh( 0, this.vertices.Length, startIndex * indicesPerTile, count * 2, this.vertexBuffer, this.indexBuffer, PrimitiveType.TriangleList) { DisableBatch = true }; StandardMaterial material = new StandardMaterial(this.LayerType, image) { LightingEnabled = false, SamplerMode = this.samplerMode }; material.Initialize(this.Assets); this.meshes.Add(new Tuple<StandardMaterial, Mesh>(material, mesh)); }
protected override void Start() { base.Start(); if (WaveServices.CameraCapture.IsConnected) { WaveServices.VideoPlayer.OnComplete += (s, e) => { this.StopVideo(); }; WaveServices.CameraCapture.Start(CameraCaptureType.Front); this.tvScreenMaterial = this.Assets.LoadModel<MaterialModel>(WaveContent.Assets.Material.TVScreenMaterial).Material as StandardMaterial; this.tvScreenMaterial.Diffuse = WaveServices.CameraCapture.PreviewTexture; } }
/// <summary> /// Initializes the shockwave behavior /// </summary> protected override void Initialize() { base.Initialize(); this.material = this.materials.DefaultMaterial as StandardMaterial; }