/////////////////////////////////////////////////////////////////////////////// // Copyright (C) 2002-2025, Open Design Alliance (the "Alliance"). // All rights reserved. // // This software and its documentation and related materials are owned by // the Alliance. The software may only be incorporated into application // programs owned by members of the Alliance, subject to a signed // Membership Agreement and Supplemental Software License Agreement with the // Alliance. The structure and organization of this software are the valuable // trade secrets of the Alliance and its suppliers. The software is also // protected by copyright law and international treaty provisions. Application // programs incorporating this software must include the following statement // with their copyright notices: // // This application incorporates Open Design Alliance software pursuant to a license // agreement with Open Design Alliance. // Open Design Alliance Copyright (C) 2002-2025 by Open Design Alliance. // All rights reserved. // // By use of this software, its documentation or related materials, you // acknowledge and accept the above terms. /////////////////////////////////////////////////////////////////////////////// #ifndef __TNW_TEXTURE_H__ #define __TNW_TEXTURE_H__ #include "NwMaterial.h" #include "NwTextureValueType.h" #include "Materials/NwTextureMapperType.h" #include "NwModelUnits.h" class OdGiRasterImage; class OdGeMatrix3d; class OdNwGraphicJsonBundle; class OdNwTextureMapper; /** \details This template class is a specialization of the OdSmartPtr class for OdGiRasterImage object pointers. */ typedef OdSmartPtr OdGiRasterImagePtr; /** \details This template class is a specialization of the OdSmartPtr class for OdNwGraphicJsonBundle object pointers. */ typedef OdSmartPtr OdNwGraphicJsonBundlePtr; /** \details This class represents a geometry texture within the model hierarchy. */ class NWDBEXPORT OdNwTexture : public OdNwMaterial { //DOM-IGNORE-BEGIN ODRX_DECLARE_MEMBERS(OdNwTexture); //DOM-IGNORE-END public: /** \details Default constructor. Creates a new object of the OdNwTexture class. */ OdNwTexture(); /** \details Constructor. Creates a new OdNwTexture object for the specified item. \param pImpl [in] Item to create an OdNwMaterial object for. */ explicit OdNwTexture(OdNwObjectImpl* pImpl); public: /** \details Virtual destructor. Frees allocated resources. */ virtual ~OdNwTexture(); public: /** \details Gets the category of a texture JSON bundle. \returns An OdString containing the category of the texture bundle. */ OdString getCategory() const; /** \details Gets a string parameter value depending on the value of the mask. \param type [in] Parameter type specified by NwTextureValueType::Enum. \param pResult [out] Pointer to the OdResult object with an error code. \returns An OdString value depending on the type. \remarks The type must match an NwTextureValueType::Enum value for OdString values, otherwise pResult is set to eNotApplicable. The method is deprecated since version 25.10 and will be removed soon. Instead, use the OdResult getMapper(NwTextureMapperType::Enum mapperType, OdNwTextureMapper& txtMapper) method with the OdString OdNwTextureMapper::getPath(OdResult* pRes) const method. To get a resolved texture path, use the OdString OdNwHostAppServices::findFile(const OdString& filename, OdDbBaseDatabase* pBaseDb, FindFileHint hint) method. */ OdString getStringValue(NwTextureValueType::Enum type, OdResult* pResult = NULL) const; /** \details Gets a double parameter value depending on the value of the mask. \param type [in] Parameter type specified by NwTextureValueType::Enum. \param pResult [out] Pointer to the OdResult object with the error code. \returns A double value depending on the type. \remarks The type must match an NwTextureValueType::Enum value for double values, otherwise pResult is set to eNotApplicable. The method is deprecated since version 25.10 and will be removed soon. Instead, use the OdResult getMapper(NwTextureMapperType::Enum mapperType, OdNwTextureMapper& txtMapper) method with the OdNwTextureMapper::getOffset() or OdNwTextureMapper::getScale() methods to get the offset/scale. */ double getDoubleValue(NwTextureValueType::Enum type, OdResult* pResult = NULL) const; /** \details Gets a units parameter value depending on the value of the mask. \param type [in] Parameter type specified by NwTextureValueType::Enum. \param pResult [out] Pointer to the OdResult object with the error code. \returns An NwModelUnits::Enum value depending on the type. \remarks getUnitValue() returns one of the following: Name Value Description NwModelUnits::UNITS_METERS 0x00 SI meter. Length of the path traveled by light in a vacuum in 1 299,792,458th of second. NwModelUnits::UNITS_CENTIMETERS 0x01 1 100th of an SI meter. NwModelUnits::UNITS_MILLIMETERS 0x02 1 1000th of an SI meter. NwModelUnits::UNITS_FEET 0x03 1 3rd of a yard. NwModelUnits::UNITS_INCHES 0x04 1 12th of a foot, 2.54 SI centimeters. NwModelUnits::UNITS_YARDS 0x05 Imperial yard, 0.9144 SI meters. NwModelUnits::UNITS_KILOMETERS 0x06 1000 SI meters. NwModelUnits::UNITS_MILES 0x07 1760 yards. NwModelUnits::UNITS_MICROMETERS 0x08 1 1,000,000th of an SI meter, micron. NwModelUnits::UNITS_MILS 0x09 1 1,000th of an inch. NwModelUnits::UNITS_MICROINCHES 0x0A 1 1,000,000th of an inch.
The type must match an NwTextureValueType::Enum value for unit values, otherwise pResult is set to eNotApplicable. The method is deprecated since version 25.10 and will be removed soon. Instead, use the OdResult getMapper(NwTextureMapperType::Enum mapperType, OdNwTextureMapper& txtMapper) method with the OdNwTextureMapper::getOffset() or OdNwTextureMapper::getScale() methods to offset/scale units. */ NwModelUnits::Enum getUnitValue(NwTextureValueType::Enum type, OdResult* pResult = NULL) const; /** \details Gets a raster image parameter value depending on the value of the mask. \param type [in] Parameter type specified by NwTextureValueType::Enum. \param pResult [out] Pointer to the OdResult object with the error code. \returns An OdGiRasterImagePtr value depending on the type. \remarks The type must match an NwTextureValueType::Enum value for raster image values, otherwise pResult is set to eNotApplicable. The method is deprecated since version 25.10 and will be removed soon. Instead, use the OdResult getMapper(NwTextureMapperType::Enum mapperType, OdNwTextureMapper& txtMapper) method with method OdGiRasterImagePtr OdNwTextureMapper::getRasterImage(OdResult* pRes) const. */ OdGiRasterImagePtr getRasterImageValue(NwTextureValueType::Enum type, OdResult* pResult = NULL) const; /** \details Gets a OdGeMatrix3d parameter value depending on the value of the mask. \param type [in] Parameter type specified by NwTextureValueType::Enum. \param desiredUnits [in] Parameter type specified by the NwModelUnits::Enum with model units in which mapping transformation need to calculate. \param pResult [out] Pointer to the OdResult object with the error code. \returns Returns an OdGeMatrix3d value depending on the type. \remarks The type must match an NwTextureValueType::Enum value for matrix values, otherwise pResult is set to eNotApplicable. The method is deprecated since version 25.10 and will be removed soon. Instead, use the OdResult getMapper(NwTextureMapperType::Enum mapperType, OdNwTextureMapper& txtMapper) method with method OdGeMatrix3d OdNwTextureMapper::getTransform(NwModelUnits::Enum dbUnits, OdResult* pRes) const. The desiredUnits must be one of the following: Name Value Description NwModelUnits::UNITS_METERS 0x00 SI meter. Length of the path travelled by light in a vacuum in 1 299,792,458th of second NwModelUnits::UNITS_CENTIMETERS 0x01 1 100th of an SI meter NwModelUnits::UNITS_MILLIMETERS 0x02 1 1000th of an SI meter NwModelUnits::UNITS_FEET 0x03 1 3rd of a yard NwModelUnits::UNITS_INCHES 0x04 1 12th of a foot, 2.54 SI centimeters NwModelUnits::UNITS_YARDS 0x05 Imperial yard, 0.9144 SI meters NwModelUnits::UNITS_KILOMETERS 0x06 1000 SI meters NwModelUnits::UNITS_MILES 0x07 1760 yards NwModelUnits::UNITS_MICROMETERS 0x08 1 1,000,000th of an SI meter, micron NwModelUnits::UNITS_MILS 0x09 1 1,000th of an inch NwModelUnits::UNITS_MICROINCHES 0x0A 1 1,000,000th of an inch
*/ OdGeMatrix3d getMatrixValue(NwTextureValueType::Enum type, NwModelUnits::Enum desiredUnits, OdResult* pResult = NULL) const; /** \details Gets a texture mapper object depending on the mapper type. \param mapperType [in] Parameter type specified by NwTextureMapperType::Enum. \param txtMapper [out] OdNwTextureMapper object with mapper implementation. \returns The eOk value if successful, or an appropriate error code overwise. \remarks The mapperType must be one of the following: Name Value Description NwTextureMapperType::kDiffuse 0x00 Diifuse mapper type NwTextureMapperType::kBump 0x01 Bump mapper type NwTextureMapperType::kPattern 0x02 Pattern mapper type NwTextureMapperType::kOpacity 0x03 Opacity mapper type NwTextureMapperType::kCutout 0x04 Cutout mapper type NwTextureMapperType::Roughness 0x05 Roughness mapper type */ OdResult getMapper(NwTextureMapperType::Enum mapperType, OdNwTextureMapper& txtMapper) const; /** \details Gets the diffuse intensity of this texture. \returns A double value of the diffuse intensity of this texture. */ double getDiffuseIntensity() const; /** \details Gets the reflect intensity of this texture. \returns A double value of the reflect intensity of this texture. */ double getReflectIntensity() const; /** \details Gets the bump amount value for bump instance this texture. \returns A double value of the bump amount for bump texture of this material. \remarks Returns the 0. value if material doesn't have a bump texture. */ double getBumpAmount() const; /** \details Gets the pattern amount value for pattern instance this texture. \returns A double value of the pattern amount for pattern texture of this material. \remarks Returns the 0. value if the material doesn't have a pattern texture. */ double getPatternAmount() const; /** \details Gets the tint color of this texture. \param color [out] OdNwColor object for the tint color of this texture. \returns The eOk value if successful, or an appropriate error code otherwise. */ OdResult getTint(OdNwColor& color) const; /** \details Indicates whether a tint color is used for this texture. \returns The true value if a tint color is used for this texture, or returns false otherwise. */ bool IsUseTintColor() const; /** \details Indicates whether a simple material color is used for this texture or an advanced material color instead. \returns Returns false if a color must be used from an advanced material, otherwise returns true. */ bool IsColorByObject() const; /** \details Gets the graphic JSON object with the material's properties. \returns Smart pointer to the OdNwGraphicJsonBundle object, or an empty smart pointer if the object does not exist. */ OdNwGraphicJsonBundlePtr getGraphicJson() const; /** \details Gets the GUID of the texture JSON bundle. \returns An OdGUID object for the texture bundle's GUID value. */ OdGUID getBundleGUID() const; }; /** \details This template class is a specialization of the OdSmartPtr class for OdNwTexture object pointers. */ typedef OdSmartPtr OdNwTexturePtr; #endif //__TNW_TEXTURE_H__