CFx SDK Documentation 2024 SP0
Loading...
Searching...
No Matches
GiProgressiveMesh.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#ifndef ODGI_PROGRESSIVEMESH_H_INCLUDED
24#define ODGI_PROGRESSIVEMESH_H_INCLUDED
25
26#include "OdStreamBuf.h"
27#include "OdVector.h"
28#include "Ge/GeExtents3d.h"
29#include "GiGeometry.h"
30class OdGiViewport;
32
37{
38public:
45 virtual bool registerDataBegin( OdUInt8 dataId, OdUInt64 localOffset ) = 0;
52 virtual bool registerDataEnd( OdUInt8 dataId, OdUInt64 localOffset ) = 0;
57 virtual OdUInt64 tell() = 0;
63 virtual bool beginExtraction( OdUInt8 dataId ) = 0;
69 virtual bool endExtraction( OdUInt8 dataId ) = 0;
75 virtual bool seekFromLocalOffset( OdUInt64 offset ) = 0;
81 virtual void extractBytes( void* buffer, OdUInt32 numBytes ) = 0;
87 virtual double extractDouble();
117 virtual bool extractBool();
118};
119
126{
131 {
133 kVertexDataNormals = 1,
135 kVertexDataColors = 1 << 1,
137 kVertexDataUVs = 1 << 2
138 };
145};
146
153{
158 {
160 kFaceDataMaterials = 1,
162 kFaceDataColors = 1 << 1,
164 kFaceDataNormals = 1 <<2
165 };
172};
173
180{
185 {
187 kEdgeDataVisibilities = 1
188 };
191};
192
199{
200public:
204 virtual OdInt64 dbStubToInt( OdDbStub* ) const = 0;
208 virtual OdDbStub* intToDbStub( OdInt64 ) const = 0;
209};
210
215{
216public:
226 virtual OdUInt32 selectLOD( const OdGiProgressiveMesh* pPM, const OdGiViewport* pView, const OdGeMatrix3d* pModelToWorldTransform ) const = 0;
227};
228
233{
234public:
239 {
240 m_nMinPixels = 10;
241 m_nMaxPixels = (OdUInt32)( 300.0 * sqrt( 3.0 ) );
242 }
251 OdUInt32 maxPixels() const { return m_nMaxPixels; }
256 void setMaxPixels( OdUInt32 nMax ) { m_nMaxPixels = nMax; }
261 OdUInt32 minPixels() const { return m_nMinPixels; }
266 void setMinPixels( OdUInt32 nMin ) { m_nMinPixels = nMin; }
267//DOM-IGNORE-BEGIN
268protected:
271//DOM-IGNORE-END
272};
273
280{
281public:
286 {
289 kVersionActual = kVersion2
290 };
295 {
296 kCustom = 0, //Custom LOD select by callback
297 kSqrInterpolation = 1, //Square interpolation LOD select
298 kSqrtInterpolation = 2 //Square root interpolation LOD select
299 };
308 virtual bool obtainShell( OdVector< OdGePoint3d >& pts, OdVector< OdInt32 >& faces ) const = 0;
336 virtual OdUInt32 numLODs() const = 0;
342 virtual OdUInt32 currentLOD() const = 0;
346 virtual bool setLOD( OdUInt32 ) = 0;
354 virtual OdUInt32 selectLOD( ProgressiveMeshAutoSelectLOD lod, const OdGiViewport* pView, const OdGeMatrix3d* pModelToWorldTransform = NULL ) = 0;
383 virtual OdUInt32 numFaces() const = 0;
387 virtual OdUInt32 numVertices() const = 0;
391 virtual const OdGeExtents3d& extents() const = 0;
398 virtual bool write( OdStreamBuf* pBuff, const OdGiProgressiveMeshObjectIdConverter* pConverter = NULL, ProgressiveMeshStreamVersion version = kVersionActual ) const = 0;
403 virtual bool isInPartialMode() const = 0;
407 virtual void endPartialMode() = 0;
412 virtual OdUInt64 getObjectSize() const = 0;
413};
414
416
426{
427public:
430
434 OdUInt32 minVertices() const { return m_minVertices; }
440 void setMinVertices( OdUInt32 n ) { m_minVertices = n; }
444 OdUInt32 minFaces() const { return m_minFaces; }
450 void setMinFaces( OdUInt32 n ) { m_minFaces = n; }
454 double worstDiherial() const { return m_worstDiherial; }
461 void setWorstDiherial( double d ) { m_worstDiherial = d; }
465 double smallestCost() const { return m_minCost; }
472 void setSmallestCost( double d ) { m_minCost = d; }
476 double worstCost() const { return m_worstCost; }
483 void setWorstCost( double d ) { m_worstCost = d; }
487 double infinity() const { return m_infinity; }
494 void setInfinity( double d ) { m_infinity = d; }
498 bool getFitNormals() const { return GETBIT( m_flags, kFlag_FitNormals ); }
502 double normalErrorFactor() const { return m_normalErrorFactor; }
510 void setFitNormals( bool bFit, double errorFactor )
511 {
512 SETBIT( m_flags, kFlag_FitNormals, bFit );
513 m_normalErrorFactor = errorFactor;
514 }
518 bool getFitColors() const { return GETBIT( m_flags, kFlag_FitColors ); }
522 double colorErrorFactor() const { return m_colorErrorFactor; }
530 void setFitColors( bool bFit, double errorFactor )
531 {
532 SETBIT( m_flags, kFlag_FitColors, bFit );
533 m_colorErrorFactor = errorFactor;
534 }
538 double sharpEdgesScaleFactor() const { return m_sharpEdgesScaleFactor; }
544 void setSharpEdgesScaleFactor( double d ) { m_sharpEdgesScaleFactor = d; }
545
549 double nextCostThresholdFactor() const { return m_nextCostThresholdFactor; }
557 void setNextCostThresholdFactor( double d ) { m_nextCostThresholdFactor = d; }
558
562 bool getDiffMaxPenalty() const { return GETBIT( m_flags, kFlag_DesH ); }
566 double diffMaxPenaltyFactor() const { return m_desdFactor; }
575 void setDiffMaxPenalty( bool bSet, double factor )
576 {
577 SETBIT( m_flags, kFlag_DesH, bSet );
578 m_desdFactor = factor;
579 }
583 bool getSumPenalty() const { return GETBIT( m_flags, kFlag_DesN ); }
587 double sumPenaltyFactor() const { return m_desnFactor; }
596 void setSumPenalty( bool bSet, double factor )
597 {
598 SETBIT( m_flags, kFlag_DesN, bSet );
599 m_desnFactor = factor;
600 }
604 OdUInt8 strictSharp() const { return m_strictSharp; }
605 //Unsupported for now
606 /*void setStrictSharp( OdUInt8 val )
607 {
608 ODA_ASSERT( val < 3 );
609 m_strictSharp = val;
610 }*/
614 OdUInt32 numFaceSamplePoints() const { return m_numFaceSamplePoints; }
620 void setNumFaceSamplePoints( OdUInt32 n ) { m_numFaceSamplePoints = n; }
621
622//DOM-IGNORE-BEGIN
623private:
624 enum OptionFlags
625 {
626 kFlag_FitNormals = 1,
627 kFlag_FitColors = 1 << 1,
628 kFlag_DesH = 1 << 2,
629 kFlag_DesN = 1 << 3
630 };
631 OdUInt8 m_flags;
632 OdUInt32 m_minVertices;
633 OdUInt32 m_minFaces;
634 double m_worstDiherial;
635 double m_worstCost;
636 double m_minCost;
637 double m_infinity;
638 double m_normalErrorFactor; //normal error (0..2) to dist/diam rms, need to constant in front of normal error term
639 double m_colorErrorFactor; //color rms (0..sqrt(3)) to dist/diam rms, need to constant in front of color error term
640 double m_sharpEdgesScaleFactor; //scale number of sharp edge samples
641 double m_nextCostThresholdFactor;
642 double m_desdFactor; //penalize diff max #desc to balance tree
643 double m_desnFactor; //penalize sum #desc to balance tree
644 OdUInt8 m_strictSharp; //disallow disc. curve topo type changes {0, 1, 2}
645 OdUInt32 m_numFaceSamplePoints; //number of face sample points, -1 means == face num
646//DOM-IGNORE-END
647};
648
666{
667public:
672 {
673 kStatus_Ok = 0, //Progressive mesh is OK
674 kStatus_DegenerateFacesIgnored = 1, //Some faces from input are skipped since they are degenerative
675 kStatus_NonManifoldFacesIgnored = 1 << 1, //Some faces from input are skipped since they cause non-manifold
676 kStatus_InvalidFacesIgnored = 1 << 2, //Some faces from input are skipped since they are invalid (not 3 or 4 points, contains points out of input points range, etc)
677 kStatus_ZeroNormalFacesIgnored = 1 << 3, //Some faces from input are skipped since they have zero normal
678 kStatus_NonTriangleFaceTriangulated = 1 << 4 //Some faces from input were not triangle and were triangulated
679 };
698 virtual OdUInt8 setupInitialShell( OdInt32 nPoints, const OdGePoint3d * points, OdInt32 faceListSize, const OdInt32 * faces ) = 0;
710 virtual OdGiProgressiveMeshPtr buildProgressiveMesh( const OdGiVertexData* pVertexData = NULL, const OdGiFaceData* pFaceData = NULL, const OdGiEdgeData* pEdgeData = NULL ) = 0;
732 const OdGiProgressiveMeshObjectIdConverter* pConverter = NULL,
746};
747
753{
754public:
765 virtual bool obtainShell( OdVector< OdGePoint3d >& pts, OdVector< OdInt32 >& faces ) const = 0;
801 virtual OdUInt32 numLODs() const = 0;
810 virtual OdUInt32 currentLOD() const = 0;
818 virtual bool setLOD( OdUInt32 ) = 0;
824 virtual OdUInt32 numFaces() const = 0;
830 virtual OdUInt32 numVertices() const = 0;
836 virtual const OdGeExtents3d& extents() const = 0;
869 virtual bool isProgressiveMeshGenerated() const = 0;
879 virtual void setupInitialShell( OdInt32 nPoints, const OdGePoint3d * points, OdInt32 faceListSize, const OdInt32 * faces ) = 0;
894 virtual bool buildProgressiveMesh( const OdGiVertexData* pVertexData = NULL, const OdGiFaceData* pFaceData = NULL, const OdGiEdgeData* pEdgeData = NULL ) = 0;
921 virtual bool readProgressiveMeshExFrom( OdStreamBuf* pBuff, const OdGiProgressiveMeshObjectIdConverter* pConverter = NULL,
936 virtual bool readPartialProgressiveMeshExFrom( OdStreamBuf* pBuff, OdGiDataExtractor* pDataExtractor, const OdGiProgressiveMeshObjectIdConverter* pConverter = NULL,
938
961 virtual void setGenerationAbortFlags( OdUInt8 flags ) = 0;
967 virtual OdUInt8 generationAbortFlags() const = 0;
984 virtual bool hasData() const = 0;
989 virtual OdUInt64 getObjectSize() const = 0;
990};
991
996
997#endif
998
999
#define ODGI_EXPORT
Definition: GiExport.h:35
OdSmartPtr< OdGiProgressiveMesh > OdGiProgressiveMeshPtr
OdSmartPtr< OdGiProgressiveMeshEx > OdGiProgressiveMeshExPtr
unsigned int OdUInt32
short OdInt16
int OdInt32
unsigned char OdUInt8
#define SETBIT(flags, bit, value)
Definition: OdaDefs.h:516
#define GETBIT(flags, bit)
Definition: OdaDefs.h:517
virtual bool extractBool()
virtual OdInt32 extractInt64()
virtual bool seekFromLocalOffset(OdUInt64 offset)=0
virtual void extractBytes(void *buffer, OdUInt32 numBytes)=0
virtual OdInt32 extractInt32()
virtual OdInt16 extractInt16()
virtual bool registerDataBegin(OdUInt8 dataId, OdUInt64 localOffset)=0
virtual OdUInt8 extractByte()
virtual bool beginExtraction(OdUInt8 dataId)=0
virtual bool endExtraction(OdUInt8 dataId)=0
virtual OdUInt64 tell()=0
virtual double extractDouble()
virtual bool registerDataEnd(OdUInt8 dataId, OdUInt64 localOffset)=0
virtual OdUInt32 selectLOD(const OdGiProgressiveMesh *pPM, const OdGiViewport *pView, const OdGeMatrix3d *pModelToWorldTransform) const =0
virtual bool isProgressiveMeshGenerated() const =0
virtual void setOptions(const OdGiProgressiveMeshGeneratorOptions &)=0
virtual const OdGiProgressiveMeshGeneratorOptions & options() const =0
virtual OdUInt64 getObjectSize() const =0
virtual OdUInt32 obtainEdgeData(OdGiProgressiveMeshEdgeData &data, OdUInt32 flags) const =0
virtual void setGenerationAbortFlags(OdUInt8 flags)=0
virtual bool readProgressiveMeshExFrom(OdStreamBuf *pBuff, const OdGiProgressiveMeshObjectIdConverter *pConverter=NULL, OdGiProgressiveMesh::ProgressiveMeshStreamVersion version=OdGiProgressiveMesh::kVersionActual)=0
virtual bool buildProgressiveMesh(const OdGiVertexData *pVertexData=NULL, const OdGiFaceData *pFaceData=NULL, const OdGiEdgeData *pEdgeData=NULL)=0
virtual OdUInt8 generationAbortFlags() const =0
virtual OdUInt32 numLODs() const =0
virtual OdUInt32 currentLOD() const =0
virtual OdUInt32 numFaces() const =0
virtual OdUInt32 obtainFaceData(OdGiProgressiveMeshFaceData &data, OdUInt32 flags) const =0
virtual bool setLOD(OdUInt32)=0
virtual void setupInitialShell(OdInt32 nPoints, const OdGePoint3d *points, OdInt32 faceListSize, const OdInt32 *faces)=0
virtual OdGiProgressiveMeshPtr progressiveMesh() const =0
virtual void setProgressiveMesh(OdGiProgressiveMeshPtr pMesh)=0
virtual const OdGeExtents3d & extents() const =0
virtual bool obtainShell(OdVector< OdGePoint3d > &pts, OdVector< OdInt32 > &faces) const =0
ODRX_DECLARE_MEMBERS(OdGiProgressiveMeshEx)
virtual bool readPartialProgressiveMeshExFrom(OdStreamBuf *pBuff, OdGiDataExtractor *pDataExtractor, const OdGiProgressiveMeshObjectIdConverter *pConverter=NULL, OdGiProgressiveMesh::ProgressiveMeshStreamVersion version=OdGiProgressiveMesh::kVersionActual)=0
virtual OdGiProgressiveMeshGeneratorOptions & options()=0
virtual bool write(OdStreamBuf *pBuff, const OdGiProgressiveMeshObjectIdConverter *pConverter=NULL, OdGiProgressiveMesh::ProgressiveMeshStreamVersion version=OdGiProgressiveMesh::kVersionActual) const =0
virtual OdUInt32 obtainVertexData(OdGiProgressiveMeshVertexData &data, OdUInt32 flags) const =0
virtual OdUInt32 numVertices() const =0
virtual bool hasData() const =0
virtual const OdGiProgressiveMeshGeneratorOptions & options() const =0
virtual OdUInt8 setupInitialShell(OdInt32 nPoints, const OdGePoint3d *points, OdInt32 faceListSize, const OdInt32 *faces)=0
virtual OdGiProgressiveMeshPtr createPartialProgressiveMeshFrom(OdStreamBuf *pBuff, OdGiDataExtractor *pDataExtractor, const OdGiProgressiveMeshObjectIdConverter *pConverter=NULL, OdGiProgressiveMesh::ProgressiveMeshStreamVersion version=OdGiProgressiveMesh::kVersionActual) const =0
virtual OdGiProgressiveMeshGeneratorOptions & options()=0
static OdGiProgressiveMeshGenerator * createObject()
virtual OdGiProgressiveMeshPtr createProgressiveMeshFrom(OdStreamBuf *pBuff, const OdGiProgressiveMeshObjectIdConverter *pConverter=NULL, OdGiProgressiveMesh::ProgressiveMeshStreamVersion version=OdGiProgressiveMesh::kVersionActual) const =0
virtual OdGiProgressiveMeshPtr buildProgressiveMesh(const OdGiVertexData *pVertexData=NULL, const OdGiFaceData *pFaceData=NULL, const OdGiEdgeData *pEdgeData=NULL)=0
virtual void setOptions(const OdGiProgressiveMeshGeneratorOptions &)=0
void setSumPenalty(bool bSet, double factor)
void setFitNormals(bool bFit, double errorFactor)
void setDiffMaxPenalty(bool bSet, double factor)
void setFitColors(bool bFit, double errorFactor)
virtual OdGiProgressiveMeshAutoLODSelectOptions & autoSelectLODOptions()=0
virtual OdUInt32 obtainVertexData(OdGiProgressiveMeshVertexData &data, OdUInt32 flags) const =0
virtual bool isInPartialMode() const =0
virtual OdUInt32 currentLOD() const =0
virtual void endPartialMode()=0
ODRX_DECLARE_MEMBERS(OdGiProgressiveMesh)
virtual OdUInt32 numVertices() const =0
virtual OdGiProgressiveMeshAutoLODSelectCallback * getCustomLODAutoSelectCallback() const =0
virtual bool write(OdStreamBuf *pBuff, const OdGiProgressiveMeshObjectIdConverter *pConverter=NULL, ProgressiveMeshStreamVersion version=kVersionActual) const =0
virtual void setCustomLODAutoSelectCallback(OdGiProgressiveMeshAutoLODSelectCallback *pCallback)=0
virtual void setAutoSelectLODOptions(const OdGiProgressiveMeshAutoLODSelectOptions &options)=0
virtual bool setLOD(OdUInt32)=0
virtual OdUInt32 obtainFaceData(OdGiProgressiveMeshFaceData &data, OdUInt32 flags) const =0
virtual const OdGiProgressiveMeshAutoLODSelectOptions & autoSelectLODOptions() const =0
virtual OdUInt32 numFaces() const =0
virtual OdUInt64 getObjectSize() const =0
virtual OdUInt32 selectLOD(ProgressiveMeshAutoSelectLOD lod, const OdGiViewport *pView, const OdGeMatrix3d *pModelToWorldTransform=NULL)=0
virtual OdUInt32 obtainEdgeData(OdGiProgressiveMeshEdgeData &data, OdUInt32 flags) const =0
virtual bool obtainShell(OdVector< OdGePoint3d > &pts, OdVector< OdInt32 > &faces) const =0
virtual const OdGeExtents3d & extents() const =0
virtual OdUInt32 numLODs() const =0
virtual OdInt64 dbStubToInt(OdDbStub *) const =0
virtual OdDbStub * intToDbStub(OdInt64) const =0
Definition: Int64.h:43
GLuint buffer
Definition: gles2_ext.h:178
GLint GLenum GLsizei GLsizei GLint GLsizei const void * data
Definition: gles2_ext.h:110
GLintptr offset
Definition: gles2_ext.h:183
OdVector< OdUInt8 > visibilities
OdVector< OdGeVector3d > normals
OdVector< OdCmEntityColor > colors
OdVector< OdDbStub * > materials
OdVector< OdGePoint3d > UV
OdVector< OdCmEntityColor > colors
OdVector< OdGeVector3d > normals