3ds Max C++ API Reference
BaseTranslator_Texmap Class Reference

Base class for translating a Texmap. More...

#include <BaseTranslator_Texmap.h>

+ Inheritance diagram for BaseTranslator_Texmap:

Public Member Functions

 BaseTranslator_Texmap (Texmap *texmap, TranslatorGraphNode &graphNode)
 
 ~BaseTranslator_Texmap ()
 
- Public Member Functions inherited from BaseTranslator_MtlBase
 BaseTranslator_MtlBase (MtlBase *mtl, const bool monitor_mtl_base, TranslatorGraphNode &graphNode)
 
 ~BaseTranslator_MtlBase ()
 
virtual void PreTranslate (const TimeValue translationTime, Interval &validity) override
 Called just before Translate() to enable pre-processing of any kind. More...
 
virtual MSTR GetTimingCategory () const override
 Returns the string label to be used by the time reporting mechanism. More...
 
- Public Member Functions inherited from BaseTranslator_ReferenceTarget
 BaseTranslator_ReferenceTarget (ReferenceTarget *reference_target, const bool monitor_reference_target, TranslatorGraphNode &graphNode)
 
 ~BaseTranslator_ReferenceTarget ()
 
virtual Interval CheckValidity (const TimeValue t, const Interval &previous_validity) const override
 Deferred checks whether this translator should be invalidated. More...
 
virtual void PostTranslate (const TimeValue translationTime, Interval &validity) override
 Called just after Translate() to enable post-processing of any kind. More...
 
- Public Member Functions inherited from Translator
 Translator (TranslatorGraphNode &graphNode)
 The constructor expects a reference to a TranslatorGraphNode. More...
 
virtual ~Translator ()
 
virtual TranslationResult Translate (const TimeValue translationTime, Interval &newValidity, ITranslationProgress &translationProgress, KeyframeList &keyframesNeeded)=0
 Performs the translation for which this class is responsible. More...
 
virtual TranslationResult TranslateKeyframe (const TimeValue frame_time, const TimeValue keyframe_time, ITranslationProgress &translationProgress)=0
 Performs translation for a single keyframe. More...
 
virtual void AccumulateStatistics (TranslatorStatistics &stats) const =0
 Called by the system to accumulate statistics on the translated scene. More...
 
void AccumulateGraphStatistics (TranslatorStatistics &statistics) const
 Accumulates statistics on the whole translate graph, starting at this translation node. More...
 
TranslatorGraphNode & GetGraphNode () const
 For internal use. More...
 

Static Public Member Functions

static bool BakeTexmap (Texmap &texmap, const TimeValue t, Interval &validity, const IPoint2 &default_resolution, IPoint2 &baked_resolution, std::vector< BMM_Color_fl > &pixel_data)
 Bakes a Texmap into linear array of pixels. More...
 
static bool ExtractBitmap (Bitmap &bitmap, IPoint2 &resolution, std::vector< BMM_Color_fl > &pixel_data)
 Extracts the pixels from a Bitmap, as 32-bit floating-point RGBA values. More...
 
static bool ExtractBitmap (Bitmap &bitmap, IPoint2 &resolution, std::vector< BMM_Color_64 > &pixel_data)
 Extracts the pixels from a Bitmap, as 16-bit integer RGBA values. More...
 
- Static Public Member Functions inherited from BaseTranslator_MtlBase
static void UpdateMaterialHierarchy (MtlBase &mtlBase, const TimeValue t, Interval &validity)
 Calls MtlBase::Update() and Texmap::LoadMapFiles() on the given material/texmap and its sub-tree of materials and textures. More...
 
- Static Public Member Functions inherited from MaxHeapOperators
static UtilExport voidoperator new (size_t size)
 Standard new operator used to allocate objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, const std::nothrow_t &e)
 Standard new operator used to allocate objects if there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new (size_t size, const char *filename, int line)
 New operator used to allocate objects that takes the filename and line number where the new was called If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, int block_type, const char *filename, int line)
 New operator used to allocate objects that takes the type of memory, filename and line number where the new was called If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, const std::nothrow_t &e, const char *filename, int line)
 New operator used to allocate objects that takes the filename and line number where the new was called If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new (size_t size, unsigned long flags)
 New operator used to allocate objects that takes extra flags to specify special operations If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, const std::nothrow_t &e, unsigned long flags)
 New operator used to allocate objects that takes extra flags to specify special operations If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new[] (size_t size)
 New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new[] (size_t size, const std::nothrow_t &e)
 New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new[] (size_t size, const char *filename, int line)
 New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new[] (size_t size, int block_type, const char *filename, int line)
 New operator used to allocate arrays of objects. More...
 
