Merge pull request #3494 from assimp/issue_3198

closes https://github.com/assimp/assimp/issues/3198: make aiMaterial:…
pull/3492/head^2
Kim Kulling 2020-11-10 13:21:16 +01:00 committed by GitHub
commit 5da3e633e3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 440 additions and 479 deletions

View File

@ -402,7 +402,7 @@ aiMaterial::~aiMaterial() {
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
aiString aiMaterial::GetName() { aiString aiMaterial::GetName() const {
aiString name; aiString name;
Get(AI_MATKEY_NAME, name); Get(AI_MATKEY_NAME, name);

View File

@ -5,8 +5,6 @@ Open Asset Import Library (assimp)
Copyright (c) 2006-2020, assimp team Copyright (c) 2006-2020, assimp team
All rights reserved. All rights reserved.
Redistribution and use of this software in source and binary forms, Redistribution and use of this software in source and binary forms,
@ -80,8 +78,7 @@ extern "C" {
* @endcode * @endcode
* where 'diffContrib' is the intensity of the incoming light for that pixel. * where 'diffContrib' is the intensity of the incoming light for that pixel.
*/ */
enum aiTextureOp enum aiTextureOp {
{
/** T = T1 * T2 */ /** T = T1 * T2 */
aiTextureOp_Multiply = 0x0, aiTextureOp_Multiply = 0x0,
@ -100,7 +97,6 @@ enum aiTextureOp
/** T = T1 + (T2-0.5) */ /** T = T1 + (T2-0.5) */
aiTextureOp_SignedAdd = 0x5, aiTextureOp_SignedAdd = 0x5,
#ifndef SWIG #ifndef SWIG
_aiTextureOp_Force32Bit = INT_MAX _aiTextureOp_Force32Bit = INT_MAX
#endif #endif
@ -111,8 +107,7 @@ enum aiTextureOp
* *
* Commonly referred to as 'wrapping mode'. * Commonly referred to as 'wrapping mode'.
*/ */
enum aiTextureMapMode enum aiTextureMapMode {
{
/** A texture coordinate u|v is translated to u%1|v%1 /** A texture coordinate u|v is translated to u%1|v%1
*/ */
aiTextureMapMode_Wrap = 0x0, aiTextureMapMode_Wrap = 0x0,
@ -146,8 +141,7 @@ enum aiTextureMapMode
* how the mapping should look like (e.g spherical) is given. * how the mapping should look like (e.g spherical) is given.
* See the #AI_MATKEY_MAPPING property for more details. * See the #AI_MATKEY_MAPPING property for more details.
*/ */
enum aiTextureMapping enum aiTextureMapping {
{
/** The mapping coordinates are taken from an UV channel. /** The mapping coordinates are taken from an UV channel.
* *
* The #AI_MATKEY_UVWSRC key specifies from which UV channel * The #AI_MATKEY_UVWSRC key specifies from which UV channel
@ -171,7 +165,6 @@ enum aiTextureMapping
/** Undefined mapping. Have fun. */ /** Undefined mapping. Have fun. */
aiTextureMapping_OTHER = 0x5, aiTextureMapping_OTHER = 0x5,
#ifndef SWIG #ifndef SWIG
_aiTextureMapping_Force32Bit = INT_MAX _aiTextureMapping_Force32Bit = INT_MAX
#endif #endif
@ -192,8 +185,7 @@ enum aiTextureMapping
* and the artists working on models have to conform to this specification, * and the artists working on models have to conform to this specification,
* regardless which 3D tool they're using. * regardless which 3D tool they're using.
*/ */
enum aiTextureType enum aiTextureType {
{
/** Dummy value. /** Dummy value.
* *
* No texture, but the value to be used as 'texture semantic' * No texture, but the value to be used as 'texture semantic'
@ -304,7 +296,6 @@ enum aiTextureType
*/ */
aiTextureType_UNKNOWN = 18, aiTextureType_UNKNOWN = 18,
#ifndef SWIG #ifndef SWIG
_aiTextureType_Force32Bit = INT_MAX _aiTextureType_Force32Bit = INT_MAX
#endif #endif
@ -326,10 +317,9 @@ ASSIMP_API const char* TextureTypeToString(enum aiTextureType in);
* undefined). <br> * undefined). <br>
* Again, this value is just a hint. Assimp tries to select the shader whose * Again, this value is just a hint. Assimp tries to select the shader whose
* most common implementation matches the original rendering results of the * most common implementation matches the original rendering results of the
* 3D modeller which wrote a particular model as closely as possible. * 3D modeler which wrote a particular model as closely as possible.
*/ */
enum aiShadingMode enum aiShadingMode {
{
/** Flat shading. Shading is done on per-face base, /** Flat shading. Shading is done on per-face base,
* diffuse only. Also known as 'faceted shading'. * diffuse only. Also known as 'faceted shading'.
*/ */
@ -381,13 +371,11 @@ enum aiShadingMode
*/ */
aiShadingMode_Fresnel = 0xa, aiShadingMode_Fresnel = 0xa,
#ifndef SWIG #ifndef SWIG
_aiShadingMode_Force32Bit = INT_MAX _aiShadingMode_Force32Bit = INT_MAX
#endif #endif
}; };
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
/** @brief Defines some mixed flags for a particular texture. /** @brief Defines some mixed flags for a particular texture.
* *
@ -399,8 +387,7 @@ enum aiShadingMode
* *
* This corresponds to the #AI_MATKEY_TEXFLAGS property. * This corresponds to the #AI_MATKEY_TEXFLAGS property.
*/ */
enum aiTextureFlags enum aiTextureFlags {
{
/** The texture's color values have to be inverted (component-wise 1-n) /** The texture's color values have to be inverted (component-wise 1-n)
*/ */
aiTextureFlags_Invert = 0x1, aiTextureFlags_Invert = 0x1,
@ -428,7 +415,6 @@ enum aiTextureFlags
#endif #endif
}; };
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
/** @brief Defines alpha-blend flags. /** @brief Defines alpha-blend flags.
* *
@ -440,13 +426,12 @@ enum aiTextureFlags
* @code * @code
* SourceColor * SourceBlend + DestColor * DestBlend * SourceColor * SourceBlend + DestColor * DestBlend
* @endcode * @endcode
* where DestColor is the previous color in the framebuffer at this * where DestColor is the previous color in the frame-buffer at this
* position and SourceColor is the material color before the transparency * position and SourceColor is the material color before the transparency
* calculation.<br> * calculation.<br>
* This corresponds to the #AI_MATKEY_BLEND_FUNC property. * This corresponds to the #AI_MATKEY_BLEND_FUNC property.
*/ */
enum aiBlendMode enum aiBlendMode {
{
/** /**
* Formula: * Formula:
* @code * @code
@ -472,7 +457,6 @@ enum aiBlendMode
#endif #endif
}; };
#include "./Compiler/pushpack1.h" #include "./Compiler/pushpack1.h"
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
@ -485,8 +469,7 @@ enum aiBlendMode
* we keep separate scaling/translation/rotation values to make it * we keep separate scaling/translation/rotation values to make it
* easier to process and optimize UV transformations internally. * easier to process and optimize UV transformations internally.
*/ */
struct aiUVTransform struct aiUVTransform {
{
/** Translation on the u and v axes. /** Translation on the u and v axes.
* *
* The default value is (0|0). * The default value is (0|0).
@ -507,17 +490,14 @@ struct aiUVTransform
*/ */
ai_real mRotation; ai_real mRotation;
#ifdef __cplusplus #ifdef __cplusplus
aiUVTransform() AI_NO_EXCEPT aiUVTransform() AI_NO_EXCEPT
: mTranslation (0.0,0.0) : mTranslation(0.0, 0.0),
, mScaling (1.0,1.0) mScaling(1.0, 1.0),
, mRotation (0.0) mRotation(0.0) {
{
// nothing to be done here ... // nothing to be done here ...
} }
#endif #endif
}; };
#include "./Compiler/poppack1.h" #include "./Compiler/poppack1.h"
@ -527,8 +507,7 @@ struct aiUVTransform
/** @brief A very primitive RTTI system for the contents of material /** @brief A very primitive RTTI system for the contents of material
* properties. * properties.
*/ */
enum aiPropertyTypeInfo enum aiPropertyTypeInfo {
{
/** Array of single-precision (32 Bit) floats /** Array of single-precision (32 Bit) floats
* *
* It is possible to use aiGetMaterialInteger[Array]() (or the C++-API * It is possible to use aiGetMaterialInteger[Array]() (or the C++-API
@ -560,12 +539,10 @@ enum aiPropertyTypeInfo
*/ */
aiPTI_Integer = 0x4, aiPTI_Integer = 0x4,
/** Simple binary buffer, content undefined. Not convertible to anything. /** Simple binary buffer, content undefined. Not convertible to anything.
*/ */
aiPTI_Buffer = 0x5, aiPTI_Buffer = 0x5,
/** This value is not used. It is just there to force the /** This value is not used. It is just there to force the
* compiler to map this enum to a 32 Bit integer. * compiler to map this enum to a 32 Bit integer.
*/ */
@ -594,8 +571,7 @@ enum aiPropertyTypeInfo
* @endcode * @endcode
* @see aiMaterial * @see aiMaterial
*/ */
struct aiMaterialProperty struct aiMaterialProperty {
{
/** Specifies the name of the property (key) /** Specifies the name of the property (key)
* Keys are generally case insensitive. * Keys are generally case insensitive.
*/ */
@ -634,11 +610,11 @@ struct aiMaterialProperty
#ifdef __cplusplus #ifdef __cplusplus
aiMaterialProperty() AI_NO_EXCEPT aiMaterialProperty() AI_NO_EXCEPT
: mSemantic( 0 ) : mSemantic(0),
, mIndex( 0 ) mIndex(0),
, mDataLength( 0 ) mDataLength(0),
, mType( aiPTI_Float ) mType(aiPTI_Float),
, mData(nullptr) { mData(nullptr) {
// empty // empty
} }
@ -674,7 +650,6 @@ struct aiMaterial
#ifdef __cplusplus #ifdef __cplusplus
public: public:
aiMaterial(); aiMaterial();
~aiMaterial(); ~aiMaterial();
@ -684,7 +659,7 @@ public:
* @return The name of the material. * @return The name of the material.
*/ */
// ------------------------------------------------------------------- // -------------------------------------------------------------------
aiString GetName(); aiString GetName() const;
// ------------------------------------------------------------------- // -------------------------------------------------------------------
/** @brief Retrieve an array of Type values with a specific key /** @brief Retrieve an array of Type values with a specific key
@ -722,7 +697,6 @@ public:
aiReturn Get(const char *pKey, unsigned int type, aiReturn Get(const char *pKey, unsigned int type,
unsigned int idx, Type &pOut) const; unsigned int idx, Type &pOut) const;
aiReturn Get(const char *pKey, unsigned int type, aiReturn Get(const char *pKey, unsigned int type,
unsigned int idx, int &pOut) const; unsigned int idx, int &pOut) const;
@ -788,10 +762,8 @@ public:
aiTextureOp *op = NULL, aiTextureOp *op = NULL,
aiTextureMapMode *mapmode = NULL) const; aiTextureMapMode *mapmode = NULL) const;
// Setters // Setters
// ------------------------------------------------------------------------------ // ------------------------------------------------------------------------------
/** @brief Add a property with a given key and type info to the material /** @brief Add a property with a given key and type info to the material
* structure * structure
@ -903,7 +875,6 @@ public:
static void CopyPropertyList(aiMaterial *pcDest, static void CopyPropertyList(aiMaterial *pcDest,
const aiMaterial *pcSrc); const aiMaterial *pcSrc);
#endif #endif
/** List of all material properties loaded. */ /** List of all material properties loaded. */
@ -1414,7 +1385,6 @@ ASSIMP_API C_ENUM aiReturn aiGetMaterialFloatArray(
ai_real *pOut, ai_real *pOut,
unsigned int *pMax); unsigned int *pMax);
#ifdef __cplusplus #ifdef __cplusplus
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
@ -1440,8 +1410,7 @@ inline aiReturn aiGetMaterialFloat(const aiMaterial* pMat,
const char *pKey, const char *pKey,
unsigned int type, unsigned int type,
unsigned int index, unsigned int index,
ai_real* pOut) ai_real *pOut) {
{
return aiGetMaterialFloatArray(pMat, pKey, type, index, pOut, (unsigned int *)0x0); return aiGetMaterialFloatArray(pMat, pKey, type, index, pOut, (unsigned int *)0x0);
} }
@ -1453,7 +1422,6 @@ inline aiReturn aiGetMaterialFloat(const aiMaterial* pMat,
#endif //!__cplusplus #endif //!__cplusplus
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
/** @brief Retrieve an array of integer values with a specific key /** @brief Retrieve an array of integer values with a specific key
* from a material * from a material
@ -1466,7 +1434,6 @@ ASSIMP_API C_ENUM aiReturn aiGetMaterialIntegerArray(const C_STRUCT aiMaterial*
int *pOut, int *pOut,
unsigned int *pMax); unsigned int *pMax);
#ifdef __cplusplus #ifdef __cplusplus
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
@ -1478,8 +1445,7 @@ inline aiReturn aiGetMaterialInteger(const C_STRUCT aiMaterial* pMat,
const char *pKey, const char *pKey,
unsigned int type, unsigned int type,
unsigned int index, unsigned int index,
int* pOut) int *pOut) {
{
return aiGetMaterialIntegerArray(pMat, pKey, type, index, pOut, (unsigned int *)0x0); return aiGetMaterialIntegerArray(pMat, pKey, type, index, pOut, (unsigned int *)0x0);
} }
@ -1502,7 +1468,6 @@ ASSIMP_API C_ENUM aiReturn aiGetMaterialColor(const C_STRUCT aiMaterial* pMat,
unsigned int index, unsigned int index,
C_STRUCT aiColor4D *pOut); C_STRUCT aiColor4D *pOut);
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
/** @brief Retrieve a aiUVTransform value from the material property table /** @brief Retrieve a aiUVTransform value from the material property table
* *
@ -1514,7 +1479,6 @@ ASSIMP_API C_ENUM aiReturn aiGetMaterialUVTransform(const C_STRUCT aiMaterial* p
unsigned int index, unsigned int index,
C_STRUCT aiUVTransform *pOut); C_STRUCT aiUVTransform *pOut);
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
/** @brief Retrieve a string from the material property table /** @brief Retrieve a string from the material property table
* *
@ -1597,7 +1561,6 @@ C_ENUM aiReturn aiGetMaterialTexture(const C_STRUCT aiMaterial* mat,
unsigned int *flags /*= NULL*/); unsigned int *flags /*= NULL*/);
#endif // !#ifdef __cplusplus #endif // !#ifdef __cplusplus
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -5,8 +5,6 @@ Open Asset Import Library (assimp)
Copyright (c) 2006-2020, assimp team Copyright (c) 2006-2020, assimp team
All rights reserved. All rights reserved.
Redistribution and use of this software in source and binary forms, Redistribution and use of this software in source and binary forms,