/// <summary> /// Attach flats component to an entity. /// </summary> /// <param name="entity">Entity to attach billboards.</param> /// <param name="block">Block to get flats from.</param> private void AddBlockFlats(BaseEntity entity, DaggerfallBlockComponent block) { // Exit if no flats if (block.BlockFlats.Count == 0) { return; } // Add flats to component foreach (var flat in block.BlockFlats) { // Get position Vector3 position = new Vector3(flat.Position.X, flat.Position.Y, flat.Position.Z); // Add billboard component DaggerfallBillboardComponent billboard = new DaggerfallBillboardComponent(core, flat); billboard.Matrix = block.Matrix * Matrix.CreateTranslation(position); entity.Components.Add(billboard); // Add a light commponent for each billboard light source if (flat.Archive == 210) { position.Y += billboard.Size.Y; LightComponent lightComponent = new LightComponent(core, block.Matrix.Translation + position, 750f, Color.White, 1.1f); entity.Components.Add(lightComponent); } } }
/// <summary> /// Attach flats component to an entity. /// </summary> /// <param name="entity">Entity to attach billboards.</param> /// <param name="block">Block to get flats from.</param> private void AddBlockFlats(BaseEntity entity, DaggerfallBlockComponent block) { // Exit if no flats if (block.BlockFlats.Count == 0) { return; } // Add flats to entity foreach (var flat in block.BlockFlats) { // Filter editor flats if (flat.Type == DaggerfallBlockComponent.FlatTypes.Editor) { continue; } // Get position Vector3 position = new Vector3(flat.Position.X, flat.Position.Y, flat.Position.Z); // Add billboard component DaggerfallBillboardComponent billboard = new DaggerfallBillboardComponent(core, flat); billboard.Matrix = block.Matrix * Matrix.CreateTranslation(position); entity.Components.Add(billboard); } }
/// <summary> /// Attach flats component to an entity. /// </summary> /// <param name="entity">Entity to attach billboards.</param> /// <param name="block">Block to get flats from.</param> private void AddBlockFlats(BaseEntity entity, DaggerfallBlockComponent block) { // Exit if no flats if (block.BlockFlats.Count == 0) { return; } // Add flats to entity foreach (var flat in block.BlockFlats) { // Filter editor flats if (flat.Type == DaggerfallBlockComponent.FlatTypes.Editor) { continue; } // Get position Vector3 position = new Vector3(flat.Position.X, flat.Position.Y, flat.Position.Z); // Add billboard component DaggerfallBillboardComponent billboard = new DaggerfallBillboardComponent(core, flat); billboard.Matrix = block.Matrix * Matrix.CreateTranslation(position); entity.Components.Add(billboard); // Add a light component for each billboard light source outside of dungeons if (flat.Archive == 210 && flat.Dungeon == false) { position.Y += billboard.Size.Y; LightComponent lightComponent = new LightComponent(core, block.Matrix.Translation + position, 46f, Color.White, 1.1f); entity.Components.Add(lightComponent); } // Add a light component for each billboard light source inside dungeons // Daggerfall often misses light sources in dungeons, this ensures at least // one small light be positioned over every light source. This is very cheap // with a deferred renderer. if (flat.Archive == 210 && flat.Dungeon == true) { //LightComponent lightComponent = new LightComponent(core, block.Matrix.Translation + position, 6f, Color.White, 1.0f); //entity.Components.Add(lightComponent); } } }