Free cookie consent management tool by TermsFeed Policy Generator

source: branches/HeuristicLab.Problems.GaussianProcessTuning/ILNumerics.2.14.4735.573/Drawing/Shapes/VertexDefinitions.cs @ 11826

Last change on this file since 11826 was 9102, checked in by gkronber, 12 years ago

#1967: ILNumerics source for experimentation

File size: 6.0 KB
Line 
1///
2///    This file is part of ILNumerics Community Edition.
3///
4///    ILNumerics Community Edition - high performance computing for applications.
5///    Copyright (C) 2006 - 2012 Haymo Kutschbach, http://ilnumerics.net
6///
7///    ILNumerics Community Edition is free software: you can redistribute it and/or modify
8///    it under the terms of the GNU General Public License version 3 as published by
9///    the Free Software Foundation.
10///
11///    ILNumerics Community Edition is distributed in the hope that it will be useful,
12///    but WITHOUT ANY WARRANTY; without even the implied warranty of
13///    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14///    GNU General Public License for more details.
15///
16///    You should have received a copy of the GNU General Public License
17///    along with ILNumerics Community Edition. See the file License.txt in the root
18///    of your distribution package. If not, see <http://www.gnu.org/licenses/>.
19///
20///    In addition this software uses the following components and/or licenses:
21///
22///    =================================================================================
23///    The Open Toolkit Library License
24///   
25///    Copyright (c) 2006 - 2009 the Open Toolkit library.
26///   
27///    Permission is hereby granted, free of charge, to any person obtaining a copy
28///    of this software and associated documentation files (the "Software"), to deal
29///    in the Software without restriction, including without limitation the rights to
30///    use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
31///    the Software, and to permit persons to whom the Software is furnished to do
32///    so, subject to the following conditions:
33///
34///    The above copyright notice and this permission notice shall be included in all
35///    copies or substantial portions of the Software.
36///
37///    =================================================================================
38///   
39
40#pragma warning disable 1591
41
42using System;
43using System.Collections.Generic;
44using System.Text;
45using System.Drawing;
46using System.Runtime.InteropServices;
47using ILNumerics.Drawing.Interfaces;
48
49namespace ILNumerics.Drawing.Shapes {
50
51    [StructLayout(LayoutKind.Sequential)]
52    public struct C4bV3f : IILVertexDefinition {
53        private byte R;
54        private byte G;
55        private byte B;
56        private byte A;
57        private float X;
58        private float Y;
59        private float Z;
60
61        #region IILVertexDefinition Member
62
63        public bool StoresAlpha {
64            get { return true; }
65        }
66
67        public bool StoresColor {
68            get { return true; }
69        }
70
71        public bool StoresNormals {
72            get { return false; }
73        }
74
75        public int VertexSize {
76            get { return 16; }
77        }
78        public byte Alpha {
79            get { return A;  }
80            set { A = value; }
81        }
82        public Color Color {
83            get {
84                return Color.FromArgb(A,R,G,B); 
85            }
86            set {
87                R = value.R;
88                G = value.G;
89                B = value.B;
90                A = value.A;
91            }
92        }
93        public ILPoint3Df Position {
94            get {
95                return new ILPoint3Df(X,Y,Z);   
96            }
97            set{
98                X = value.X;
99                Y = value.Y;
100                Z = value.Z;
101            }
102        }
103        public ILPoint3Df Normal {
104            get { throw new NotSupportedException(); }
105            set { throw new NotSupportedException(); }
106        }
107        public float XPosition {
108            get { return X; }
109            set { X = value; }
110        }
111        public float YPosition {
112            get { return Y; }
113            set { Y = value; }
114        }
115        public float ZPosition {
116            get { return Z; }
117            set { Z = value; }
118        }
119        #endregion
120    }
121
122    [StructLayout(LayoutKind.Sequential)]
123    public struct C4fN3fV3f : IILVertexDefinition {
124        private float R;
125        private float G;
126        private float B;
127        private float A;
128        private float NX;
129        private float NY;
130        private float NZ;
131        private float X;
132        private float Y;
133        private float Z;
134
135        #region IILVertexDefinition Member
136
137        public bool StoresAlpha {
138            get { return true; }
139        }
140
141        public bool StoresColor {
142            get { return true; }
143        }
144
145        public bool StoresNormals {
146            get { return true; }
147        }
148
149        public int VertexSize {
150            get { return 40; }
151        }
152        public byte Alpha {
153            get { return (byte)(A*255f);  }
154            set { A = value/255f; }
155        }
156        public Color Color {
157            get {
158                return Color.FromArgb((int)(A*255),(int)(R*255),(int)(G*255),(int)(B*255)); 
159            }
160            set {
161                R = value.R/255f;
162                G = value.G/255f;
163                B = value.B/255f;
164            }
165        }
166        public ILPoint3Df Position {
167            get {
168                return new ILPoint3Df(X,Y,Z);   
169            }
170            set{
171                X = value.X;
172                Y = value.Y;
173                Z = value.Z;
174            }
175        }
176        public ILPoint3Df Normal {
177            get {
178                return new ILPoint3Df(NX,NY,NZ);
179            }
180            set {
181                NX = value.X;
182                NY = value.Y;
183                NZ = value.Z;
184            }
185        }
186        public float XPosition {
187            get { return X; }
188            set { X = value; }
189        }
190        public float YPosition {
191            get { return Y; }
192            set { Y = value; }
193        }
194        public float ZPosition {
195            get { return Z; }
196            set { Z = value; }
197        }
198        #endregion
199    }
200}
Note: See TracBrowser for help on using the repository browser.