// // ModelTexture.cs - represents a texture image for a 3D model // // Author: // Michael Becker // // Copyright (c) 2013-2020 Mike Becker's Software // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program. If not, see . using System; using UniversalEditor.ObjectModels.Multimedia.Picture; namespace UniversalEditor.ObjectModels.Multimedia3D.Model { /// /// Indicates attributes for a texture. /// [Flags()] public enum ModelTextureFlags : int { None = 0, /// /// The texture is a regular texture. /// Texture = 1, /// /// The texture is a sphere map. /// Map = 2, /// /// The texture is an additive sphere map. /// AddMap = 4 } /// /// Represents a texture image for a 3D model. /// public class ModelTexture : ICloneable { public class ModelTextureCollection : System.Collections.ObjectModel.Collection { public ModelTexture Add(string TextureFileName, string MapFileName, ModelTextureFlags Flags) { ModelTexture tex = new ModelTexture(); tex.TextureFileName = TextureFileName; tex.MapFileName = MapFileName; tex.Flags = Flags; base.Add(tex); return tex; } } /// /// Gets or sets the OpenGL index of the texture. /// /// The OpenGL index of the texture. public uint? TextureID { get; set; } = null; /// /// Gets or sets the OpenGL index of the sphere map texture. /// /// The OpenGL index of the sphere map texture. public uint? MapID { get; set; } = null; /// /// Gets or sets the full path to the sphere map image file. /// /// The full path to the sphere map image file. public string MapFileName { get; set; } = null; /// /// Gets or sets the full path to the texture image file. /// /// The full path to the texture image file. public string TextureFileName { get; set; } = null; /// /// Gets or sets the attributes associated with this texture. /// /// The attributes associated with this texture. public ModelTextureFlags Flags { get; set; } = ModelTextureFlags.None; /// /// How long this texture image frame will appear on the associated material, in milliseconds. /// public int Duration { get; set; } = 100; public object Clone() { ModelTexture texture = new ModelTexture(); texture.MapFileName = MapFileName; texture.TextureFileName = TextureFileName; texture.Flags = Flags; texture.MapID = MapID; texture.TextureID = TextureID; return texture; } /// /// Gets or sets the representing the image to use for the texture image of this texture. /// /// The image to use for the texture image of this texture. public PictureObjectModel TexturePicture { get; set; } = null; /// /// Gets or sets the representing the image to use for the sphere map of this texture. /// /// The image to use for the sphere map of this texture. public PictureObjectModel MapPicture { get; set; } = null; } }