Skip to content

Commit ad99e8e

Browse files
NC-7840: Expose tilestyle-values of textures
Add API functions - lib3mf_texture2d_settilestyleuv - lib3mf_texture2d_gettilestyleuv Refactor reading/writing of tilestyles Update Tests, SDK documentation and SDK-examples
1 parent 9877237 commit ad99e8e

19 files changed

+270
-71
lines changed

CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ project (lib3MF)
88

99
# Define Version
1010
set(LIB3MF_VERSION_MAJOR 1) # increase on every backward-compatibility breaking change of the API
11-
set(LIB3MF_VERSION_MINOR 1) # increase on every backward compatible change of the API
12-
set(LIB3MF_VERSION_MICRO 5) # increase on on every change that does not alter the API
11+
set(LIB3MF_VERSION_MINOR 2) # increase on every backward compatible change of the API
12+
set(LIB3MF_VERSION_MICRO 0) # increase on on every change that does not alter the API
1313

1414
set(CMAKE_INSTALL_BINDIR bin CACHE PATH "directory for installing binary files")
1515
set(CMAKE_INSTALL_LIBDIR lib CACHE PATH "directory for installing library files")

Include/Common/NMR_ErrorConst.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1013,6 +1013,9 @@ Model error codes (0x8XXX)
10131013
// Slice contains only one point within a polygon
10141014
#define NMR_ERROR_SLICE_ONEPOINT 0x80C3
10151015

1016+
// Invalid Tile Style
1017+
#define NMR_ERROR_INVALIDTILESTYLE 0x80C4
1018+
10161019
/*-------------------------------------------------------------------
10171020
XML Parser Error Constants (0x9XXX)
10181021
-------------------------------------------------------------------*/