static UtilExport voidoperator new[] (size_t size, const std::nothrow_t &e, const char *filename, int line)
 New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new[] (size_t size, unsigned long flags)
 New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new[] (size_t size, const std::nothrow_t &e, unsigned long flags)
 New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned. More...
 
static UtilExport void operator delete (void *ptr)
 Standard delete operator used to deallocate an object If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, const std::nothrow_t &e)
 Standard delete operator used to deallocate an object If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete (void *ptr, const char *filename, int line)
 Delete operator used to deallocate an object that takes the filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, int block_type, const char *filename, int line)
 Delete operator used to deallocate an object that takes the type of memory, filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, const std::nothrow_t &e, const char *filename, int line)
 Delete operator used to deallocate an object that takes the filename and line number where the delete was called If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete (void *ptr, unsigned long flags)
 Delete operator used to deallocate an object that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, const std::nothrow_t &e, unsigned long flags)
 Delete operator used to deallocate an object that takes extra flags to specify special operations If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete[] (void *ptr)
 Standard delete operator used to deallocate an array of objects If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, const std::nothrow_t &e)
 Standard delete operator used to deallocate an array of objects If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete[] (void *ptr, const char *filename, int line)
 Delete operator used to deallocate an array of objects that takes the filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, int block_type, const char *filename, int line)
 Delete operator used to deallocate an array of objects that takes the type of memory, filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, const std::nothrow_t &e, const char *filename, int line)
 Delete operator used to deallocate an array of objects that takes the filename and line number where the delete was called If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete[] (void *ptr, unsigned long flags)
 Delete operator used to deallocate an array of objects that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, const std::nothrow_t &e, unsigned long flags)
 Delete operator used to deallocate an array of objects that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, void *placement_ptr)
 Placement new operator. More...
 
static UtilExport void operator delete (void *ptr, void *placement_ptr)
 Placement delete operator. More...
 
static UtilExport voidaligned_malloc (size_t size, size_t alignment)
 Allocates memory on a specified alignment boundary. More...
 
static UtilExport voidaligned_realloc (void *ptr, size_t size, size_t alignment)
 Reallocates memory on a specified alignment boundary. More...
 
static UtilExport void aligned_free (void *ptr)
 Frees a block of memory that was allocated with aligned_malloc/aligned_realloc. More...
 

Protected Member Functions

TexmapGetTexmap () const
 Returns the Texmap being handled by this translator. More...
 
virtual void NotificationCallback_NotifyEvent (const IGenericEvent &genericEvent, void *userData) override
 Called to process an event. More...
 
- Protected Member Functions inherited from BaseTranslator_MtlBase
MtlBaseGetMtlBase () const
 Returns the MtlBase being handled by this translator. More...
 
- Protected Member Functions inherited from BaseTranslator_ReferenceTarget
ReferenceTargetGetReferenceTarget () const
 Returns the ReferenceTarget being handled by this class. More...
 
- Protected Member Functions inherited from Translator
template<typename TranslatorType >
const TranslatorType * AcquireChildTranslator (const TranslatorKey &key, const TimeValue t, ITranslationProgress &translation_progress, TranslationResult &result)
 Acquires a dependency to a another translator and its outputs. More...
 
void Invalidate (const bool defer_invalidation_check=false)
 Invalidates this translator, typically as a result of a change notification callback. More...
 
void InvalidateParents ()
 Invalidates all parents of this translator. More...
 
void TranslatedObjectDeleted ()
 Flags the objects/inputs, being translated by this translated, as having been deleted. More...
 
IRenderSessionContextGetRenderSessionContext ()
 Returns the render session context for which this translator was created. More...
 
const IRenderSessionContextGetRenderSessionContext () const
 Returns the render session context for which this translator was created. More...
 
size_t GetNumOutputs () const
 Returns the number of outputs that are present on this translator. More...
 
template<typename OutputType >
std::shared_ptr< const OutputType > GetOutput (const size_t index) const
 Returns the output at the given index, dynamically cast to the given sub-class of ITranslatorOutput. More...
 
void SetNumOutputs (const size_t num)
 Initializes the size of the internal array, used to store the outputs. More...
 
