CFx SDK Documentation 2024 SP0
Loading...
Searching...
No Matches
TrVisMetafileStream.h
Go to the documentation of this file.
1
2// Copyright (C) 2002-2022, Open Design Alliance (the "Alliance").
3// All rights reserved.
4//
5// This software and its documentation and related materials are owned by
6// the Alliance. The software may only be incorporated into application
7// programs owned by members of the Alliance, subject to a signed
8// Membership Agreement and Supplemental Software License Agreement with the
9// Alliance. The structure and organization of this software are the valuable
10// trade secrets of the Alliance and its suppliers. The software is also
11// protected by copyright law and international treaty provisions. Application
12// programs incorporating this software must include the following statement
13// with their copyright notices:
14//
15// This application incorporates Open Design Alliance software pursuant to a license
16// agreement with Open Design Alliance.
17// Open Design Alliance Copyright (C) 2002-2022 by Open Design Alliance.
18// All rights reserved.
19//
20// By use of this software, its documentation or related materials, you
21// acknowledge and accept the above terms.
23// GLES2 metafiles stream definitions
24
25#ifndef _EXTRVISMETAFILESTREAM_INCLUDED_
26#define _EXTRVISMETAFILESTREAM_INCLUDED_
27
28#include "TD_PackPush.h"
29
30#include "MetafileStreamBase.h"
31#include "Gs/Gs.h"
32#include "TrVisDefs.h"
33#include "Ps/PlotStyles.h"
34
35// Enable conversion from double to float for vertex and normal buffers
36#define OD_TRVIS_ENABLEFLOATCONVERSION
37
38#ifdef OD_TRVIS_ENABLEFLOATCONVERSION
39typedef float OdTrVisVertexType;
40#else
41typedef double OdTrVisVertexType;
42#endif
43
44void od_dbl2float(float *pFloats, const double *pDoubles, size_t numData);
45
46enum OdTrVisMetaRecType // Currently packed as one byte
47{
48 OdTrVisMetaRecType_Empty = 0x00, // No data record (useful for padding)
49 OdTrVisMetaRecType_EnableOpt = 0x01, // Enable rendering option
50 OdTrVisMetaRecType_DisableOpt = 0x02, // Disable rendering option
51 OdTrVisMetaRecType_Color = 0x03, // Setup color
52 OdTrVisMetaRecType_EnableArray = 0x04, // Enable rendering array
53 OdTrVisMetaRecType_DisableArray = 0x05, // Disable rendering array
54 OdTrVisMetaRecType_DrawArrays = 0x06, // Draw primitive
55 OdTrVisMetaRecType_DrawElements = 0x07, // Draw indexed primitive
56 OdTrVisMetaRecType_CullFace = 0x08, // Setup faces culling
57 OdTrVisMetaRecType_LStipple = 0x09, // Setup line pattern
58 OdTrVisMetaRecType_PStipple = 0x0A, // Setup fill pattern
59 OdTrVisMetaRecType_VPoint = 0x0B, // Draw single point (32 bit float format)
60 OdTrVisMetaRecType_VLine = 0x0C, // Draw single line (32 bit float format)
61 OdTrVisMetaRecType_IPoint = 0x0D, // Draw single indexed point
62 OdTrVisMetaRecType_ILine = 0x0E, // Draw single indexed line
63 OdTrVisMetaRecType_HLRStencil = 0x0F, // Enable HLR shading mode
64 OdTrVisMetaRecType_EnableShading = 0x10, // Enable shading option
65 OdTrVisMetaRecType_DisableShading = 0x11, // Disable shading option
66 OdTrVisMetaRecType_Material = 0x12, // Change material (shaded mode)
67 OdTrVisMetaRecType_UserEntry = 0x13, // User can process own data entries
68 OdTrVisMetaRecType_InitTexture = 0x14, // Set texture for raster image
69 OdTrVisMetaRecType_UninitTexture = 0x15, // Reset texture for raster image
70 OdTrVisMetaRecType_SelectionMarker = 0x16, // Stand-alone selection marker
71 OdTrVisMetaRecType_EnableMarkerArray = 0x17, // Enable markers array
72 OdTrVisMetaRecType_DisableMarkerArray = 0x18, // Disable markers array
73 OdTrVisMetaRecType_VisibilityFlags = 0x19, // Display and selection geometry visibility flags
74 OdTrVisMetaRecType_Lineweight = 0x1A, // Lineweight
75 OdTrVisMetaRecType_Linestyle = 0x1B, // Cap&Joint style
76 OdTrVisMetaRecType_Program = 0x1C, // Shader program
77 OdTrVisMetaRecType_TtfText = 0x1D, // Cached TtfFont
78 OdTrVisMetaRecType_PushMatrix = 0x1E, // Push transformation matrix
79 OdTrVisMetaRecType_PopMatrix = 0x1F, // Pop transformation matrix
80 OdTrVisMetaRecType_Metafile = 0x20, // Play nested metafile
81 OdTrVisMetaRecType_GeomMarker = 0x21, // Geometry marker
82 OdTrVisMetaRecType_VisualStyle = 0x22, // Visual Style
83 OdTrVisMetaRecType_MetafileMarker = 0x23, // Stand-alone metafile marker
84 OdTrVisMetaRecType_ExtensionObject = 0x24, // Play extension object graphics
85 OdTrVisMetaRecType_SelectionStyle = 0x25, // Highlighting with non-default style
86 OdTrVisMetaRecType_DPoint = 0x26, // Draw single point (64 bit float format)
87 OdTrVisMetaRecType_DLine = 0x27, // Draw single line (64 bit float format)
88 OdTrVisMetaRecType_Block = 0x28, // Nested block marker
89
90 OdTrVisMetaRecType_NTypes // == last + 1
91};
92
93// Convert OdTrVisMetaRecType into string representation
95
96enum OdTrVisMetaRecArrayType // Type of rendering array
97{
98 OdTrVisMetaRecArrayType_Vertex = 0x00, // Vertexes array
99 OdTrVisMetaRecArrayType_Color = 0x01, // Colors array
100 OdTrVisMetaRecArrayType_DiffuseTexCoord = 0x02, // Texture coordinates array
101 OdTrVisMetaRecArrayType_OpacityTexCoord = 0x03, // Opacity texture coordinates array
102 OdTrVisMetaRecArrayType_BumpMapTexCoord = 0x04, // Bump-mapping texture coordinates array
103 OdTrVisMetaRecArrayType_Normal = 0x05, // Primary normals array
104 OdTrVisMetaRecArrayType_Normal2 = 0x06, // Secondary normals array
105 OdTrVisMetaRecArrayType_BumpTNormal = 0x07, // First bump-mapping normals
106 OdTrVisMetaRecArrayType_BumpBNormal = 0x08, // Second bump-mapping normals
107 OdTrVisMetaRecArrayType_Depth = 0x09, // Depths array
108 OdTrVisMetaRecArrayType_SpriteCoord = 0x0A, // Trails data array
109
110 OdTrVisMetaRecArrayType_NTypes // == last + 1
112
113enum OdTrVisMetaRecMarkerType // Type of markers array
114{
115 OdTrVisMetaRecMarkerType_Selection = 0x00, // Selection markers array
116 OdTrVisMetaRecMarkerType_Metafile = 0x01, // Metafile markers array
117
120
121enum OdTrVisAttribute // List of attributes which modifies rendering conveyor states
122{
123 OdTrVisAttribute_Depth = 0x00, // Disable depth buffer
124 OdTrVisAttribute_Blend = 0x01, // Enable colors blending (transparency)
125 OdTrVisAttribute_Lighting = 0x02, // Faces lighting state
126 OdTrVisAttribute_Highlighting = 0x03, // Highlighting state
127
131
132enum OdTrVisShading // List of shading attributes which modifies geometry behavior
133{
134 OdTrVisShading_Gouraud = 0x00, // Vertex colors state
135 OdTrVisShading_MultiNormals = 0x01, // Face come with vertex and face normals for gouraud and flat shading
136 OdTrVisShading_Disable2dLineweights = 0x02, // Disable lineweight display in 2d
137 OdTrVisShading_NoColorOverride = 0x03, // Avoid all color overrides
138 OdTrVisShading_LinkedLinesList = 0x04, // Marks geometry with linked line lists
139
140 OdTrVisShading_NTypes, // == last + 1
143
144enum OdTrVisFaceCulling // List of face culling states
145{
146 // Culling modes for faces
147 OdTrVisCullFace_None = 0x00, // Disable face culling (default state)
148 OdTrVisCullFace_Back = 0x01, // Enable back faces culling
149 OdTrVisCullFace_Front = 0x02, // Enable front faces culling
150 OdTrVisCullFace_Default = 0x03, // Invoke default faces culling method
151 // Culling modes for edges
152 OdTrVisCullEdge_None = 0x00, // Disable edge culling (default state)
153 OdTrVisCullEdge_Back = 0x04, // Back edges culling
154 OdTrVisCullEdge_Front = 0x08, // Front edges culling
155 OdTrVisCullEdge_Default = 0x0C, // Default edges culling method
156 // Number of invoked flags
159
160// OdTrVisFaceCulling helpers
162{ return (OdTrVisFaceCulling)(faceMode | edgeMode); }
163inline void splitCullingModes(OdTrVisFaceCulling &cullingMode, OdTrVisFaceCulling &edgeMode)
164{ edgeMode = (OdTrVisFaceCulling)(cullingMode & OdTrVisCullEdge_Default); cullingMode = (OdTrVisFaceCulling)(cullingMode & OdTrVisCullFace_Default); }
166{ return (OdTrVisFaceCulling)((faceMode & OdTrVisCullFace_Default) << 2); }
168{ return (OdTrVisFaceCulling)((edgeMode >> 2) & OdTrVisCullFace_Default); }
169
171{
172 OdTrVisVblFlag_DontDisplayUnhighlighted = (1 << 0), // Don't display underlying geometry if it is not highlighted.
173 OdTrVisVblFlag_DontSelectUnhighlighted = (1 << 1), // Don't select underlying geometry if it is not highlighted.
174 OdTrVisVblFlag_DontDisplayHighlighted = (1 << 2), // Don't display underlying geometry if it is highlighted.
175 OdTrVisVblFlag_DontSelectHighlighted = (1 << 3), // Don't select underlying geometry if it is highlighted.
176 OdTrVisVblFlag_DontDisplayIn2d = (1 << 4), // Don't display underlying geometry in 2d rendering mode.
177 OdTrVisVblFlag_DontSelectIn2d = (1 << 5), // Don't select underlying geometry in 2d rendering mode.
178 OdTrVisVblFlag_DontDisplayIn3d = (1 << 6), // Don't display underlying geometry in 3d rendering modes.
179 OdTrVisVblFlag_DontSelectIn3d = (1 << 7), // Don't select underlying geometry in 3d rendering modes.
183
184enum OdTrVisAffection // List of metafile affections
185{
186 OdTrVisAffection_Attributes = 0x01, // Affects attributes/disable/enable
187 OdTrVisAffection_Colors = (0x01 << 1), // Affects color
188 OdTrVisAffection_Materials = (0x01 << 2), // Affects materal
189 OdTrVisAffection_Arrays = (0x01 << 3), // Affects arrays
190 OdTrVisAffection_Geometry = (0x01 << 4), // Call's geometry rendering
191 OdTrVisAffection_Proxy = (0x01 << 5) // Proxy rendering invoked
193
194enum OdTrVisPushMatrixType // Type of matrixes utilized by PushMatrix metafile entries
195{
196 OdTrVisPushMatrixType_Identity = 0, // Identity matrix, no input matrix
197 OdTrVisPushMatrixType_Full // Complete 4x4 matrix
199
200enum OdTrVisBlockRecType // Type of block record utilized by Block metafile entries
201{
202 OdTrVisBlockRecType_Auto = 0x41, // 'A' : Renderer should automatically filter embedded metafiles list.
203 OdTrVisBlockRecType_BuiltIn = 0x42, // 'B' : Render already registered block stream list.
204 OdTrVisBlockRecType_SizedAuto = 0x43, // 'C' : "Auto" with precalculated number of metafile entries.
205 OdTrVisBlockRecType_Sized = 0x44, // 'D' : "Embedded" with precalculated number of metafile entries.
206 OdTrVisBlockRecType_Embedded = 0x45, // 'E' : Store single copy of embedded metafiles list.
207 OdTrVisBlockRecType_EOF = 0x46 // 'F' : EOF for 'A' and 'E'. Ignored elsewhere.
209
211{
212 OdTrVisGeomType_Default = 0, // Non-classified geometry which take part in any rendering mode, like simple lines
213 // Facet markers
214 OdTrVisGeomType_2dFacets = 1, // Non-shaded facets (visible in all modes except hidden line)
215 OdTrVisGeomType_2dFacetsNoFill = 2, // Non-shaded facets (visible in all modes except hidden line), invisible in 2d
216 OdTrVisGeomType_3dFacets = 3, // Shaded facets (invisible in 2d in case if filling disabled)
217 OdTrVisGeomType_3dFacetsNoFill = 4, // Shaded facets (invisible in 2d in case if filling disabled), invisible in 2d
218 OdTrVisGeomType_RasterImageFacets = 5, // Raster image facets (visible in all modes)
219 // Edge markers
220 OdTrVisGeomType_2dFacetEdges = 6, // Non-shaded facet edges (invisible in shaded modes w/o wireframe)
221 OdTrVisGeomType_3dFacetEdges = 7, // Shaded facet edges (available with isolines only)
222 OdTrVisGeomType_Isolines = 8, // Isolines (simple polylines doesn't marked)
223 OdTrVisGeomType_EdgesWithIsolines = 9, // Represent shaded facet edges and isolines together
224 OdTrVisGeomType_HatchIsolineEdges = 10, // Hatch isoline edges (invisible in HiddenLine)
225 OdTrVisGeomType_FillPatternEdges = 11, // Shell filling patterns (for ODA BimRv filling patterns support)
226 OdTrVisGeomType_IntersectionEdges = 12, // Intersection edges
227 OdTrVisGeomType_Silhouettes = 13, // Silhouettes (stub for future needs)
228 // Number of registered geometry visibility types
231
232// Check visibility of geometry type for specified rendering mode
234
235// Geometry primitives
237{
247
254{
255 void *m_pData;
256 OdUInt32 m_uData : 4; // Data type size (0-1, 1-2, 3-4, 4-8, etc).
257 OdUInt32 m_uSize : 28; // Number of data types (Full data size = m_uSize << m_uData).
258 OdUInt32 m_type : 4; // Data type layout
259 OdUInt32 m_bind : 28; // Binding index (depends from renderer)
260
261 enum Type
262 { // Actually represents only data layout. Physically can be used for different processes.
263 Type_Vertex = 0, // Flt*3
264 Type_Normal, // Flt*3 (normalized)
265 Type_Color, // Flt*4
267 Type_Depth, // Flt*1
268 Type_Index, // U16*1
269 Type_Marker, // Marker
270
271 Type_Cache, // For internal use
272 Type_Selection, //Mapped vertices for gpu selection
275 };
276
278 { DS_1 = 0, DS_2 = 1, DS_4 = 2, DS_8 = 3, DS_16 = 4, DS_32 = 5, DS_64 = 6 };
279
281 : m_pData(NULL)
282 , m_uData(0)
283 , m_uSize(0)
285 , m_bind(0)
286 { }
287
288 inline OdUInt32 arraySize() const { return m_uSize << m_uData; }
289 inline Type type() const { return (Type)m_type; }
290 inline DataSize dataSize() const { return (DataSize)m_uData; }
292 { return ((dataSize == 1) ? DS_1 : ((dataSize == 2) ? DS_2 : ((dataSize == 4) ? DS_4 : ((dataSize == 8) ? DS_8 :
293 ((dataSize == 16) ? DS_16 : ((dataSize == 32) ? DS_32 : ((dataSize == 64) ? DS_64 : DS_1)))))));
294 }
295
296 static const struct ReallocLogic
297 { OdInt32 m_nGrowOption;
298 ReallocLogic(OdInt32 nGrowOption = 0)
299 : m_nGrowOption(nGrowOption) { }
300 void *extendArray(OdTrVisArrayWrapper &arry, OdUInt32 nBytesAlloc) const;
302
303 void setArray(Type type, const void *pPtr, OdUInt32 size, DataSize ds);
307 void concatArray(const void *pPtr, OdUInt32 size, DataSize ds, const ReallocLogic &racLg = g_defaultReallocLogic);
308
309 OD_FORCEINLINE void setArray(Type type, const void *pPtr, OdUInt32 size, size_t ds)
310 { setArray(type, pPtr, size, dataSizeEst(ds)); }
311 OD_FORCEINLINE void concatArray(const void *pPtr, OdUInt32 size, size_t ds, const ReallocLogic &racLg = g_defaultReallocLogic)
312 { concatArray(pPtr, size, dataSizeEst(ds), racLg); }
313
314 // Double->float
315 void setArray_flt(Type type, const double *pPtr, OdUInt32 size);
316 void concatArray_flt(const double *pPtr, OdUInt32 size, const ReallocLogic &racLg = g_defaultReallocLogic);
317 // UInt8->float
319 void concatArray_flt(const OdUInt8 *pPtr, OdUInt32 size, const ReallocLogic &racLg = g_defaultReallocLogic);
320 // UInt8->double
322 void concatArray_dbl(const OdUInt8 *pPtr, OdUInt32 size, const ReallocLogic &racLg = g_defaultReallocLogic);
323 // Float->double
324 void setArray_dbl(Type type, const float *pPtr, OdUInt32 size);
325 void concatArray_dbl(const float *pPtr, OdUInt32 size, const ReallocLogic &racLg = g_defaultReallocLogic);
326 // Float->UInt8
327 void setArray_u8c(Type type, const float *pPtr, OdUInt32 size);
328 void concatArray_u8c(const float *pPtr, OdUInt32 size, const ReallocLogic &racLg = g_defaultReallocLogic);
329 // Int32->UInt16
331 void concatArray_ush(const OdInt32 *pPtr, OdUInt32 size, const ReallocLogic &racLg = g_defaultReallocLogic);
332 // UInt16->Int32
334 void concatArray_int(const OdUInt16 *pPtr, OdUInt32 size, const ReallocLogic &racLg = g_defaultReallocLogic);
335 // Int32->UInt8
337 void concatArray_u8i(const OdInt32 *pPtr, OdUInt32 size, const ReallocLogic &racLg = g_defaultReallocLogic);
338 // UInt16->Int8
340 void concatArray_u8i(const OdUInt16 *pPtr, OdUInt32 size, const ReallocLogic &racLg = g_defaultReallocLogic);
341 // Float->HalfFloat
342 void setArray_hfl(Type type, const float *pPtr, OdUInt32 size);
343 void concatArray_hfl(const float *pPtr, OdUInt32 size, const ReallocLogic &racLg = g_defaultReallocLogic);
344 // Double->HalfFloat
345 void setArray_hfl(Type type, const double *pPtr, OdUInt32 size);
346 void concatArray_hfl(const double *pPtr, OdUInt32 size, const ReallocLogic &racLg = g_defaultReallocLogic);
347
348 // Convert vertex array to floats (possible for Vertex/Normal/Color/TexCoord and Depth array types only)
349 bool asFloatsArray(OdFloatArray &result) const;
350
351 void save(OdGsFiler *pFiler) const;
352 void load(OdGsFiler *pFiler);
353};
354
355// Selection/metafile markers
356
357template <typename UInt64Type>
359{
360 UInt64Type m_nMark;
362 typedef UInt64Type data_type;
363 private: OdUInt32 padding;
364 public: OdTrVisMarkBase() : padding(0) {} enum EnPosInit { kNone };
365 OdTrVisMarkBase(UInt64Type nMark) : m_nMark(nMark), padding(0) {}
366 OdTrVisMarkBase(UInt64Type nMark, OdUInt32 uFrom) : m_nMark(nMark), m_uFrom(uFrom), padding(0) {}
367 OdTrVisMarkBase(EnPosInit, OdUInt32 uFrom) : m_uFrom(uFrom), padding(0) {}
368};
369// Default processing marker (for internal use only)
371// Selection marker
373// Metafile marker
375
381{
382 protected:
387 public:
390 OdTrVisLwdStyle(bool bByDefault, OdPs::LineEndStyle lesStyle, OdPs::LineJoinStyle ljsStyle)
391 { m_curStyleDef = 1; setCurUsesDef(bByDefault); setCurLesStyle(lesStyle); setCurLjsStyle(ljsStyle); }
392 void setCurStyleDef(bool bSet) { m_curStyleDef = (bSet) ? 1 : 0; }
393 bool curStyleDef() const { return m_curStyleDef != 0; }
394 void setCurUsesDef(bool bSet) { m_curUsesDef = (bSet) ? 1 : 0; }
395 bool curUsesDef() const { return m_curUsesDef != 0; }
400 bool operator ==(const OdTrVisLwdStyle &sec) const
401 { if (m_curUsesDef == sec.m_curUsesDef)
402 { if (m_curUsesDef) return true;
403 return (m_curLesStyle == sec.m_curLesStyle) && (m_curLjsStyle == sec.m_curLjsStyle);
404 } return false;
405 }
406 bool operator !=(const OdTrVisLwdStyle &sec) const
407 { if (m_curUsesDef == sec.m_curUsesDef)
408 { if (m_curUsesDef) return false;
409 return (m_curLesStyle != sec.m_curLesStyle) || (m_curLjsStyle != sec.m_curLjsStyle);
410 } return true;
411 }
412};
413
419{
422 protected:
423 union {
428 public:
429 OdTrVisLwdSetting() : m_type(0) { m_val.m_iLineWeight = 0; }
430 OdTrVisLwdSetting(double dVal, LwdType typ = kPlotStyle) : m_type(typ) { m_val.m_dLineWeight = dVal; }
431 OdTrVisLwdSetting(OdDb::LineWeight lw, LwdType typ = kDatabase) : m_type(typ) { m_val.m_iLineWeight = (OdInt64)lw; }
432 OdTrVisLwdSetting(OdInt32 pix, LwdType typ = kPixels) : m_type(typ) { m_val.m_iLineWeight = (OdInt64)pix; }
433 // Type
434 void setType(LwdType typ) { m_type = (OdUInt8)typ; }
435 LwdType type() const { return (LwdType)m_type; }
436 bool isForcedLineweight() const { return (m_type == kPixels) && (m_val.m_iLineWeight > 0); }
437 // dLineWeight
438 void setDLineWeight(double dVal, LwdType typ = kPlotStyle) { m_val.m_dLineWeight = dVal; m_type = typ; }
439 double dLineWeight() const { return m_val.m_dLineWeight; }
440 // lwLineWeight
441 void setLwLineWeight(OdDb::LineWeight lw, LwdType typ = kDatabase) { m_val.m_iLineWeight = (OdInt64)lw; m_type = typ; }
442 OdDb::LineWeight lwLineWeight() const { return (OdDb::LineWeight)m_val.m_iLineWeight; }
443 // pixLineWeight
444 void setPixLineWeight(OdInt32 pix, LwdType typ = kPixels) { m_val.m_iLineWeight = pix; m_type = typ; }
445 OdInt32 pixLineWeight() const { return (OdInt32)m_val.m_iLineWeight; }
446 // Comparators
447 bool operator ==(const OdTrVisLwdSetting &sec) const
448 { if (m_type == sec.m_type)
449 { switch (m_type)
450 { case kDatabase:
451 case kPixels: return m_val.m_iLineWeight == sec.m_val.m_iLineWeight;
452 case kAbsolute:
453 case kPlotStyle: return OdEqual(m_val.m_dLineWeight, sec.m_val.m_dLineWeight);
454 } }
455 return false;
456 }
457 bool operator !=(const OdTrVisLwdSetting &sec) const
458 { if (m_type == sec.m_type)
459 { switch (m_type)
460 { case kDatabase:
461 case kPixels: return m_val.m_iLineWeight != sec.m_val.m_iLineWeight;
462 case kAbsolute:
463 case kPlotStyle: return !OdEqual(m_val.m_dLineWeight, sec.m_val.m_dLineWeight);
464 } }
465 return true;
466 }
467 bool hasLineweight() const
468 { switch (m_type)
469 { case kDatabase: return m_val.m_iLineWeight != OdDb::kLnWt000;
470 case kAbsolute:
471 case kPlotStyle: return OdNonZero(m_val.m_dLineWeight);
472 case kPixels: return m_val.m_iLineWeight > 1;
473 }
474 return false;
475 }
476 bool isPs() const { return GETBIT(m_type, 1); }
477 static bool isPs(LwdType type) { return GETBIT(type, 1); }
478};
479
487class OdTrVisFlatMetafileContainer : public OdFlatMetafileContainer
488{
489 public:
490 OdArray<OdTrVisArrayWrapper> m_ArrayElements; // Array contain pointers to some memory elements
491 public:
494
496
498 {
499 m_ArrayElements.push_back(static_cast<const OdTrVisArrayWrapper&>(element));
500 return OdTrVisArrayId(m_ArrayElements.size() - 1);
501 }
503 {
504 return m_ArrayElements.size();
505 }
507 {
508 return m_ArrayElements.at((OdUInt32)nElem);
509 }
511 {
512 return m_ArrayElements.at((OdUInt32)nElem);
513 }
514
516
518 { OdUInt64 calcSize = 0;
519 const OdUInt32 nArrays = arrayElementsSize(); // Include size of arrays
520 for (OdUInt32 nArray = 0; nArray < nArrays; nArray++)
521 calcSize += arrayElement((OdTrVisArrayId)nArray).arraySize() + sizeof(OdTrVisArrayWrapper);
522 return calcSize;
523 }
524
525 // Base container overrides
527
528 // OdFlatMetafileContainer overrides
529 OdFlatMetafileContainer *createMe() const { return new OdTrVisFlatMetafileContainer; }
530 // Clone stream data with gaps elimination
531 OdFlatMetafileContainer *clone(const Gap *pGaps = NULL) const
532 { OdTrVisFlatMetafileContainer *pCont = static_cast<OdTrVisFlatMetafileContainer*>(OdFlatMetafileContainer::clone(pGaps));
533 for (OdUInt32 nArray = 0, nArrays = arrayElementsSize(); nArray < nArrays; nArray++)
534 { const OdTrVisArrayWrapper &fromArr = arrayElement((OdTrVisArrayId)nArray);
535 OdTrVisArrayWrapper newArr; newArr.setArray((OdTrVisArrayWrapper::Type)fromArr.m_type, fromArr.m_pData, fromArr.m_uSize, fromArr.m_uData);
536 pCont->appendArrayElement(newArr);
537 }
538 return pCont;
539 }
540
541 OdBaseMetafileContainerReader *createReader() const;
542 OdBaseMetafileContainerWriter *createWriter() const;
543
544 // Extended GLES2 container manipulators
545
546 // Direct access to stream memory
547 inline const OdUInt8 *memoryPtr() const
548 {
549 return m_pData;
550 }
551};
552
560class OdTrVisFlatMetafileContainerWriter : public OdFlatMetafileContainerWriter
561{
562 public:
563 OdTrVisFlatMetafileContainerWriter() : OdFlatMetafileContainerWriter() { }
564 OdTrVisFlatMetafileContainerWriter(OdBaseMetafileContainer *pContainer) : OdFlatMetafileContainerWriter(pContainer) { }
565
566 inline OdBaseMetafileContainer *createContainer() const
567 {
568 return new OdTrVisFlatMetafileContainer();
569 }
570
571 inline OdTrVisFlatMetafileContainer *glContainer() const { return static_cast<OdTrVisFlatMetafileContainer*>(container()); }
572};
573
581class OdTrVisFlatMetafileContainerReader : public OdFlatMetafileContainerReader
582{
583 public:
584 OdTrVisFlatMetafileContainerReader() : OdFlatMetafileContainerReader() { }
585 OdTrVisFlatMetafileContainerReader(OdBaseMetafileContainer *pContainer) : OdFlatMetafileContainerReader(pContainer) { }
586
587 inline OdBaseMetafileContainer *createContainer() const
588 {
589 return new OdTrVisFlatMetafileContainer();
590 }
591
592 inline OdTrVisFlatMetafileContainer *glContainer() const { return static_cast<OdTrVisFlatMetafileContainer*>(container()); }
593};
594
595// Optimization definitions:
596#define OD_OGL_RDR_SEEKFWD(pMemPtr, uSize) (pMemPtr) += (uSize)
597#define OD_OGL_RDR_SEEKBWD(pMemPtr, uSize) (pMemPtr) -= (uSize)
598#define OD_OGL_RDR_SEEKINC(pMemPtr) (pMemPtr)++
599#define OD_OGL_RDR_SEEKDEC(pMemPtr) (pMemPtr)--
600
601#define OD_OGL_RDR_READVAL(cType, pMemPtr) *(cType*)(pMemPtr)
602#define OD_OGL_RDR_READVALOFFSET(cType, pMemPtr, uOffset) *(cType*)((pMemPtr) + (uOffset))
603#define OD_OGL_RDR_READVALRETYPE(cOutType, cInType, pMemPtr) (cOutType)OD_OGL_RDR_READVAL(cInType, pMemPtr)
604#define OD_OGL_RDR_READVALOFFSETRETYPE(cOutType, cInType, pMemPtr, uOffset) (cOutType)OD_OGL_RDR_READVALOFFSET(cInType, pMemPtr, uOffset)
605#define OD_OGL_RDR_GETPTRNATIVE(cType, pMemPtr) (cType*)(pMemPtr)
606#define OD_OGL_RDR_GETPTRNATIVEOFFSET(cType, pMemPtr, uSize) (cType*)((pMemPtr) + (uSize))
607#define OD_OGL_RDR_GETPTRSTORAGE(imedType, name, count)
608#define OD_OGL_RDR_GETPTR(cType, imedType, name, count, pMemPtr) OD_OGL_RDR_GETPTRNATIVE(cType, pMemPtr)
609#define OD_OGL_RDR_GETPTROFFSET(cType, imedType, name, count, pMemPtr, uSize) OD_OGL_RDR_GETPTRNATIVEOFFSET(cType, pMemPtr, uSize)
610
611#define OD_OGL_RDR_INITIATE(pMemPtr, uSize) const OdUInt8 *pMemPtrReadFor = (const OdUInt8*)pMemPtr + uSize
612#define OD_OGL_RDR_CHECKEOF(pMemPtr) pMemPtr < pMemPtrReadFor
613
614#include "TD_PackPop.h"
615
616#endif // _EXTRVISMETAFILESTREAM_INCLUDED_
unsigned int OdUInt32
unsigned short OdUInt16
int OdInt32
unsigned char OdUInt8
wchar_t OdChar
bool OdEqual(double x, double y, double tol=1.e-10)
Definition: OdaDefs.h:542
bool OdNonZero(double x, double tol=1.e-10)
Definition: OdaDefs.h:537
#define GETBIT(flags, bit)
Definition: OdaDefs.h:517
#define OD_CONSTEXPR_FUNC
Definition: TrVisDefs.h:57
OdUInt32 OdTrVisArrayId
Definition: TrVisDefs.h:100
#define OD_FORCEINLINE
Definition: TrVisDefs.h:41
OdTrVisShading
@ OdTrVisShading_Gouraud
@ OdTrVisShading_NoColorOverride
@ OdTrVisShading_NTypes
@ OdTrVisShading_MultiNormals
@ OdTrVisShading_Disable2dLineweights
@ OdTrVisShading_LinkedLinesList
@ OdTrVisShading_Mask
OdTrVisFaceCulling faceCullingModeAsEdge(OdTrVisFaceCulling faceMode)
OdTrVisVisibilityFlags
@ OdTrVisVblFlag_DontSelectHighlighted
@ OdTrVisVblFlag_DontSelectUnhighlighted
@ OdTrVisVblFlag_Default
@ OdTrVisVblFlag_DontSelectIn2d
@ OdTrVisVblFlag_DontDisplayIn2d
@ OdTrVisVblFlag_DontDisplayHighlighted
@ OdTrVisVblFlag_DontDisplayIn3d
@ OdTrVisVblFlag_DontSelectIn3d
@ OdTrVisVblFlag_FlagsMask
@ OdTrVisVblFlag_DontDisplayUnhighlighted
OdTrVisMarkBase< OdTrVisGsMarker > OdTrVisSelMark
OdTrVisMetaRecArrayType
@ OdTrVisMetaRecArrayType_Depth
@ OdTrVisMetaRecArrayType_Normal2
@ OdTrVisMetaRecArrayType_BumpTNormal
@ OdTrVisMetaRecArrayType_Normal
@ OdTrVisMetaRecArrayType_NTypes
@ OdTrVisMetaRecArrayType_BumpMapTexCoord
@ OdTrVisMetaRecArrayType_DiffuseTexCoord
@ OdTrVisMetaRecArrayType_SpriteCoord
@ OdTrVisMetaRecArrayType_OpacityTexCoord
@ OdTrVisMetaRecArrayType_BumpBNormal
@ OdTrVisMetaRecArrayType_Vertex
@ OdTrVisMetaRecArrayType_Color
OdTrVisMetaRecType
@ OdTrVisMetaRecType_GeomMarker
@ OdTrVisMetaRecType_DrawArrays
@ OdTrVisMetaRecType_DPoint
@ OdTrVisMetaRecType_Metafile
@ OdTrVisMetaRecType_HLRStencil
@ OdTrVisMetaRecType_PopMatrix
@ OdTrVisMetaRecType_Block
@ OdTrVisMetaRecType_Color
@ OdTrVisMetaRecType_UninitTexture
@ OdTrVisMetaRecType_EnableMarkerArray
@ OdTrVisMetaRecType_DisableMarkerArray
@ OdTrVisMetaRecType_SelectionStyle
@ OdTrVisMetaRecType_NTypes
@ OdTrVisMetaRecType_EnableOpt
@ OdTrVisMetaRecType_VisualStyle
@ OdTrVisMetaRecType_SelectionMarker
@ OdTrVisMetaRecType_Empty
@ OdTrVisMetaRecType_MetafileMarker
@ OdTrVisMetaRecType_UserEntry
@ OdTrVisMetaRecType_DrawElements
@ OdTrVisMetaRecType_DLine
@ OdTrVisMetaRecType_DisableOpt
@ OdTrVisMetaRecType_Program
@ OdTrVisMetaRecType_DisableShading
@ OdTrVisMetaRecType_VLine
@ OdTrVisMetaRecType_ILine
@ OdTrVisMetaRecType_LStipple
@ OdTrVisMetaRecType_PushMatrix
@ OdTrVisMetaRecType_ExtensionObject
@ OdTrVisMetaRecType_DisableArray
@ OdTrVisMetaRecType_Linestyle
@ OdTrVisMetaRecType_VPoint
@ OdTrVisMetaRecType_InitTexture
@ OdTrVisMetaRecType_EnableArray
@ OdTrVisMetaRecType_Lineweight
@ OdTrVisMetaRecType_EnableShading
@ OdTrVisMetaRecType_TtfText
@ OdTrVisMetaRecType_VisibilityFlags
@ OdTrVisMetaRecType_IPoint
@ OdTrVisMetaRecType_PStipple
@ OdTrVisMetaRecType_Material
@ OdTrVisMetaRecType_CullFace
float OdTrVisVertexType
OdTrVisMetaRecMarkerType
@ OdTrVisMetaRecMarkerType_Selection
@ OdTrVisMetaRecMarkerType_NTypes
@ OdTrVisMetaRecMarkerType_Metafile
OdTrVisAttribute
@ OdTrVisAttribute_Highlighting
@ OdTrVisAttribute_Mask
@ OdTrVisAttribute_Lighting
@ OdTrVisAttribute_Blend
@ OdTrVisAttribute_Depth
@ OdTrVisAttribute_NTypes
OdTrVisBlockRecType
@ OdTrVisBlockRecType_Auto
@ OdTrVisBlockRecType_Sized
@ OdTrVisBlockRecType_Embedded
@ OdTrVisBlockRecType_BuiltIn
@ OdTrVisBlockRecType_EOF
@ OdTrVisBlockRecType_SizedAuto
const OdChar * chunkDecode(OdTrVisMetaRecType rt)
OdTrVisMarkBase< OdUInt64 > OdTrVisDefProcMark
void splitCullingModes(OdTrVisFaceCulling &cullingMode, OdTrVisFaceCulling &edgeMode)
void od_dbl2float(float *pFloats, const double *pDoubles, size_t numData)
OdTrVisGeomType
@ OdTrVisGeomType_3dFacetsNoFill
@ OdTrVisGeomType_HatchIsolineEdges
@ OdTrVisGeomType_Silhouettes
@ OdTrVisGeomType_2dFacetEdges
@ OdTrVisGeomType_Isolines
@ OdTrVisGeomType_3dFacetEdges
@ OdTrVisGeomType_2dFacets
@ OdTrVisGeomType_NTypes
@ OdTrVisGeomType_FillPatternEdges
@ OdTrVisGeomType_Default
@ OdTrVisGeomType_RasterImageFacets
@ OdTrVisGeomType_2dFacetsNoFill
@ OdTrVisGeomType_EdgesWithIsolines
@ OdTrVisGeomType_3dFacets
@ OdTrVisGeomType_IntersectionEdges
OdTrVisFaceCulling edgeCullingModeAsFace(OdTrVisFaceCulling edgeMode)
OdTrVisFaceCulling combineCullingModes(OdTrVisFaceCulling faceMode, OdTrVisFaceCulling edgeMode)
OdTrVisGeomPrim
@ kTrVisLines
@ kTrVisTriangles
@ kTrVisTriangleFan
@ kTrVisGeomPrimInvalid
@ kTrVisTriangleStrip
@ kTrVisLineLoop
@ kTrVisPoints
@ kTrVisLineStrip
OdTrVisMarkBase< OdTrVisMetafileId > OdTrVisMetaMark
OdTrVisFaceCulling
@ OdTrVisCullEdge_Front
@ OdTrVisCullEdge_NFlags
@ OdTrVisCullFace_None
@ OdTrVisCullFace_Default
@ OdTrVisCullFace_Front
@ OdTrVisCullEdge_None
@ OdTrVisCullFace_Back
@ OdTrVisCullEdge_Back
@ OdTrVisCullEdge_Default
OdTrVisPushMatrixType
@ OdTrVisPushMatrixType_Identity
@ OdTrVisPushMatrixType_Full
OdTrVisAffection
@ OdTrVisAffection_Proxy
@ OdTrVisAffection_Materials
@ OdTrVisAffection_Geometry
@ OdTrVisAffection_Colors
@ OdTrVisAffection_Arrays
@ OdTrVisAffection_Attributes
bool isGeomTypeVisible(OdTrVisGeomType geomType, OdGsView::RenderMode rMode)
size_type size() const
Definition: OdArray.h:1247
void push_back(const T &value)
Definition: OdArray.h:1411
T & at(size_type arrayIndex)
Definition: OdArray.h:1642
RenderMode
Definition: Gs.h:148
Definition: Int64.h:43
void optimizeMemory(OdUInt32 uSize)
OdArray< OdTrVisArrayWrapper > m_ArrayElements
OdFlatMetafileContainer * createMe() const
const OdUInt8 * memoryPtr() const
const OdTrVisArrayWrapper & arrayElement(OdTrVisArrayId nElem) const
OdBaseMetafileContainerWriter * createWriter() const
OdTrVisArrayId appendArrayElement(const OdTrVisArrayWrapper &element)
OdFlatMetafileContainer * clone(const Gap *pGaps=NULL) const
OdTrVisArrayId lastArrayElement() const
OdTrVisArrayWrapper & arrayElement(OdTrVisArrayId nElem)
OdBaseMetafileContainerReader * createReader() const
OdTrVisFlatMetafileContainer * glContainer() const
OdTrVisFlatMetafileContainerReader(OdBaseMetafileContainer *pContainer)
OdBaseMetafileContainer * createContainer() const
OdBaseMetafileContainer * createContainer() const
OdTrVisFlatMetafileContainer * glContainer() const
OdTrVisFlatMetafileContainerWriter(OdBaseMetafileContainer *pContainer)
GLsizeiptr size
Definition: gles2_ext.h:182
GLuint GLsizei GLsizei GLint GLenum * type
Definition: gles2_ext.h:274
LineWeight
Definition: OdaDefs.h:386
@ kLnWt000
Definition: OdaDefs.h:387
LineJoinStyle
Definition: PlotStyles.h:78
LineEndStyle
Definition: PlotStyles.h:69
void concatArray_int(const OdUInt16 *pPtr, OdUInt32 size, const ReallocLogic &racLg=g_defaultReallocLogic)
void concatArray_hfl(const float *pPtr, OdUInt32 size, const ReallocLogic &racLg=g_defaultReallocLogic)
void setArray_u8c(Type type, const float *pPtr, OdUInt32 size)
void save(OdGsFiler *pFiler) const
void setArray_flt(Type type, const OdUInt8 *pPtr, OdUInt32 size)
OdUInt32 arraySize() const
void concatArray_u8i(const OdUInt16 *pPtr, OdUInt32 size, const ReallocLogic &racLg=g_defaultReallocLogic)
void setArray_int(Type type, const OdUInt16 *pPtr, OdUInt32 size)
void setArray_ush(Type type, const OdInt32 *pPtr, OdUInt32 size)
void concatArray_ush(const OdInt32 *pPtr, OdUInt32 size, const ReallocLogic &racLg=g_defaultReallocLogic)
void concatArray_hfl(const double *pPtr, OdUInt32 size, const ReallocLogic &racLg=g_defaultReallocLogic)
void setArray_flt(Type type, const double *pPtr, OdUInt32 size)
void concatArray_flt(const double *pPtr, OdUInt32 size, const ReallocLogic &racLg=g_defaultReallocLogic)
static OD_CONSTEXPR_FUNC DataSize dataSizeEst(size_t dataSize)
void setArray_hfl(Type type, const double *pPtr, OdUInt32 size)
void setArray_dbl(Type type, const float *pPtr, OdUInt32 size)
void concatArray_dbl(const float *pPtr, OdUInt32 size, const ReallocLogic &racLg=g_defaultReallocLogic)
DataSize dataSize() const
void concatArray_dbl(const OdUInt8 *pPtr, OdUInt32 size, const ReallocLogic &racLg=g_defaultReallocLogic)
void concatArray_u8c(const float *pPtr, OdUInt32 size, const ReallocLogic &racLg=g_defaultReallocLogic)
void setArray_hfl(Type type, const float *pPtr, OdUInt32 size)
OD_FORCEINLINE void setArray(Type type, const void *pPtr, OdUInt32 size, size_t ds)
void setArray(Type type, const void *pPtr, OdUInt32 size, DataSize ds)
void setArray_u8i(Type type, const OdInt32 *pPtr, OdUInt32 size)
static const struct OdTrVisArrayWrapper::ReallocLogic g_defaultReallocLogic
void setArray_u8i(Type type, const OdUInt16 *pPtr, OdUInt32 size)
OD_FORCEINLINE void concatArray(const void *pPtr, OdUInt32 size, size_t ds, const ReallocLogic &racLg=g_defaultReallocLogic)
void setArray_dbl(Type type, const OdUInt8 *pPtr, OdUInt32 size)
void concatArray_u8i(const OdInt32 *pPtr, OdUInt32 size, const ReallocLogic &racLg=g_defaultReallocLogic)
void concatArray(const void *pPtr, OdUInt32 size, DataSize ds, const ReallocLogic &racLg=g_defaultReallocLogic)
bool asFloatsArray(OdFloatArray &result) const
void concatArray_flt(const OdUInt8 *pPtr, OdUInt32 size, const ReallocLogic &racLg=g_defaultReallocLogic)
void truncateArray(OdUInt32 size, DataSize ds)
void load(OdGsFiler *pFiler)
LwdType type() const
bool hasLineweight() const
static bool isPs(LwdType type)
union OdTrVisLwdSetting::@114 m_val
OdTrVisLwdSetting(OdInt32 pix, LwdType typ=kPixels)
OdDb::LineWeight lwLineWeight() const
bool operator==(const OdTrVisLwdSetting &sec) const
OdTrVisLwdSetting(OdDb::LineWeight lw, LwdType typ=kDatabase)
bool operator!=(const OdTrVisLwdSetting &sec) const
void setDLineWeight(double dVal, LwdType typ=kPlotStyle)
OdTrVisLwdSetting(double dVal, LwdType typ=kPlotStyle)
OdInt32 pixLineWeight() const
void setLwLineWeight(OdDb::LineWeight lw, LwdType typ=kDatabase)
void setType(LwdType typ)
void setPixLineWeight(OdInt32 pix, LwdType typ=kPixels)
bool isForcedLineweight() const
double dLineWeight() const
void setCurLjsStyle(OdPs::LineJoinStyle curLjsStyle)
OdTrVisLwdStyle(bool bByDefault, OdPs::LineEndStyle lesStyle, OdPs::LineJoinStyle ljsStyle)
bool curStyleDef() const
void setCurLesStyle(OdPs::LineEndStyle curLesStyle)
bool operator!=(const OdTrVisLwdStyle &sec) const
OdPs::LineEndStyle curLesStyle() const
void setCurStyleDef(bool bSet)
bool operator==(const OdTrVisLwdStyle &sec) const
bool curUsesDef() const
void setCurUsesDef(bool bSet)
OdPs::LineJoinStyle curLjsStyle() const
OdTrVisMarkBase(UInt64Type nMark, OdUInt32 uFrom)
OdTrVisMarkBase(UInt64Type nMark)
OdTrVisMarkBase(EnPosInit, OdUInt32 uFrom)