Include/Model/COM/NMR_COMInterface_ModelTexture2D.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ namespace NMR {
6767
LIB3MFMETHOD(SetPathUTF8) (_In_z_ LPCSTR pszPath);
6868
LIB3MFMETHOD(GetContentType) (_Out_ eModelTexture2DType * peContentType);
6969
LIB3MFMETHOD(SetContentType) (_In_ eModelTexture2DType eContentType);
70+
LIB3MFMETHOD(GetTileStyleUV) (_Out_ eModelTextureTileStyle * peTileStyleU, _Out_ eModelTextureTileStyle * peTileStyleV);
71+
LIB3MFMETHOD(SetTileStyleUV) (_In_ eModelTextureTileStyle eTileStyleU, _In_ eModelTextureTileStyle eTileStyleV);
7072
LIB3MFMETHOD(GetBox2D) (_Out_ FLOAT * pfU, _Out_ FLOAT * pfV, _Out_ FLOAT * pfWidth, _Out_ FLOAT * pfHeight);
7173
LIB3MFMETHOD(SetBox2D) (_In_ FLOAT fU, _In_ FLOAT fV, _In_ FLOAT fWidth, _In_ FLOAT fHeight);
7274
LIB3MFMETHOD(ClearBox2D) ();

Include/Model/COM/NMR_COMInterfaces.h

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1285,6 +1285,24 @@ namespace NMR {
12851285
*/
12861286
LIB3MFMETHOD(SetContentType) (_In_ eModelTexture2DType eContentType) LIB3MFABSTRACT;
12871287

1288+
/**
1289+
* Retrieves a texture's tilestyle type
1290+
*
1291+
* @param[out] peTileStyleU returns tilestyle type enum
1292+
* @param[out] peTileStyleV returns tilestyle type enum
1293+
* @return error code or 0 (success)
1294+
*/
1295+
LIB3MFMETHOD(GetTileStyleUV) (_Out_ eModelTextureTileStyle * peTileStyleU, _Out_ eModelTextureTileStyle * peTileStyleV) LIB3MFABSTRACT;
1296+
1297+
/**
1298+
* Sets a texture's tilestyle type
1299+
*
1300+
* @param[out] eTileStyleU new tilestyle type enum
1301+
* @param[out] eTileStyleV new tilestyle type enum
1302+
* @return error code or 0 (success)
1303+
*/
1304+
LIB3MFMETHOD(SetTileStyleUV) (_In_ eModelTextureTileStyle eTileStyleU, _In_ eModelTextureTileStyle eTileStyleV) LIB3MFABSTRACT;
1305+
12881306
/**
12891307
* Retrieves a texture's box2D coordinates.
12901308
*

Include/Model/COM/NMR_DLLInterfaces.h

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1350,6 +1350,26 @@ namespace NMR {
13501350
*/
13511351
LIB3MF_DECLSPEC LIB3MFRESULT lib3mf_texture2d_setcontenttype(_In_ PLib3MFModelTexture2D * pTexture2D, _In_ eModelTexture2DType eContentType);
13521352

1353+
/**
1354+
* Retrieves a texture's tilestyle type
1355+
*
1356+
* @param[in] pTexture2D Texture2D Resource Instance
1357+
* @param[out] peTileStyleU returns tilestyle type enum
1358+
* @param[out] peTileStyleV returns tilestyle type enum
1359+
* @return error code or 0 (success)
1360+
*/
1361+
LIB3MF_DECLSPEC LIB3MFRESULT lib3mf_texture2d_gettilestyleuv(_In_ PLib3MFModelTexture2D * pTexture2D, _Out_ eModelTextureTileStyle * peTileStyleU, _Out_ eModelTextureTileStyle * peTileStyleV);
1362+
1363+
/**
1364+
* Sets a texture's tilestyle type
1365+
*
1366+
* @param[in] pTexture2D Texture2D Resource Instance
1367+
* @param[out] eTileStyleU new tilestyle type enum
1368+
* @param[out] eTileStyleV new tilestyle type enum
1369+
* @return error code or 0 (success)
1370+
*/
1371+
LIB3MF_DECLSPEC LIB3MFRESULT lib3mf_texture2d_settilestyleuv(_In_ PLib3MFModelTexture2D * pTexture2D, _In_ eModelTextureTileStyle eTileStyleU, _In_ eModelTextureTileStyle eTileStyleV);
1372+
13531373
/**
13541374
* Retrieves a texture's box2D coordinates.
13551375
*

Include/Model/Classes/NMR_ModelConstants.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,9 @@ These are given by the 3MF Standard
183183
#define XML_3MF_ATTRIBUTE_TEXTURE2D_BOX L"box"
184184
#define XML_3MF_ATTRIBUTE_TEXTURE2D_TILESTYLEU L"tilestyleu"
185185
#define XML_3MF_ATTRIBUTE_TEXTURE2D_TILESTYLEV L"tilestylev"
186+
#define XML_3MF_ATTRIBUTE_TEXTURE2D_TILESTYLE_WRAP L"wrap"
187+
#define XML_3MF_ATTRIBUTE_TEXTURE2D_TILESTYLE_MIRROR L"mirror"
188+
#define XML_3MF_ATTRIBUTE_TEXTURE2D_TILESTYLE_CLAMP L"clamp"
186189

187190
// Compositematerials and composite element (not implemented!)
188191
#define XML_3MF_ELEMENT_COMPOSITEMATERIALS L"compositematerials"

Include/Model/Classes/NMR_ModelTexture2D.h

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ namespace NMR {
6060
nfFloat m_fBox2D_V;
6161
nfFloat m_fBox2D_Width;
6262
nfFloat m_fBox2D_Height;
63-
std::wstring m_sTileStyleU;
64-
std::wstring m_sTileStyleV;
63+
eModelTextureTileStyle m_eTileStyleU;
64+
eModelTextureTileStyle m_eTileStyleV;
6565
public:
6666
CModelTexture2DResource() = delete;
6767
CModelTexture2DResource(_In_ const ModelResourceID sID, _In_ CModel * pModel);
@@ -78,6 +78,8 @@ namespace NMR {
7878
void setContentType(_In_ eModelTexture2DType ContentType);
7979
std::wstring getContentTypeString();
8080
void setContentTypeString(_In_ std::wstring sValue, _In_ nfBool bFailIfUnknown);
81+
void setTileStyleUString(_In_ std::wstring sValue);
82+
void setTileStyleVString(_In_ std::wstring sValue);
8183

8284
// getters/setters Box2D
8385
nfBool getBox2D (_Out_ nfFloat & fU, _Out_ nfFloat & fV, _Out_ nfFloat & fWidth, _Out_ nfFloat & fHeight);
@@ -86,14 +88,16 @@ namespace NMR {
8688
nfBool hasBox2D();
8789

8890
// getters/setters TileStyle
89-
std::wstring getTileStyleU();
90-
std::wstring getTileStyleV();
91-
void setTileStyleU(_In_ std::wstring sValue);
92-
void setTileStyleV(_In_ std::wstring sValue);
91+
eModelTextureTileStyle getTileStyleU();
92+
eModelTextureTileStyle getTileStyleV();
93+
void setTileStyleU(_In_ eModelTextureTileStyle sStyle);
94+
void setTileStyleV(_In_ eModelTextureTileStyle sStyle);
9395

9496
// copy all parameters from source
9597
void copyFrom(_In_ CModelTexture2DResource * pSourceTexture);
9698

99+
static eModelTextureTileStyle tileStyleFromString(_In_ std::wstring sValue);
100+
static std::wstring tileStyleToString(_In_ eModelTextureTileStyle eTileStyle);
97101
};
98102

99103
typedef std::shared_ptr <CModelTexture2DResource> PModelTexture2DResource;

Include/Model/Classes/NMR_ModelTypes.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,12 @@ namespace NMR {
146146
MODELTEXTURETYPE_JPEG = 2,
147147
};
148148

149+
enum eModelTextureTileStyle {
150+
MODELTEXTURETILESTYLE_WRAP = 0,
151+
MODELTEXTURETILESTYLE_MIRROR = 1,
152+
MODELTEXTURETILESTYLE_CLAMP = 2
153+
};
154+
149155
typedef struct {
150156
FLOAT m_fPosition[2];
151157
} MODELSLICEVERTEX;

Lib3MF-1.docx

4.69 KB
Binary file not shown.

Lib3MF-1.pdf

505 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)