void SetOutput (const size_t index, std::shared_ptr< const ITranslatorOutput > output)
 Initializes the output, at the given index, to the given value. More...
 
void ResetOutput (const size_t index)
 Deletes the output at the given index, such that GetOutput() will henceforth return null. More...
 
void ResetAllOutputs ()
 Deletes all outputs. More...
 
template<typename SimpleValueType >
void SetOutput_SimpleValue (const size_t output_index, const SimpleValueType &value)
 Shortcut method to initialize outputs which map to simple types that require no external cleanup code. More...
 
template<typename SimpleValueType >
SimpleValueType GetOutput_SimpleValue (const size_t output_index, const SimpleValueType &default_value) const
 Returns an output initialized using SetOutput_SimpleValue(). More...
 
- Protected Member Functions inherited from Noncopyable
 Noncopyable ()
 
 ~Noncopyable ()
 
- Protected Member Functions inherited from INotificationCallback
virtual ~INotificationCallback ()
 

Additional Inherited Members

- Public Types inherited from Translator
typedef std::set< TimeValueKeyframeList
 

Detailed Description

Base class for translating a Texmap.

This base class provides basic, common functionality related to translating a Texmap. It handles:

  • Monitoring the Texmap and invalidating the translator on any changes.
  • Calling RenderBegin() on the Texmap before translation.
  • Calling MtlBase::Update() on the Texmap before translation.

Constructor & Destructor Documentation

◆ BaseTranslator_Texmap()

BaseTranslator_Texmap ( Texmap texmap,
TranslatorGraphNode &  graphNode 
)
Parameters
texmapThe Texmap to be translated.
graphNodeThe graph node to be passed to Translator::Translator().

◆ ~BaseTranslator_Texmap()

Member Function Documentation

◆ BakeTexmap()

static bool BakeTexmap ( Texmap texmap,
const TimeValue  t,
Interval validity,
const IPoint2 default_resolution,
IPoint2 baked_resolution,
std::vector< BMM_Color_fl > &  pixel_data 
)
static

Bakes a Texmap into linear array of pixels.

Returns false if failure to bake, for any reason.

Parameters
texmapThe texmap to be baked.
tThe time at which to evaluate the Texmap.
[in,out]validityThe validity interval of the Texmap is intersected into this.
default_resolutionThe resolution to bake the Texmap at, should the Texmap not define its own resolution.
[out]baked_resolutionThe resolution at which the Texmap was baked.
[out]pixel_dataThe baked Texmap pixels.
Returns
True on success, false on failure - for any reason (e.g. missing texture file).

◆ ExtractBitmap() [1/2]

static bool ExtractBitmap ( Bitmap bitmap,
IPoint2 resolution,
std::vector< BMM_Color_fl > &  pixel_data 
)
static

Extracts the pixels from a Bitmap, as 32-bit floating-point RGBA values.

This method extracts the pixels from a given Bitmap, storing them into a linear array of pixels.

Parameters
bitmapThe bitmap from which to extra the pixels.
[out]resolutionThe resolution of the extracted pixel data.
[out]pixel_dataThe pixels, extracted from the bitmap.
Returns
True on success, false on error - for any reason (e.g. missing texture file).

◆ ExtractBitmap() [2/2]

static bool ExtractBitmap ( Bitmap bitmap,
IPoint2 resolution,
std::vector< BMM_Color_64 > &  pixel_data 
)
static

Extracts the pixels from a Bitmap, as 16-bit integer RGBA values.

This method extracts the pixels from a given Bitmap, storing them into a linear array of pixels.

Parameters
bitmapThe bitmap from which to extra the pixels.
[out]resolutionThe resolution of the extracted pixel data.
[out]pixel_dataThe pixels, extracted from the bitmap.
Returns
True on success, false on error - for any reason (e.g. missing texture file).

◆ GetTexmap()

Texmap* GetTexmap ( ) const
protected

Returns the Texmap being handled by this translator.

◆ NotificationCallback_NotifyEvent()

virtual void NotificationCallback_NotifyEvent ( const IGenericEvent genericEvent,
void userData 
)
overrideprotectedvirtual

Called to process an event.

Note that it is possible to monitor and stop monitoring events from within this notification callback. The notification system is specifically built to handle that.

Parameters
genericEventthe event in question
userDatathe user data passed to the Monitor*() call on notification client.

Reimplemented from BaseTranslator_ReferenceTarget.