3ds Max C++ API Reference
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
LightDescImp Struct Reference

#include <LightDescImp.h>

+ Inheritance diagram for LightDescImp:

Public Member Functions

BOOL Illuminate (ShadeContext &sc, Point3 &normal, Color &color, Point3 &dir, float &dot_nl, float &) override
 
- Public Member Functions inherited from LightDesc
 LightDesc ()
 
virtual BOOL Illuminate (ShadeContext &sc, Point3 &normal, Color &color, Point3 &dir, float &dot_nl, float &diffuseCoef)
 
virtual Point3 LightPosition ()
 
virtual CoreExport void DeleteThis ()
 
- Public Member Functions inherited from RenderData
virtual void DeleteThis ()=0
 
virtual INT_PTR Execute (int cmd, ULONG_PTR arg1=0, ULONG_PTR arg2=0, ULONG_PTR arg3=0)
 
- Public Member Functions inherited from InterfaceServer
virtual UtilExport ~InterfaceServer ()
 Destructor.
 
virtual UtilExport BaseInterfaceGetInterface (Interface_ID id)
 
template<class InterfaceType >
InterfaceType * GetTypedInterface ()
 

Public Attributes

Point3 pos
 
Color col
 
- Public Attributes inherited from LightDesc
BOOL affectDiffuse
 
BOOL affectSpecular
 
BOOL ambientOnly
 
DWORD extra
 

Additional Inherited Members

- 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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
static UtilExport voidoperator new[] (size_t size, int block_type, const char *filename, int line)
 New operator used to allocate arrays of objects.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
static UtilExport voidoperator new (size_t size, void *placement_ptr)
 Placement new operator.
 
static UtilExport void operator delete (void *ptr, void *placement_ptr)
 Placement delete operator.
 
static UtilExport voidaligned_malloc (size_t size, size_t alignment)
 Allocates memory on a specified alignment boundary.
 
static UtilExport voidaligned_realloc (void *ptr, size_t size, size_t alignment)
 Reallocates memory on a specified alignment boundary.
 
static UtilExport void aligned_free (void *ptr)
 Frees a block of memory that was allocated with aligned_malloc/aligned_realloc.
 

Member Function Documentation

◆ Illuminate()

BOOL Illuminate ( ShadeContext sc,
Point3 &  normal,
Color &  color,
Point3 &  dir,
float &  dot_nl,
float &  diffuseCoef 
)
inlineoverridevirtual
Remarks
This method is called to determine the color and direction of illumination from the light that is hitting the point (sc.P()).
Parameters:
ShadeContext& sc

Describes the properties of the point to shade. The point itself is sc.P().

Point3& normal

The normal to the surface in camera space.

Color& color

The color that is returned. This is the brightness of light striking the point (sc.P())

Point3 &dir

The direction that the light is coming from.

float &dot_nl

This provides a bit of optimization as most lights will have to calculate this quantity. This is the dot product between the light vector and the normal to the surface.

float &diffuseCoef

This parameter should be set by the Illuminate function. The default value is the same as dot_nl. It will be used by shading functions instead of dot_nl to compute the diffuse illumination of the surface. The built-in lights use the new "Contrast" parameter (which has a range of [0..100]) to compute the diffuseCoef from the dot_nl by the Contrast function:
// precomputed:
float a = contrast/200.0f + 0.5f; // so "a" varies from .5 to 1.0
kA = (2.0f-1.0f/a);
kB = 1.0f-kA;
// called by Illuminate() to compute diffuseCoef from dot_nl.
float ContrastFunc(float nl)
{
// the "Bias" function described in Graphics Gems IV, pp. 401ff
return (contrast==0.0f)? nl : nl/(kA*nl+kB);
}
Returns
Returns FALSE if the hitpoint is outside the effective range of the light or if the normal of the surface faces away from the light. This is a hint to the material that the light did not calculate its illumination because it is assumed it wasn't going to be used. If TRUE the point is being illuminated.
Default Implementation:
{ return 0;}

Reimplemented from LightDesc.

19 {
20 dir = Normalize(pos - sc.P());
21 dot_nl = DotProd(normal, dir);
22 color = col;
23 return TRUE;
24 }
virtual Point3 P()=0
Point3 pos
Definition: LightDescImp.h:16
Color col
Definition: LightDescImp.h:17

Member Data Documentation

◆ pos

Point3 pos

◆ col

Color col