48 |
|
|
49 |
static protected float [][] circleGL = new float[360][2]; |
static protected float [][] circleGL = new float[360][2]; |
50 |
static protected boolean circleGLReady = false; |
static protected boolean circleGLReady = false; |
51 |
static protected void prepareCircleGL(int start) { |
static protected void prepareCircleGL() { |
52 |
if (!circleGLReady) { |
if (!circleGLReady) { |
53 |
for (int i=0;i<360;i++) { |
for (int i=0;i<360;i++) { |
54 |
float a = (float)((Math.PI / 180) * (360-(i+start))); |
float a = (float)((Math.PI / 180) * (360-i)); |
55 |
circleGL[i][0] = 0.5f + x(a, 0.5f); |
circleGL[i][0] = 0.5f + x(a, 0.5f); |
56 |
circleGL[i][1] = 0.5f + y(a, 0.5f); |
circleGL[i][1] = 0.5f + y(a, 0.5f); |
57 |
} |
} |
80 |
*/ |
*/ |
81 |
public ColoredSectorVob(int start, int sector, int step) { |
public ColoredSectorVob(int start, int sector, int step) { |
82 |
super(); |
super(); |
83 |
this.start = start; |
this.start = Math.abs(start); |
84 |
this.sector = sector; |
this.sector = Math.abs(sector); |
85 |
this.step = step; |
this.step = Math.abs(step); |
86 |
} |
} |
87 |
/* Default valus for drawing a small circle. */ |
/* Default valus for drawing a small circle. */ |
88 |
public ColoredSectorVob(){ |
public ColoredSectorVob(){ |
150 |
int coordsys2) { |
int coordsys2) { |
151 |
if(dbg) pa("Addtolistgl coloredsectorvob "+coordsys1); |
if(dbg) pa("Addtolistgl coloredsectorvob "+coordsys1); |
152 |
if(glList == null) { |
if(glList == null) { |
153 |
if (!circleGLReady) prepareCircleGL(start); |
if (!circleGLReady) prepareCircleGL(); |
154 |
String bgcall = ""; |
String bgcall = ""; |
155 |
if(nsolids > 0) { |
if(nsolids > 0) { |
156 |
int arc = sector / nsolids; |
int arc = sector / nsolids; |
161 |
"Begin POLYGON\n"+ |
"Begin POLYGON\n"+ |
162 |
"Vertex 0.5 0.5\n"); |
"Vertex 0.5 0.5\n"); |
163 |
for (int j=i*arc;j<(i+1)*arc;j+=step) { |
for (int j=i*arc;j<(i+1)*arc;j+=step) { |
164 |
bgcall += ("Vertex " + circleGL[j][0] + |
bgcall += ("Vertex " + circleGL[(j+start)%360][0] + |
165 |
" " + circleGL[j][1] + "\n"); |
" " + circleGL[(j+start)%360][1] + "\n"); |
166 |
} |
} |
167 |
int last = (i+1)*arc-1; |
int last = (i+1)*arc-1; |
168 |
if (sector == 360) last++; |
if (sector == 360) last++; |
169 |
if (last == 360) last = 0; |
if (last == 360) last = 0; |
170 |
bgcall += ("Vertex " + circleGL[last][0] + |
bgcall += ("Vertex " + circleGL[(last+start)%360][0] + |
171 |
" " + circleGL[last][1] + "\n" + |
" " + circleGL[(last+start)%360][1] + "\n" + |
172 |
"End\n"); |
"End\n"); |
173 |
} |
} |
174 |
} else { |
} else { |
177 |
"Begin POLYGON\n"); |
"Begin POLYGON\n"); |
178 |
if (sector < 360) bgcall += ("Vertex 0.5 0.5\n"); |
if (sector < 360) bgcall += ("Vertex 0.5 0.5\n"); |
179 |
for (int i=0;i<sector;i+=step) { |
for (int i=0;i<sector;i+=step) { |
180 |
bgcall += ("Vertex " + circleGL[i][0] + |
bgcall += ("Vertex " + circleGL[(i+start)%360][0] + |
181 |
" " + circleGL[i][1] + "\n"); |
" " + circleGL[(i+start)%360][1] + "\n"); |
182 |
} |
} |
183 |
bgcall += ("Vertex " + circleGL[sector-1][0] + |
bgcall += ("Vertex " + circleGL[(sector-1+start)%360][0] + |
184 |
" " + circleGL[sector-1][1] + "\n" + |
" " + circleGL[(sector-1+start)%360][1] + "\n" + |
185 |
"End\n"); |
"End\n"); |
186 |
} |
} |
187 |
|
|
190 |
"Begin LINE_LOOP\n"); |
"Begin LINE_LOOP\n"); |
191 |
if (sector < 360) bgcall += ("Vertex 0.5 0.5\n"); |
if (sector < 360) bgcall += ("Vertex 0.5 0.5\n"); |
192 |
for (int i=0;i<sector;i+=step) { |
for (int i=0;i<sector;i+=step) { |
193 |
bgcall += ("Vertex " + circleGL[i][0] + |
bgcall += ("Vertex " + circleGL[(i+start)%360][0] + |
194 |
" " + circleGL[i][1] + "\n"); |
" " + circleGL[(i+start)%360][1] + "\n"); |
195 |
} |
} |
196 |
bgcall += ("Vertex " + circleGL[sector-1][0] + |
bgcall += ("Vertex " + circleGL[(sector-1+start)%360][0] + |
197 |
" " + circleGL[sector-1][1] + "\n" + |
" " + circleGL[(sector-1+start)%360][1] + "\n" + |
198 |
"End\n"); |
"End\n"); |
199 |
|
|
200 |
glList = GLRen.createCallListBoxCoorded( |
glList = GLRen.createCallListBoxCoorded( |