JOGL v2.6.0-rc-20250712
JOGL, High-Performance Graphics Binding for Java™ (public API).
Region.java
Go to the documentation of this file.
1/**
2 * Copyright 2010-2024 JogAmp Community. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without modification, are
5 * permitted provided that the following conditions are met:
6 *
7 * 1. Redistributions of source code must retain the above copyright notice, this list of
8 * conditions and the following disclaimer.
9 *
10 * 2. Redistributions in binary form must reproduce the above copyright notice, this list
11 * of conditions and the following disclaimer in the documentation and/or other materials
12 * provided with the distribution.
13 *
14 * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
15 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
16 * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
19 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
20 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
21 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
22 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 *
24 * The views and conclusions contained in the software and documentation are those of the
25 * authors and should not be interpreted as representing official policies, either expressed
26 * or implied, of JogAmp Community.
27 */
28package com.jogamp.graph.curve;
29
30import java.io.PrintStream;
31import java.nio.FloatBuffer;
32import java.nio.IntBuffer;
33import java.nio.ShortBuffer;
34import java.util.ArrayList;
35import java.util.List;
36import java.util.Locale;
37import java.util.concurrent.TimeUnit;
38
39import jogamp.opengl.Debug;
40
41import com.jogamp.graph.geom.Triangle;
42import com.jogamp.graph.geom.Vertex;
43import com.jogamp.math.Vec3f;
44import com.jogamp.math.Vec4f;
45import com.jogamp.math.geom.AABBox;
46import com.jogamp.math.geom.Frustum;
47import com.jogamp.math.geom.plane.AffineTransform;
48import com.jogamp.common.nio.Buffers;
49import com.jogamp.common.os.Clock;
50import com.jogamp.common.util.PerfCounterCtrl;
51import com.jogamp.graph.curve.opengl.GLRegion;
52import com.jogamp.opengl.GLCapabilitiesImmutable;
53import com.jogamp.opengl.GLProfile;
54import com.jogamp.opengl.util.texture.TextureSequence;
55
56/**
57 * Abstract Outline shape representation define the method an OutlineShape(s)
58 * is bound and rendered.
59 *
60 * @see GLRegion
61 */
62public abstract class Region {
63
64 public static final boolean DEBUG_ALL_EVENT = Debug.debugExplicit("graph.curve.AllEvent");
65 public static final boolean DEBUG_INSTANCE = Debug.debugExplicit("graph.curve.Instance");
66
67 /** Debug flag for [com.]jogamp.graph.curve.* incl. Region (graph.curve) */
68 public static final boolean DEBUG = DEBUG_ALL_EVENT || Debug.debug("graph.curve");
69
70 /**
71 * Rendering-Mode bit for {@link #getRenderModes() Region}
72 * <p>
73 * One pass `norm` rendering either using no AA or underlying full-screen AA (fsaa).
74 * </p>
75 * <p>
76 * This mode-bit is a shader-key.
77 * </p>
78 */
79 public static final int NORM_RENDERING_BIT = 0;
80
81 /**
82 * Rendering-Mode bit for {@link #getRenderModes() Region}
83 * <p>
84 * MSAA based Anti-Aliasing, a two pass region rendering, slower and more
85 * resource hungry (FBO with sample buffer), but providing fast MSAA in case
86 * the whole scene is not rendered with MSAA.
87 * </p>
88 * <p>
89 * In case sample count is 1, no FBO sample buffer is used but a simple bilinear texture filter.
90 * </p>
91 * <p>
92 * This mode-bit is a shader-key.
93 * </p>
94 */
95 public static final int MSAA_RENDERING_BIT = 1 << 0;
96
97 /**
98 * Rendering-Mode bit for {@link #getRenderModes() Region}
99 * <p>
100 * View based Anti-Aliasing, a two pass region rendering, slower and more
101 * resource hungry (FBO), but AA is perfect. Otherwise the default fast one
102 * pass MSAA region rendering is being used.
103 * </p>
104 * <p>
105 * In case sample count is 1, no FBO supersampling is performed but a simple bilinear texture filter used.
106 * </p>
107 * <p>
108 * Depending on AA-quality, {@link #MAX_AA_QUALITY} denotes full 4x billinear filtering per sample
109 * and {@code 0} denotes 1x flipquad filtering per sample.
110 * </p>
111 * <p>
112 * This mode-bit is a shader-key.
113 * </p>
114 */
115 public static final int VBAA_RENDERING_BIT = 1 << 1;
116
117 /** 2-pass rendering bit-mask including {@link #MSAA_RENDERING_BIT} and {@link #VBAA_RENDERING_BIT}. */
119
120 /**
121 * Rendering-Mode bit for {@link #getRenderModes() Region}
122 * <p>
123 * Use non uniform weights [0.0 .. 1.9] for curve region rendering.
124 * Otherwise the default weight 1.0 for uniform curve region rendering is
125 * being applied.
126 * </p>
127 * <p>
128 * This mode-bit is a shader-key.
129 * </p>
130 */
131 public static final int VARWEIGHT_RENDERING_BIT = 1 << 8;
132
133 /**
134 * Rendering-Mode bit for {@link #getRenderModes() Region} to optionally enable a color-channel per vertex.
135 * <p>
136 * If set, a color channel attribute per vertex is added to the stream via {@link #addOutlineShape(OutlineShape, AffineTransform, float[])},
137 * otherwise {@link com.jogamp.graph.curve.opengl.RegionRenderer#setColorStatic(com.jogamp.opengl.GL2ES2, float, float, float, float) static color}
138 * can being used for a monotonic color.
139 * </p>
140 * <p>
141 * This mode-bit is a shader-key.
142 * </p>
143 * @see #getRenderModes()
144 * @see #hasColorChannel()
145 * @see #addOutlineShape(OutlineShape, AffineTransform, float[])
146 * @see com.jogamp.graph.curve.opengl.RegionRenderer#setColorStatic(com.jogamp.opengl.GL2ES2, float, float, float, float)
147 */
148 public static final int COLORCHANNEL_RENDERING_BIT = 1 << 9;
149
150 /**
151 * Rendering-Mode bit for {@link #getRenderModes() Region}
152 * <p>
153 * If set, a color texture is used to determine the color via {#link TextureSequence} passed to implementation, e.g. GLRegion.
154 * </p>
155 * <p>
156 * This mode-bit is a shader-key.
157 * </p>
158 * @see TextureSequence#useARatioAdjustment()
159 * @see TextureSequence#useARatioLetterbox()
160 */
161 public static final int COLORTEXTURE_RENDERING_BIT = 1 << 10;
162
163 /** Minimum pass2 AA-quality rendering {@value} for Graph Region AA {@link Region#getRenderModes() render-modes}: {@link #VBAA_RENDERING_BIT}. */
164 public static final int MIN_AA_QUALITY = 0;
165 /** Maximum pass2 AA-quality rendering {@value} for Graph Region AA {@link Region#getRenderModes() render-modes}: {@link #VBAA_RENDERING_BIT}. */
166 public static final int MAX_AA_QUALITY = 1;
167 /** Default pass2 AA-quality rendering {@value} for Graph Region AA {@link Region#getRenderModes() render-modes}: {@link #VBAA_RENDERING_BIT}. */
168 public static final int DEFAULT_AA_QUALITY = MAX_AA_QUALITY;
169 /** Returns clipped AA quality value to [{@link Region#MIN_AA_QUALITY}..{@link Region#MAX_AA_QUALITY}] */
170 public static final int clipAAQuality(final int v) { return Math.min(Region.MAX_AA_QUALITY, Math.max(v, Region.MIN_AA_QUALITY)); }
171
172 /** Minimum pass2 AA sample count {@value} for Graph Region AA {@link Region#getRenderModes() render-modes}: {@link Region#VBAA_RENDERING_BIT} or {@link Region#MSAA_RENDERING_BIT}. */
173 public static final int MIN_AA_SAMPLE_COUNT = 1;
174 /** Maximum pass2 AA sample count {@value} for Graph Region AA {@link Region#getRenderModes() render-modes}: {@link Region#VBAA_RENDERING_BIT} or {@link Region#MSAA_RENDERING_BIT}. */
175 public static final int MAX_AA_SAMPLE_COUNT = 8;
176 /** Default pass2 AA sample count {@value} for Graph Region AA {@link Region#getRenderModes() render-modes}: {@link #VBAA_RENDERING_BIT} or {@link Region#MSAA_RENDERING_BIT}. */
177 public static final int DEFAULT_AA_SAMPLE_COUNT = 4;
178 /** Returns clipped AA sample-count to [{@link Region#MIN_AA_SAMPLE_COUNT}..{@link Region#MAX_AA_SAMPLE_COUNT}] */
179 public static final int clipAASampleCount(final int v) { return Math.min(Region.MAX_AA_SAMPLE_COUNT, Math.max(v, Region.MIN_AA_SAMPLE_COUNT)); }
180
181 public static final int DEFAULT_TWO_PASS_TEXTURE_UNIT = 0;
182
183 protected static final int DIRTY_SHAPE = 1 << 0 ;
184 protected static final int DIRTY_STATE = 1 << 1 ;
185
186 private final int renderModes;
187 private final boolean use_int32_idx;
188 private final int max_indices;
189 private int dirty = DIRTY_SHAPE | DIRTY_STATE;
190 private int numVertices = 0;
191 protected final AABBox box = new AABBox();
192 protected Frustum frustum = null;
193
194 public static final boolean isRenderModeSet(final int renderModes, final int mask) { return mask == ( renderModes & mask ); }
195 public static final int setRenderMode(int renderModes, final int mask, final boolean v) { if( v ) { renderModes |= mask; } else { renderModes &= ~mask; }; return renderModes; }
196
197 /** Returns true if given {@code renderModes} has {@link Region#VBAA_RENDERING_BIT} set. */
198 public static boolean isVBAA(final int renderModes) {
199 return 0 != (renderModes & Region.VBAA_RENDERING_BIT);
200 }
201
202 /** Returns true if given {@code renderModes} has {@link Region#MSAA_RENDERING_BIT} set. */
203 public static boolean isMSAA(final int renderModes) {
204 return 0 != (renderModes & Region.MSAA_RENDERING_BIT);
205 }
206
207 /** Returns true if given {@code renderModes} has any of {@link Region#AA_RENDERING_MASK} set. */
208 public static boolean isGraphAA(final int renderModes) {
209 return 0 != ( renderModes & Region.AA_RENDERING_MASK );
210 }
211
212 /** Returns true if given {@code renderModes} has any of {@link Region#AA_RENDERING_MASK} set. */
213 public static boolean isTwoPass(final int renderModes) {
214 return 0 != ( renderModes & Region.AA_RENDERING_MASK );
215 }
216
217 /**
218 * Returns true if render mode capable of variable weights,
219 * i.e. the bit {@link #VARWEIGHT_RENDERING_BIT} is set,
220 * otherwise false.
221 */
222 public static boolean hasVariableWeight(final int renderModes) {
223 return 0 != (renderModes & Region.VARWEIGHT_RENDERING_BIT);
224 }
225
226 /**
227 * Returns true if render mode has a color channel,
228 * i.e. the bit {@link #COLORCHANNEL_RENDERING_BIT} is set,
229 * otherwise false.
230 */
231 public static boolean hasColorChannel(final int renderModes) {
232 return 0 != (renderModes & Region.COLORCHANNEL_RENDERING_BIT);
233 }
234
235 /**
236 * Returns true if render mode has a color texture,
237 * i.e. the bit {@link #COLORTEXTURE_RENDERING_BIT} is set,
238 * otherwise false.
239 */
240 public static boolean hasColorTexture(final int renderModes) {
241 return 0 != (renderModes & Region.COLORTEXTURE_RENDERING_BIT);
242 }
243
244 /**
245 * Returns a unique technical description string for renderModes as follows:
246 * <pre>
247 * (vbaa|msaa|norm)[-curve][-cols][-ctex]
248 * </pre>
249 * @param renderModes Graph renderModes, see {@link GLRegion#create(GLProfile, int, TextureSequence) create(..)}
250 */
251 public static String getRenderModeString(final int renderModes) {
252 final String curveS = hasVariableWeight(renderModes) ? "-curve" : "";
253 final String cChanS = hasColorChannel(renderModes) ? "-cols" : "";
254 final String cTexS;
255 if( hasColorTexture(renderModes) ) {
256 cTexS = "-ctex";
257 } else {
258 cTexS = "";
259 }
260 if( Region.isVBAA(renderModes) ) {
261 return "vbaa"+curveS+cChanS+cTexS;
262 } else if( Region.isMSAA(renderModes) ) {
263 return "msaa"+curveS+cChanS+cTexS;
264 } else {
265 return "norm"+curveS+cChanS+cTexS;
266 }
267 }
268
269 /**
270 * Return a unique technical description string for renderModes and sample counts as follows:
271 * <pre>
272 * {@link #getRenderModeString(int)}-q{AA-quality}-s{sampleCount}-fsaa{CapsNumSamples}
273 * </pre>
274 *
275 * @param renderModes the used Graph renderModes, see {@link GLRegion#create(GLProfile, int, TextureSequence) create(..)}
276 * @param graphAAQuality Graph AA quality, see {@link #DEFAULT_AA_QUALITY}, set to negative value to mark undefined
277 * @param graphSampleCount Graph sample count for {@link Region#VBAA_RENDERING_BIT} or {@link Region#MSAA_RENDERING_BIT}
278 * @param fsaaSampleCount full-screen AA (fsaa) sample count, retrieved e.g. via {@link GLCapabilitiesImmutable#getNumSamples()}
279 */
280 public static String getRenderModeString(final int renderModes, final int graphAAQuality, final int graphSampleCount, final int fsaaSampleCount) {
281 if( Region.MIN_AA_QUALITY > graphAAQuality ) {
282 return String.format((Locale)null, "%s-qu-s%02d-fsaa%d", Region.getRenderModeString(renderModes), graphSampleCount, fsaaSampleCount);
283 } else {
284 return String.format((Locale)null, "%s-q%01d-s%02d-fsaa%d", Region.getRenderModeString(renderModes), graphAAQuality, graphSampleCount, fsaaSampleCount);
285 }
286 }
287
288 protected Region(final int regionRenderModes, final boolean use_int32_idx) {
289 this.renderModes = regionRenderModes;
290 this.use_int32_idx = use_int32_idx;
291 if( use_int32_idx ) {
292 this.max_indices = GL_INT32_MAX / Buffers.SIZEOF_INT; // byte-size int32_t limit
293 } else {
294 this.max_indices = GL_UINT16_MAX;
295 }
296 }
297
298 /** Print implementation buffer stats like detailed and total size and capacity in bytes etc */
299 public abstract void printBufferStats(PrintStream out);
300
301 /**
302 * Returns true if implementation uses `int32_t` sized indices implying at least a {@link GLProfile#isGL2ES3()} alike context.
303 * Otherwise method returns false on {@link GLProfile#isGLES2()} using `uint16_t` sized indices.
304 */
305 public final boolean usesI32Idx() { return this.use_int32_idx; }
306
307 /**
308 * Increase the renderer buffers if necessary to add given counts of vertices- and index elements.
309 * <p>
310 * Buffers will not change if remaining free slots, capacity less position, satisfy count elements.
311 * </p>
312 * @param verticesCount number of vertex elements to add if necessary
313 * @param indicesCount number of index elements to add if necessary
314 * @return true if buffer size has changed, i.e. grown. Otherwise false.
315 * @see #setBufferCapacity(int, int)
316 * @see #countOutlineShape(OutlineShape, int[])
317 * @see #countOutlineShapes(List, int[])
318 */
319 public abstract boolean growBuffer(int verticesCount, int indicesCount);
320
321 /**
322 * Set the renderer buffers pre-emptively for given vertices- and index counts.
323 * <p>
324 * Buffers will not change if given count elements is lower or equal current capacity.
325 * </p>
326 * @param verticesCount number of vertices to hold
327 * @param indicesCount number of indices to hold
328 * @return true if buffer size has changed, i.e. grown. Otherwise false.
329 * @see #growBuffer(int, int)
330 * @see #countOutlineShape(OutlineShape, int[])
331 * @see #countOutlineShapes(List, int[])
332 */
333 public abstract boolean setBufferCapacity(int verticesCount, int indicesCount);
334
335 protected abstract void pushVertex(final Vec3f coords, final Vec3f texParams, Vec4f rgba);
336 protected abstract void pushVertices(final Vec3f coords1, final Vec3f coords2, final Vec3f coords3,
337 final Vec3f texParams1, final Vec3f texParams2, final Vec3f texParams3, Vec4f rgba);
338 protected abstract void pushIndex(int idx);
339 protected abstract void pushIndices(int idx1, int idx2, int idx3);
340
341 /**
342 * Returns bit-field of render modes, see {@link GLRegion#create(GLProfile, int, TextureSequence) create(..)}.
343 */
344 public final int getRenderModes() { return renderModes; }
345
346 protected final void clearImpl() {
347 dirty = DIRTY_SHAPE | DIRTY_STATE;
348 numVertices = 0;
349 box.reset();
350 }
351
352 public final boolean isRenderModeSet(final int mask) { return mask == ( renderModes & mask ); }
353
354 /**
355 * Returns true if capable of two pass rendering - VBAA, otherwise false.
356 * @see #getRenderModes()
357 */
358 public final boolean isVBAA() {
359 return Region.isVBAA(renderModes);
360 }
361
362 /**
363 * Returns true if capable of two pass rendering - MSAA, otherwise false.
364 * @see #getRenderModes()
365 */
366 public final boolean isMSAA() {
367 return Region.isMSAA(renderModes);
368 }
369
370 /**
371 * Returns true if capable of variable weights, otherwise false.
372 * @see #getRenderModes()
373 */
374 public final boolean hasVariableWeight() {
375 return Region.hasVariableWeight(renderModes);
376 }
377
378 /**
379 * Returns true if {@link #getRenderModes()} has a color channel, i.e. {@link #COLORCHANNEL_RENDERING_BIT} is set.
380 * Otherwise returns false.
381 * @see #COLORCHANNEL_RENDERING_BIT
382 * @see #getRenderModes()
383 * @see #addOutlineShape(OutlineShape, AffineTransform, float[])
384 * @see com.jogamp.graph.curve.opengl.RegionRenderer#setColorStatic(com.jogamp.opengl.GL2ES2, float, float, float, float)
385 */
386 public final boolean hasColorChannel() {
387 return Region.hasColorChannel(renderModes);
388 }
389
390 /**
391 * Returns true if render mode has a color texture,
392 * i.e. the bit {@link #COLORTEXTURE_RENDERING_BIT} is set,
393 * otherwise false.
394 * @see #getRenderModes()
395 * @see #isColorTextureLetterbox()
396 */
397 public final boolean hasColorTexture() {
398 return Region.hasColorTexture(renderModes);
399 }
400
401 /** See {@link #setFrustum(Frustum)} */
402 public final Frustum getFrustum() { return frustum; }
403
404 /**
405 * Set {@link Frustum} culling for {@link #addOutlineShape(OutlineShape, AffineTransform, float[])}.
406 */
407 public final void setFrustum(final Frustum frustum) {
408 this.frustum = frustum;
409 }
410
411 private void pushNewVertexImpl(final Vertex vertIn, final AffineTransform transform, final Vec4f rgba) {
412 // if(DEBUG_INSTANCE) { System.err.printf("pushVertex.0[%d]: v %s]%n", numVertices, vertIn); }
413 if( null != transform ) {
414 final Vec3f coordsEx1 = transform.transform(vertIn.getCoord(), new Vec3f());
415 box.resize(coordsEx1);
416 pushVertex(coordsEx1, vertIn.getTexCoord(), rgba);
417 } else {
418 box.resize(vertIn.getCoord());
419 pushVertex(vertIn.getCoord(), vertIn.getTexCoord(), rgba);
420 }
421 numVertices++;
422 }
423
424 private void pushNewVerticesImpl(final Vertex vertIn1, final Vertex vertIn2, final Vertex vertIn3, final AffineTransform transform, final Vec4f rgba) {
425 // if(DEBUG_INSTANCE) { System.err.printf("pushVertex.0[%d]:%n- %s,%n- %s,%n- %s]%n", numVertices, vertIn1, vertIn2, vertIn3); }
426 if( null != transform ) {
427 final Vec3f coordsEx1 = transform.transform(vertIn1.getCoord(), new Vec3f());
428 final Vec3f coordsEx2 = transform.transform(vertIn2.getCoord(), new Vec3f());
429 final Vec3f coordsEx3 = transform.transform(vertIn3.getCoord(), new Vec3f());
430 box.resize(coordsEx1);
431 box.resize(coordsEx2);
432 box.resize(coordsEx3);
433 pushVertices(coordsEx1, coordsEx2, coordsEx3,
434 vertIn1.getTexCoord(), vertIn2.getTexCoord(), vertIn3.getTexCoord(), rgba);
435 } else {
436 box.resize(vertIn1.getCoord());
437 box.resize(vertIn2.getCoord());
438 box.resize(vertIn3.getCoord());
439 pushVertices(vertIn1.getCoord(), vertIn2.getCoord(), vertIn3.getCoord(),
440 vertIn1.getTexCoord(), vertIn2.getTexCoord(), vertIn3.getTexCoord(), rgba);
441 }
442 numVertices+=3;
443 }
444
445 @SuppressWarnings("unused")
446 private void pushNewVertexIdxImpl(final Vertex vertIn, final AffineTransform transform, final Vec4f rgba) {
447 // if(DEBUG_INSTANCE) { System.err.printf("pushIndices.0[%d]: %d]%n", numIndices , numVertices); }
448 pushIndex(numVertices);
449 pushNewVertexImpl(vertIn, transform, rgba);
450 // numIndices += 1;
451 }
452 // int numIndices = 0;
453
454 private void pushNewVerticesIdxImpl(final Vertex vertIn1, final Vertex vertIn2, final Vertex vertIn3, final AffineTransform transform, final Vec4f rgba) {
455 // if(DEBUG_INSTANCE) { System.err.printf("pushIndices.0[%d]: %d, %d, %d]%n", numIndices , numVertices, numVertices+1, numVertices+2); }
456 pushIndices(numVertices, numVertices+1, numVertices+2);
457 pushNewVerticesImpl(vertIn1, vertIn2, vertIn3, transform, rgba);
458 // numIndices += 3;
459 }
460
461 protected static void put3i(final IntBuffer b, final int v1, final int v2, final int v3) {
462 b.put(v1); b.put(v2); b.put(v3);
463 }
464 protected static void put3s(final ShortBuffer b, final short v1, final short v2, final short v3) {
465 b.put(v1); b.put(v2); b.put(v3);
466 }
467 protected static void put3f(final FloatBuffer b, final Vec3f v) {
468 b.put(v.x()); b.put(v.y()); b.put(v.z());
469 }
470 protected static void put4f(final FloatBuffer b, final float v1, final float v2, final float v3, final float v4) {
471 b.put(v1); b.put(v2); b.put(v3); b.put(v4);
472 }
473 protected static void put4f(final FloatBuffer b, final Vec4f v) {
474 b.put(v.x()); b.put(v.y()); b.put(v.z()); b.put(v.w());
475 }
476
477 private final AABBox tmpBox = new AABBox();
478
479 protected static final int GL_UINT16_MAX = 0xffff; // 65,535
480 protected static final int GL_INT32_MAX = 0x7fffffff; // 2,147,483,647
481
482 static class Perf {
483 // all td_ values are in [ns]
484 long td_vertices = 0;
485 long td_tri_push_idx = 0;
486 long td_tri_push_vertidx = 0;
487 long td_tri_misc = 0;
488 long td_tri_total = 0; // incl tac_ns_tri_push_vertidx + tac_ns_tri_push_idx + tac_ns_tri_misc
489 long td_total = 0; // incl tac_ns_triangles + tac_ns_vertices
490 long count = 0;
491
492 public void print(final PrintStream out) {
493 final long tac_ns_triangles_self = td_tri_total - td_tri_push_vertidx - td_tri_push_idx - td_tri_misc;
494 final long tac_ns_total_self = td_total - td_tri_total - td_vertices;
495 out.printf("Region.add(): count %,3d, total %,5d [ms], per-add %,4.2f [ns]%n", count, TimeUnit.NANOSECONDS.toMillis(td_total), ((double)td_total/count));
496 out.printf(" total self %,5d [ms], per-add %,4.2f [ns]%n", TimeUnit.NANOSECONDS.toMillis(tac_ns_total_self), ((double)tac_ns_total_self/count));
497 out.printf(" vertices %,5d [ms], per-add %,4.2f [ns]%n", TimeUnit.NANOSECONDS.toMillis(td_vertices), ((double)td_vertices/count));
498 out.printf(" triangles total %,5d [ms], per-add %,4.2f [ns]%n", TimeUnit.NANOSECONDS.toMillis(td_tri_total), ((double)td_tri_total/count));
499 out.printf(" triangles self %,5d [ms], per-add %,4.2f [ns]%n", TimeUnit.NANOSECONDS.toMillis(tac_ns_triangles_self), ((double)tac_ns_triangles_self/count));
500 out.printf(" tri misc %,5d [ms], per-add %,4.2f [ns]%n", TimeUnit.NANOSECONDS.toMillis(td_tri_misc), ((double)td_tri_misc/count));
501 out.printf(" tri p-idx %,5d [ms], per-add %,4.2f [ns]%n", TimeUnit.NANOSECONDS.toMillis(td_tri_push_idx), ((double)td_tri_push_idx/count));
502 out.printf(" tri p-vertidx %,5d [ms], per-add %,4.2f [ns]%n", TimeUnit.NANOSECONDS.toMillis(td_tri_push_vertidx), ((double)td_tri_push_vertidx/count));
503 }
504
505 public void clear() {
506 td_vertices = 0;
507 td_tri_push_idx = 0;
508 td_tri_push_vertidx = 0;
509 td_tri_misc = 0;
510 td_tri_total = 0;
511 td_total = 0;
512 count = 0;
513 }
514 }
515 private Perf perf = null;
516
517 private final PerfCounterCtrl perfCounterCtrl = new PerfCounterCtrl() {
518 @Override
519 public void enable(final boolean enable) {
520 if( enable ) {
521 if( null != perf ) {
522 perf.clear();
523 } else {
524 perf = new Perf();
525 }
526 } else {
527 perf = null;
528 }
529 }
530
531 @Override
532 public void clear() {
533 if( null != perf ) {
534 perf.clear();
535 }
536 }
537
538 @Override
539 public long getTotalDuration() {
540 if( null != perf ) {
541 return perf.td_total;
542 } else {
543 return 0;
544 }
545 }
546
547 @Override
548 public void print(final PrintStream out) {
549 if( null != perf ) {
550 perf.print(out);
551 }
552 } };
553 public PerfCounterCtrl perfCounter() { return perfCounterCtrl; }
554
555 /**
556 * Count required number of vertices and indices adding to given int[2] `vertIndexCount` array.
557 * <p>
558 * The region's buffer can be either set using {@link Region#setBufferCapacity(int, int)},
559 * {@link GLRegion#create(GLProfile, int, TextureSequence, int, int) GLRegion ctor w/ initial capacities}
560 * or grown using {@link Region#growBuffer(int, int)}.
561 * </p>
562 * <p>
563 * Method is utilized in {@link GLRegion#create(GLProfile, int, TextureSequence, com.jogamp.graph.font.Font, CharSequence) GLRegion ctor w/ font + text},
564 * computing the initial capacity.
565 * </p>
566 * @param shape the {@link OutlineShape} to count
567 * @param vertIndexCount the int[2] storage where the counted vertices and indices are added, vertices at [0] and indices at [1]
568 * @return the given int[2] storage for chaining
569 * @see #setBufferCapacity(int, int)
570 * @see #growBuffer(int, int)
571 */
572 public static final int[] countOutlineShape(final OutlineShape shape, final int[/*2*/] vertIndexCount) {
573 if( null == shape ) {
574 return vertIndexCount;
575 }
576 final List<Triangle> trisIn = shape.getTriangles(OutlineShape.VerticesState.QUADRATIC_NURBS);
577 final ArrayList<Vertex> vertsIn = shape.getVertices();
578 {
579 vertIndexCount[0] += vertsIn.size() + shape.getAddedVerticeCount(); // verticesCount
580 vertIndexCount[1] += trisIn.size() * 3; // indicesCount
581 }
582 return vertIndexCount;
583 }
584
585 /**
586 * Count required number of vertices and indices adding to given int[2] `vertIndexCount` array.
587 * <p>
588 * The region's buffer can be either set using {@link Region#setBufferCapacity(int, int)},
589 * {@link GLRegion#create(GLProfile, int, TextureSequence, int, int) GLRegion ctor w/ initial capacities}
590 * or grown using {@link Region#growBuffer(int, int)}.
591 * </p>
592 * @param shapes list of {@link OutlineShape} to count
593 * @param vertIndexCount the int[2] storage where the counted vertices and indices are added, vertices at [0] and indices at [1]
594 * @return the given int[2] storage for chaining
595 * @see #setBufferCapacity(int, int)
596 * @see #growBuffer(int, int)
597 */
598 public static final int[] countOutlineShapes(final List<OutlineShape> shapes, final int[/*2*/] vertIndexCount) {
599 for (int i = 0; i < shapes.size(); i++) {
600 countOutlineShape(shapes.get(i), vertIndexCount);
601 }
602 return vertIndexCount;
603 }
604
605 /**
606 * Add the given {@link OutlineShape} to this region with the given optional {@link AffineTransform}.
607 * <p>
608 * In case {@link #setFrustum(Frustum) frustum culling is set}, the {@link OutlineShape}
609 * is dropped if it's {@link OutlineShape#getBounds() bounding-box} is fully outside of the frustum.
610 * The optional {@link AffineTransform} is applied to the bounding-box beforehand.
611 * </p>
612 * @param shape the {@link OutlineShape} to add
613 * @param t the optional {@link AffineTransform} to be applied on each vertex
614 * @param rgbaColor if {@link #hasColorChannel()} RGBA color must be passed, otherwise value is ignored.
615 */
616 public final void addOutlineShape(final OutlineShape shape, final AffineTransform t, final Vec4f rgbaColor) {
617 if( null != frustum ) {
618 final AABBox shapeBox = shape.getBounds();
619 final AABBox shapeBoxT;
620 if( null != t ) {
621 t.transform(shapeBox, tmpBox);
622 shapeBoxT = tmpBox;
623 } else {
624 shapeBoxT = shapeBox;
625 }
626 if( frustum.isOutside(shapeBoxT) ) {
627 return;
628 }
629 }
630 if( null == perf && !DEBUG_INSTANCE ) {
631 addOutlineShape0(shape, t, rgbaColor);
632 } else {
633 if( null == perf ) {
634 perfCounter().enable(true);
635 }
636 addOutlineShape1(shape, t, rgbaColor);
637 }
639 }
640 private final void addOutlineShape0(final OutlineShape shape, final AffineTransform t, final Vec4f rgbaColor) {
641 final List<Triangle> trisIn = shape.getTriangles(OutlineShape.VerticesState.QUADRATIC_NURBS);
642 final ArrayList<Vertex> vertsIn = shape.getVertices();
643 {
644 final int verticeCount = vertsIn.size() + shape.getAddedVerticeCount();
645 final int indexCount = trisIn.size() * 3;
646 // if(DEBUG_INSTANCE) { System.err.printf("add.0 triangles %d, vertices %d; verticeCount %d, indexCount %d%n", trisIn.size(), vertsIn.size(), verticeCount, indexCount); }
647 growBuffer(verticeCount, indexCount);
648 }
649
650 final int idxOffset = numVertices;
651 if( vertsIn.size() >= 3 ) {
652 //
653 // Processing Vertices
654 //
655 for(int i=0; i<vertsIn.size(); i++) {
656 pushNewVertexImpl(vertsIn.get(i), t, rgbaColor);
657 }
658 final int trisIn_sz = trisIn.size();
659 for(int i=0; i < trisIn_sz; ++i) {
660 final Triangle triIn = trisIn.get(i);
661 // triEx.addVertexIndicesOffset(idxOffset);
662 // triangles.add( triEx );
663 final Vertex[] triInVertices = triIn.getVertices();
664 final int tv0Idx = triInVertices[0].getId();
665
666 if ( max_indices - idxOffset > tv0Idx ) {
667 // valid 'known' idx - move by offset
668 // if(DEBUG_INSTANCE) { System.err.printf("pushIndices.0[%d, m %d]: %d, %d, %d]%n", numIndices , 1, tv0Idx+idxOffset, triInVertices[1].getId()+idxOffset, triInVertices[2].getId()+idxOffset); }
669 pushIndices(tv0Idx+idxOffset,
670 triInVertices[1].getId()+idxOffset,
671 triInVertices[2].getId()+idxOffset);
672 // numIndices += 3;
673 } else {
674 // FIXME: If exceeding max_indices, we would need to generate a new buffer w/ indices
675 pushNewVerticesIdxImpl(triInVertices[0], triInVertices[1], triInVertices[2], t, rgbaColor);
676 }
677 }
678 }
679 // if(DEBUG_INSTANCE) { System.err.printf("add.x num[vertices %d, indices %d]%n", numVertices, numIndices); }
680 }
681 private final void addOutlineShape1(final OutlineShape shape, final AffineTransform t, final Vec4f rgbaColor) {
682 ++perf.count;
683 final long t0 = Clock.currentNanos();
684 final List<Triangle> trisIn = shape.getTriangles(OutlineShape.VerticesState.QUADRATIC_NURBS);
685 final ArrayList<Vertex> vertsIn = shape.getVertices();
686 {
687 final int addedVerticeCount = shape.getAddedVerticeCount();
688 final int verticeCount = vertsIn.size() + addedVerticeCount;
689 final int indexCount = trisIn.size() * 3;
690 if(DEBUG_INSTANCE) {
691 System.err.println("Region.addOutlineShape().0: tris: "+trisIn.size()+", verts "+vertsIn.size()+", transform "+t);
692 System.err.println("Region.addOutlineShape().0: VerticeCount "+vertsIn.size()+" + "+addedVerticeCount+" = "+verticeCount);
693 System.err.println("Region.addOutlineShape().0: IndexCount "+indexCount);
694 }
695 growBuffer(verticeCount, indexCount);
696 }
697
698 final int idxOffset = numVertices;
699 int vertsVNewIdxCount = 0, vertsTMovIdxCount = 0, vertsTNewIdxCount = 0, tris = 0;
700 final int vertsDupCountV = 0, vertsDupCountT = 0, vertsKnownMovedT = 0;
701 if( vertsIn.size() >= 3 ) {
702 // if(DEBUG_INSTANCE) {
703 // System.err.println("Region.addOutlineShape(): Processing Vertices");
704 // }
705 for(int i=0; i<vertsIn.size(); i++) {
706 pushNewVertexImpl(vertsIn.get(i), t, rgbaColor);
707 vertsVNewIdxCount++;
708 }
709 final long t1 = Clock.currentNanos();
710 perf.td_vertices += t1 - t0;
711 // if(DEBUG_INSTANCE) {
712 // System.err.println("Region.addOutlineShape(): Processing Triangles");
713 // }
714 final int trisIn_sz = trisIn.size();
715 for(int i=0; i < trisIn_sz; ++i) {
716 final Triangle triIn = trisIn.get(i);
717 final long t2 = Clock.currentNanos();
718 // if(Region.DEBUG_INSTANCE) {
719 // System.err.println("T["+i+"]: "+triIn);
720 // }
721 // triEx.addVertexIndicesOffset(idxOffset);
722 // triangles.add( triEx );
723 final Vertex[] triInVertices = triIn.getVertices();
724 final int tv0Idx = triInVertices[0].getId();
725
726 perf.td_tri_misc += Clock.currentNanos() - t2;
727 if ( max_indices - idxOffset > tv0Idx ) {
728 // valid 'known' idx - move by offset
729 // if(Region.DEBUG_INSTANCE) {
730 // System.err.println("T["+i+"]: Moved "+tv0Idx+" + "+idxOffset+" -> "+(tv0Idx+idxOffset));
731 // }
732 final long tpi = Clock.currentNanos();
733 pushIndices(tv0Idx+idxOffset,
734 triInVertices[1].getId()+idxOffset,
735 triInVertices[2].getId()+idxOffset);
736 perf.td_tri_push_idx += Clock.currentNanos() - tpi;
737 vertsTMovIdxCount+=3;
738 } else {
739 // FIXME: If exceeding max_indices, we would need to generate a new buffer w/ indices
740 // if( Region.DEBUG_INSTANCE) {
741 // System.err.println("T["+i+"]: New Idx "+numVertices);
742 // }
743 final long tpvi = Clock.currentNanos();
744 pushNewVerticesIdxImpl(triInVertices[0], triInVertices[1], triInVertices[2], t, rgbaColor);
745 perf.td_tri_push_vertidx += Clock.currentNanos() - tpvi;
746 vertsTNewIdxCount+=3;
747 }
748 tris++;
749 }
750 final long ttriX = Clock.currentNanos();
751 perf.td_tri_total += ttriX - t1;
752 perf.td_total += ttriX - t0;
753 }
754 if(DEBUG_INSTANCE) {
755 System.err.println("Region.addOutlineShape().X: idx[ui32 "+usesI32Idx()+", offset "+idxOffset+"], tris: "+tris+", verts [idx "+vertsTNewIdxCount+", add "+vertsTNewIdxCount+" = "+(vertsVNewIdxCount+vertsTNewIdxCount)+"]");
756 System.err.println("Region.addOutlineShape().X: verts: idx[v-new "+vertsVNewIdxCount+", t-new "+vertsTNewIdxCount+" = "+(vertsVNewIdxCount+vertsTNewIdxCount)+"]");
757 System.err.println("Region.addOutlineShape().X: verts: idx t-moved "+vertsTMovIdxCount+", numVertices "+numVertices);
758 System.err.println("Region.addOutlineShape().X: verts: v-dups "+vertsDupCountV+", t-dups "+vertsDupCountT+", t-known "+vertsKnownMovedT);
759 // int vertsDupCountV = 0, vertsDupCountT = 0;
760 System.err.println("Region.addOutlineShape().X: box "+box);
761 printBufferStats(System.err);
762 }
763 }
764
765 /**
766 * Add the given list of {@link OutlineShape}s to this region with the given optional {@link AffineTransform}.
767 * <p>
768 * In case {@link #setFrustum(Frustum) frustum culling is set}, the {@link OutlineShape}s
769 * are dropped if it's {@link OutlineShape#getBounds() bounding-box} is fully outside of the frustum.
770 * The optional {@link AffineTransform} is applied to the bounding-box beforehand.
771 * </p>
772 * @param shapes list of {@link OutlineShape} to add
773 * @param t the optional {@link AffineTransform} to be applied on each vertex
774 * @param rgbaColor if {@link #hasColorChannel()} RGBA color must be passed, otherwise value is ignored.
775 */
776 public final void addOutlineShapes(final List<OutlineShape> shapes, final AffineTransform transform, final Vec4f rgbaColor) {
777 for (int i = 0; i < shapes.size(); i++) {
778 addOutlineShape(shapes.get(i), transform, rgbaColor);
779 }
780 }
781
782 /** @return the AxisAligned bounding box of current region */
783 public final AABBox getBounds() {
784 return box;
785 }
786
787 /**
788 * Mark this region's shape dirty,
789 * i.e. its vertices, triangles, lines and/or color-texture coordinates changed.
790 * <p>
791 * The data will be re-uploaded to the GPU at next {@link GLRegion#draw(com.jogamp.opengl.GL2ES2, com.jogamp.graph.curve.opengl.RegionRenderer) draw(..)}.
792 * </p>
793 * <p>
794 * In 2-pass mode, this implies updating the FBO itself as well.
795 * </p>
796 */
797 public final void markShapeDirty() {
798 dirty |= DIRTY_SHAPE;
799 }
800 /** Returns true if this region's shape are dirty, see {@link #markShapeDirty()}. */
801 public final boolean isShapeDirty() {
802 return 0 != ( dirty & DIRTY_SHAPE ) ;
803 }
804 /**
805 * Mark this region's render-state dirty, i.e. re-selecting a shader program regarding color-texture and -channel,
806 * and rendering the region into the FBO in 2-pass mode.
807 * <p>
808 * In 1-pass mode, re-selection of the shader-program is based on color-texture and -channel only.
809 * </p>
810 */
811 public final void markStateDirty() {
812 dirty |= DIRTY_STATE;
813 }
814 /** Returns true if this region's state is dirty, see {@link #markStateDirty()}. */
815 public final boolean isStateDirty() {
816 return 0 != ( dirty & DIRTY_STATE ) ;
817 }
818
819 /**
820 * See {@link #markShapeDirty()} and {@link #markStateDirty()}.
821 */
822 protected final void clearDirtyBits(final int v) {
823 dirty &= ~v;
824 }
825 protected final int getDirtyBits() { return dirty; }
826
827 @Override
828 public String toString() {
829 return "Region[0x"+Integer.toHexString(hashCode())+", "+getRenderModeString(this.renderModes)+", dirty "+dirty+", vertices "+numVertices+", box "+box+"]";
830 }
831}
A Generic shape objects which is defined by a list of Outlines.
final int getAddedVerticeCount()
Return the number of newly added vertices during getTriangles(VerticesState) while transforming the o...
final ArrayList< Vertex > getVertices()
Return list of concatenated vertices associated with all Outlines of this object.
final ArrayList< Triangle > getTriangles(final VerticesState destinationType)
Triangulate the OutlineShape generating a list of triangles, while transformOutlines(VerticesState) b...
Abstract Outline shape representation define the method an OutlineShape(s) is bound and rendered.
Definition: Region.java:62
static final int MIN_AA_QUALITY
Minimum pass2 AA-quality rendering {@value} for Graph Region AA render-modes: VBAA_RENDERING_BIT.
Definition: Region.java:164
static boolean isTwoPass(final int renderModes)
Returns true if given renderModes has any of Region#AA_RENDERING_MASK set.
Definition: Region.java:213
static final int setRenderMode(int renderModes, final int mask, final boolean v)
Definition: Region.java:195
final boolean isStateDirty()
Returns true if this region's state is dirty, see markStateDirty().
Definition: Region.java:815
static final int MSAA_RENDERING_BIT
Rendering-Mode bit for Region.
Definition: Region.java:95
final boolean isVBAA()
Returns true if capable of two pass rendering - VBAA, otherwise false.
Definition: Region.java:358
final boolean hasColorChannel()
Returns true if getRenderModes() has a color channel, i.e.
Definition: Region.java:386
static final int clipAAQuality(final int v)
Returns clipped AA quality value to [Region#MIN_AA_QUALITY..Region#MAX_AA_QUALITY].
Definition: Region.java:170
static final int VARWEIGHT_RENDERING_BIT
Rendering-Mode bit for Region.
Definition: Region.java:131
static final boolean isRenderModeSet(final int renderModes, final int mask)
Definition: Region.java:194
static String getRenderModeString(final int renderModes, final int graphAAQuality, final int graphSampleCount, final int fsaaSampleCount)
Return a unique technical description string for renderModes and sample counts as follows:
Definition: Region.java:280
final void addOutlineShape(final OutlineShape shape, final AffineTransform t, final Vec4f rgbaColor)
Add the given OutlineShape to this region with the given optional AffineTransform.
Definition: Region.java:616
static final int DEFAULT_AA_QUALITY
Default pass2 AA-quality rendering {@value} for Graph Region AA render-modes: VBAA_RENDERING_BIT.
Definition: Region.java:168
static final int GL_UINT16_MAX
Definition: Region.java:479
static void put3f(final FloatBuffer b, final Vec3f v)
Definition: Region.java:467
static boolean isVBAA(final int renderModes)
Returns true if given renderModes has Region#VBAA_RENDERING_BIT set.
Definition: Region.java:198
static final int MIN_AA_SAMPLE_COUNT
Minimum pass2 AA sample count {@value} for Graph Region AA render-modes: Region#VBAA_RENDERING_BIT or...
Definition: Region.java:173
static boolean hasVariableWeight(final int renderModes)
Returns true if render mode capable of variable weights, i.e.
Definition: Region.java:222
static final int COLORCHANNEL_RENDERING_BIT
Rendering-Mode bit for Region to optionally enable a color-channel per vertex.
Definition: Region.java:148
final Frustum getFrustum()
See setFrustum(Frustum).
Definition: Region.java:402
final void addOutlineShapes(final List< OutlineShape > shapes, final AffineTransform transform, final Vec4f rgbaColor)
Add the given list of OutlineShapes to this region with the given optional AffineTransform.
Definition: Region.java:776
static final boolean DEBUG_ALL_EVENT
Definition: Region.java:64
static final int COLORTEXTURE_RENDERING_BIT
Rendering-Mode bit for Region.
Definition: Region.java:161
abstract void pushIndex(int idx)
static final int clipAASampleCount(final int v)
Returns clipped AA sample-count to [Region#MIN_AA_SAMPLE_COUNT..Region#MAX_AA_SAMPLE_COUNT].
Definition: Region.java:179
static String getRenderModeString(final int renderModes)
Returns a unique technical description string for renderModes as follows:
Definition: Region.java:251
static final int DEFAULT_TWO_PASS_TEXTURE_UNIT
Definition: Region.java:181
final boolean hasColorTexture()
Returns true if render mode has a color texture, i.e.
Definition: Region.java:397
abstract void pushVertex(final Vec3f coords, final Vec3f texParams, Vec4f rgba)
static boolean isMSAA(final int renderModes)
Returns true if given renderModes has Region#MSAA_RENDERING_BIT set.
Definition: Region.java:203
final boolean hasVariableWeight()
Returns true if capable of variable weights, otherwise false.
Definition: Region.java:374
static final int DEFAULT_AA_SAMPLE_COUNT
Default pass2 AA sample count {@value} for Graph Region AA render-modes: VBAA_RENDERING_BIT or Region...
Definition: Region.java:177
final void markStateDirty()
Mark this region's render-state dirty, i.e.
Definition: Region.java:811
final void clearDirtyBits(final int v)
See markShapeDirty() and markStateDirty().
Definition: Region.java:822
abstract void pushVertices(final Vec3f coords1, final Vec3f coords2, final Vec3f coords3, final Vec3f texParams1, final Vec3f texParams2, final Vec3f texParams3, Vec4f rgba)
PerfCounterCtrl perfCounter()
Definition: Region.java:553
static final int[] countOutlineShape(final OutlineShape shape, final int[] vertIndexCount)
Count required number of vertices and indices adding to given int[2] vertIndexCount array.
Definition: Region.java:572
static final int[] countOutlineShapes(final List< OutlineShape > shapes, final int[] vertIndexCount)
Count required number of vertices and indices adding to given int[2] vertIndexCount array.
Definition: Region.java:598
final boolean isShapeDirty()
Returns true if this region's shape are dirty, see markShapeDirty().
Definition: Region.java:801
static final int MAX_AA_QUALITY
Maximum pass2 AA-quality rendering {@value} for Graph Region AA render-modes: VBAA_RENDERING_BIT.
Definition: Region.java:166
final boolean isMSAA()
Returns true if capable of two pass rendering - MSAA, otherwise false.
Definition: Region.java:366
static final int AA_RENDERING_MASK
2-pass rendering bit-mask including MSAA_RENDERING_BIT and VBAA_RENDERING_BIT.
Definition: Region.java:118
final void setFrustum(final Frustum frustum)
Set Frustum culling for addOutlineShape(OutlineShape, AffineTransform, float[]).
Definition: Region.java:407
static boolean isGraphAA(final int renderModes)
Returns true if given renderModes has any of Region#AA_RENDERING_MASK set.
Definition: Region.java:208
static final int DIRTY_STATE
Definition: Region.java:184
static final int DIRTY_SHAPE
Definition: Region.java:183
static final int NORM_RENDERING_BIT
Rendering-Mode bit for Region.
Definition: Region.java:79
static final boolean DEBUG_INSTANCE
Definition: Region.java:65
static void put4f(final FloatBuffer b, final float v1, final float v2, final float v3, final float v4)
Definition: Region.java:470
Region(final int regionRenderModes, final boolean use_int32_idx)
Definition: Region.java:288
final int getRenderModes()
Returns bit-field of render modes, see create(..).
Definition: Region.java:344
final boolean isRenderModeSet(final int mask)
Definition: Region.java:352
static boolean hasColorChannel(final int renderModes)
Returns true if render mode has a color channel, i.e.
Definition: Region.java:231
static final int VBAA_RENDERING_BIT
Rendering-Mode bit for Region.
Definition: Region.java:115
static final int MAX_AA_SAMPLE_COUNT
Maximum pass2 AA sample count {@value} for Graph Region AA render-modes: Region#VBAA_RENDERING_BIT or...
Definition: Region.java:175
static final boolean DEBUG
Debug flag for [com.
Definition: Region.java:68
static void put3i(final IntBuffer b, final int v1, final int v2, final int v3)
Definition: Region.java:461
abstract void printBufferStats(PrintStream out)
Print implementation buffer stats like detailed and total size and capacity in bytes etc.
final AABBox getBounds()
Definition: Region.java:783
abstract boolean growBuffer(int verticesCount, int indicesCount)
Increase the renderer buffers if necessary to add given counts of vertices- and index elements.
abstract void pushIndices(int idx1, int idx2, int idx3)
final boolean usesI32Idx()
Returns true if implementation uses int32_t sized indices implying at least a GLProfile#isGL2ES3() al...
Definition: Region.java:305
static void put3s(final ShortBuffer b, final short v1, final short v2, final short v3)
Definition: Region.java:464
final void markShapeDirty()
Mark this region's shape dirty, i.e.
Definition: Region.java:797
static final int GL_INT32_MAX
Definition: Region.java:480
static boolean hasColorTexture(final int renderModes)
Returns true if render mode has a color texture, i.e.
Definition: Region.java:240
abstract boolean setBufferCapacity(int verticesCount, int indicesCount)
Set the renderer buffers pre-emptively for given vertices- and index counts.
static void put4f(final FloatBuffer b, final Vec4f v)
Definition: Region.java:473
A Vertex exposing Vec3f vertex- and texture-coordinates.
Definition: Vertex.java:37
final Vec3f getTexCoord()
Definition: Vertex.java:186
3D Vector based upon three float components.
Definition: Vec3f.java:37
4D Vector based upon four float components.
Definition: Vec4f.java:37
Axis Aligned Bounding Box.
Definition: AABBox.java:54
final AABBox reset()
Resets this box to the inverse low/high, allowing the next resize(float, float, float) command to hit...
Definition: AABBox.java:123
final AABBox resize(final AABBox newBox)
Resize the AABBox to encapsulate another AABox.
Definition: AABBox.java:274
Providing frustum planes derived by different inputs (P*MV, ..) used to classify objects.
Definition: Frustum.java:81
final boolean isOutside(final AABBox box)
Returns whether the given AABBox is completely outside of this frustum.
Definition: Frustum.java:424
final AABBox transform(final AABBox src, final AABBox dst)
Outline's vertices have undefined state until transformed.