About
A LodObject represents a LOD (level of detail) object generator. This generator creates geometry based on various parameters e.g. camera distance. The LodObject class provides access to the parameters of the dynamically defined levels. It is defined in the lib_lodobject.h
header file.
LodObject objects are an instance of Olod.
Access
A LodObject object is a BaseObject and can be accessed like any other object. See BaseObject Manual.
Allocation/Deallocation
LodObject objects are created with the usual tools, see Entity Creation and Destruction Manual (Cinema API).
- LodObject::Alloc(): Creates a new LodObject.
- LodObject::Free(): Deletes the given LodObject.
LodObject* const lodObject = LodObject::Alloc();
if (lodObject == nullptr)
lodObject->SetName("New LOD Object"_s);
doc->InsertObject(lodObject,
nullptr,
nullptr);
#define MAXON_SOURCE_LOCATION
Definition: memoryallocationbase.h:69
const char * doc
Definition: pyerrors.h:226
Properties
The standard parameters of a LodObject can be obtained and changed with C4DAtom::SetParameter()/ C4DAtom::GetParameter(). The parameter IDs are defined in olod.h
.
GeData data;
const Int32 criteria = data.GetInt32();
{
const Int32 maxLevel = lodObject->GetLevelCount() - 1;
}
NONE
Definition: asset_browser.h:1
#define ConstDescID(...)
Definition: lib_description.h:592
maxon::Int32 Int32
Definition: ge_sys_math.h:51
@ LOD_CRITERIA
Definition: olod.h:7
@ LOD_CURRENT_LEVEL
Definition: olod.h:9
@ LOD_CRITERIA_MANUAL
Definition: olod.h:28
Levels
A LodObject object handles multiple levels. The current level is used to define the geometry it should create.
- LodObject::GetLevelCount(): Returns the number of levels.
- LodObject::GetCurrentLevel(): Returns the index of the current level.
const Int32 currentLevel = lodObject->GetCurrentLevel();
DescID showControlID;
if (!lodObject->GetShowControlDescID(currentLevel, showControlID))
Dynamic Parameter IDs
Each level contains multiple parameters that configure that level. The DescID for these parameters can be obtained with these functions.
In every mode a level defines various display parameters:
- LodObject::GetShowControlDescID(): Returns the DescID for the display mode.
- LodObject::GetDisplayBFCDescID(): Returns the DescID for the backface culling mode.
- LodObject::GetDisplayTexDescID(): Returns the DescID for the texture mode.
- LodObject::GetDisplayEOGLDescID(): Returns the DescID for the Enhanced OpenGL mode.
- LodObject::GetDisplayStModeDescID(): Returns the DescID for the shading style.
- LodObject::GetDisplayShModeDescID(): Returns the DescID for the shading settings.
The IDs of the shading modes and styles are defined in tdisplay.h
.
const Int32 maxLevel = lodObject->GetLevelCount();
{
DescID descID;
if (!lodObject->GetDisplayBFCDescID(
level, descID))
if (!lodObject->GetDisplayShModeDescID(
level, descID))
if (!lodObject->GetDisplayStModeDescID(
level, descID))
}
PyObject PyObject PyObject int level
Definition: import.h:58
@ DISPLAYTAG_WDISPLAY_WIREFRAME
Definition: tdisplay.h:31
@ DISPLAYTAG_SDISPLAY_NOSHADING
Definition: tdisplay.h:13
In "Manual Groups" mode a list of objects can be accessed:
- LodObject::GetManualModeObjectListDescID(): Returns the DescID of the InExclude list.
{
C4DAtom*
const atom = objects->GetIndex(
level);
BaseObject*
const baseObject =
static_cast<BaseObject*
>(
atom);
if (baseObject == nullptr)
baseObject->Remove();
doc->InsertObject(baseObject, lodObject,
nullptr);
DescID listID;
if (!lodObject->GetManualModeObjectListDescID(
level, listID))
InExcludeData* const inExData = data.GetCustomDataTypeWritable<InExcludeData>();
if (inExData == nullptr)
inExData->InsertObject(baseObject, 1);
}
#define CUSTOMDATATYPE_INEXCLUDE_LIST
InExclude custom data type ID.
Definition: customgui_inexclude.h:24
#define atom
Definition: graminit.h:72
@ DEFAULTVALUE
Dummy value for the default value GeData constructor.
Definition: c4d_gedata.h:64
@ LOD_MODE
Definition: olod.h:6
@ LOD_LEVEL_COUNT_DYN
Definition: olod.h:13
@ LOD_MODE_MANUAL_GROUPS
Definition: olod.h:25
In "Simplify" mode these settings are available:
- LodObject::GetSimplifyModeDescID(): Returns the DescID of the "Simplify Mode" parameter.
- LodObject::GetDecimateStrengthDescID(): Returns the DescID of the strength parameter.
- LodObject::GetPerObjectControlDescID(): Returns the DescID of the "Per Object" option.
- LodObject::GetNullDisplayDescID(): Returns the DescID of the null display mode.
- LodObject::GetNullRadiusDescID(): Returns the DescID of the null radius parameter.
- LodObject::GetNullAspectRatioDescID(): Returns the DescID of the null aspect radius parameter.
- LodObject::GetNullOrientationDescID(): Returns the DescID of the null orientation parameter.
The null display mode setting IDs are defined in onull.h
.
DescID descID;
if (!lodObject->GetSimplifyModeDescID(0, descID))
if (!lodObject->GetPerObjectControlDescID(0, descID))
if (!lodObject->GetSimplifyModeDescID(1, descID))
if (!lodObject->GetNullDisplayDescID(1, descID))
@ LOD_SIMPLIFY_NULL
Definition: olod.h:40
@ LOD_SIMPLIFY_CONVEXHULL
Definition: olod.h:38
@ LOD_MODE_SIMPLIFY
Definition: olod.h:26
@ NULLOBJECT_DISPLAY_CIRCLE
Definition: onull.h:9
Dirty Checksums
The dirty checksum of levels and the cache can be obtained with:
- LodObject::GetLevelDirty(): Returns the checksum for the level switch. Every time the level changes, the counter is increased.
- LodObject::GetCacheDirty(): Returns the checksum for the cache creation. Every time the cache is rebuilt, the counter is increased.
Further Reading