Example #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="NiLight"/> class.
 /// </summary>
 /// <param name="file">The file.</param>
 /// <param name="reader">The reader.</param>
 public NiLight(NiFile file, BinaryReader reader) : base(file, reader)
 {
     this.Dimmer        = reader.ReadSingle();
     this.AmbientColor  = reader.ReadColor3();
     this.DiffuseColor  = reader.ReadColor3();
     this.SpecularColor = reader.ReadColor3();
 }
Example #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="NiLight"/> class.
        /// </summary>
        /// <param name="file">The file.</param>
        /// <param name="reader">The reader.</param>
        public NiLight(NiFile file, BinaryReader reader) : base(file, reader)
		{
			this.Dimmer = reader.ReadSingle();
			this.AmbientColor = reader.ReadColor3();
			this.DiffuseColor = reader.ReadColor3();
			this.SpecularColor = reader.ReadColor3();
		}
Example #3
0
        public void DefaultSettings()
        {
            float scale = (float)Math.Max(Math.Min(maxz - minz, maxy - miny), maxx - minx) / 2f;

            camera     = new OpenTK.Vector3(-0.4f, 0, 1) * scale + new Vector3((float)minx, (float)maxy, (float)minz);
            Yaw        = -0.73;
            Pitch      = -0.32;
            MoveSpeed  = scale;
            clearColor = new OpenTK.Graphics.Color4(1.0f, 1, 1, 1);
        }
Example #4
0
        public TextArea(string text, int x0, int y0, int width, int height,
                        Nullable <OpenTK.Graphics.Color4> backgroundColor,
                        Nullable <OpenTK.Graphics.Color4> outlineColor,
                        OpenTK.Graphics.Color4 textColor,
                        int textsize, string fontfilepath = null)
        {
            Text            = text; X0 = x0; Y0 = y0; Width = width; Height = height;
            BackgroundColor = backgroundColor; OutlineColor = outlineColor; TextColor = textColor;

            SetUpFont(textsize, fontfilepath);
        }
Example #5
0
        public void Draw(Mesh mesh, Matrix4 matrix, RenderMode mode, OpenTK.Graphics.Color4 color)
        {
            if (mesh.faceList == null)
            {
                return;
            }

            PreRenderMode(mode);

            DrawMeshInternal(mesh, matrix, null, color);

            PostRenderMode(mode);
        }
Example #6
0
        public TextArea()
        {
            Text = ""; textSize = 14; X0 = 0; Y0 = 0; Width = 128; Height = 128;

            BackgroundColor = null;
            //BackgroundColor = new OpenTK.Graphics.Color4(0F, 0F, 1F, 1F)

            OutlineColor = null;
            //OutlineColor = new OpenTK.Graphics.Color4(0F, 1F, 0F, 1F)

            TextColor = new OpenTK.Graphics.Color4(1F, 0F, 0F, 1F);
            SetUpFont(textSize, "Fonts/woodenFont.qfont");
        }
 public bool OverwriteColor(Gr.Color4 color)
 {
     if (vertices != null)
     {
         for (int i = 0; i < vertices.Length; i++)
         {
             vertices[i].color = color.ToVector();
         }
         return(true);
     }
     else
     {
         return(false);
     }
 }
Example #8
0
    internal override void draw()
    {
        if (!visible || disposed || opacity == 0)
        {
            return;
        }
        if (bmp == null)
        {
            return;
        }
        if (bmp.is_disposed() || bmp.txid == 0)
        {
            return;
        }
        //Console.WriteLine("Drawing sprite at viewport " + viewport.z + " at z " + z);
        //if (is_plane) return; //temp fix
        GL.Enable(EnableCap.Texture2D);
        GL.BindTexture(TextureTarget.Texture2D, bitmap.txid);

        OpenTK.Graphics.Color4 c_val = new OpenTK.Graphics.Color4(1.0f, 1.0f, 1.0f, (1f / 255f) * (float)opacity);
        GL.Color4(c_val);

        //determine pixel size in texels
        float texel_x = 1f / (float)bitmap.width();
        float texel_y = 1f / (float)bitmap.height();
        float depth_z = is_plane ? 1f : 0.9f;

        GL.Begin(PrimitiveType.Quads);
        GL.TexCoord2(texel_x * src_rect.x, texel_y * src_rect.y);
        GL.Vertex3(x - ox, y - oy, depth_z);
        GL.TexCoord2(texel_x * (src_rect.width + src_rect.x), texel_y * src_rect.y);
        GL.Vertex3(x - ox + src_rect.width, y - oy, depth_z);
        GL.TexCoord2(texel_x * (src_rect.width + src_rect.x), texel_y * (src_rect.height + src_rect.y));
        GL.Vertex3(x - ox + src_rect.width, y - oy + src_rect.height, depth_z);
        GL.TexCoord2(texel_x * src_rect.x, texel_y * (src_rect.height + src_rect.y));
        GL.Vertex3(x - ox, y - oy + src_rect.height, depth_z);
        GL.End();
    }
Example #9
0
 /// <summary>
 /// Writes the color3.
 /// </summary>
 /// <param name="writer">The writer.</param>
 /// <param name="value">Color3 value to write.</param>
 public static void WriteColor3(this BinaryWriter writer, Color3 value)
 {
     writer.Write(value.R);
     writer.Write(value.G);
     writer.Write(value.B);
 }
 public static Vector4 ToVector(this Gr.Color4 color) => new Vector4(color.R, color.G, color.B, color.A);
Example #11
0
        /// <summary>
        /// Initializes a new instance of the <see cref="NiFogProperty" /> class.
        /// </summary>
        /// <param name="file">The file.</param>
        /// <param name="reader">The reader.</param>
        public NiFogProperty(NiFile file, BinaryReader reader) : base(file, reader)
		{
			this.Flags = reader.ReadUInt16();
			this.Depth = reader.ReadSingle();
			this.Color = reader.ReadColor3();
		}
Example #12
0
 /// <summary>
 /// Initializes a new instance of the <see cref="NiFogProperty" /> class.
 /// </summary>
 /// <param name="file">The file.</param>
 /// <param name="reader">The reader.</param>
 public NiFogProperty(NiFile file, BinaryReader reader) : base(file, reader)
 {
     this.Flags = reader.ReadUInt16();
     this.Depth = reader.ReadSingle();
     this.Color = reader.ReadColor3();
 }
Example #13
0
 public void addPoint(Vector3 pt, OpenTK.Graphics.Color4 color)
 {
     addPoint(pt, new Vector4(color.R, color.G, color.B, color.A));
 }
Example #14
0
 public void addLine(Vector3 from, Vector3 to, OpenTK.Graphics.Color4 color)
 {
     addLine(from, to, new Vector4(color.R, color.G, color.B, color.A));
 }
Example #15
0
 public Vertex(Vector4 position, Color4 color)
 {
     this.position = position;
     this.color    = color;
 }