About
The VertexColorTag is used to add additional color information to a polygon object. The tag can be either in point mode or polygon mode. In point mode it will store color information for each vertex of the object. In polygon mode it will store color information for each vertex of each polygon of the object.
A VertexColorTag is based on VariableTag and is an instance of Tvertexcolor
.
Access
An existing VertexColorTag can be accessed from its host object.
if (tag == nullptr)
Definition: c4d_basetag.h:48
Definition: c4d_basetag.h:824
return OK
Definition: apibase.h:2667
#define Tvertexcolor
Vertex color.
Definition: ge_prepass.h:1436
Allocation/Deallocation
VertexColorTag instances are created with the usual tools:
- Note
- The VertexColorTag is always allocated in point mode.
See also Tags and BaseTag and VariableTag Manual.
if (tag == nullptr)
{
const Int32 pointCount = polyObject->GetPointCount();
if (tag == nullptr)
polyObject->InsertTag(tag);
}
static VertexColorTag * Alloc(Int32 count)
maxon::Int32 Int32
Definition: ge_sys_math.h:60
#define MAXON_SOURCE_LOCATION
Definition: memoryallocationbase.h:67
Mode
A VertexColorTag can either be in point mode or polygon mode.
- Warning
- The mode of a tag must be changed with VertexColorTag::SetPerPointMode(). It is not enough to change the parameter ID_VERTEXCOLOR_VERTEXCOLORMODE.
- Note
- In point mode VariableTag::GetDataCount() returns the number of points, in polygon mode the number of polygons.
const Bool pointMode = vcTag->IsPerPointColor();
vcTag->SetPerPointMode(!pointMode);
maxon::Bool Bool
Definition: ge_sys_math.h:55
Data Access
The data stored in the VertexColorTag can be accessed using a read or write handle:
- Warning
- These handles become invalid after changing the mode (see Mode).
- Note
- It is possible to set values greater than 1.0.
These two functions can only be used in polygon mode. They access the polygon vertex colors of the given polygon index.
if (vcTag->IsPerPointColor())
{
const Vector hsv { hue, 1.0, 1.0 };
hue += stepSize;
}
Py_ssize_t i
Definition: abstract.h:645
static void Get(ConstVertexColorHandle dataptr, Int32 i, VertexColorStruct &res)
Definition: c4d_basetag.h:874
static void Set(VertexColorHandle dataptr, Int32 i, const VertexColorStruct &s)
Definition: c4d_basetag.h:896
unsigned char * p
Definition: floatobject.h:87
maxon::Vec3< maxon::Float32, 1 > Vector32
Definition: ge_math.h:139
maxon::Float Float
Definition: ge_sys_math.h:66
#define MSG_UPDATE
Must be sent if the bounding box has to be recalculated. (Otherwise use MSG_CHANGE....
Definition: c4d_baselist.h:341
void * VertexColorHandle
Handle for vertex color data. See also VertexColorTag.
Definition: operatingsystem.h:465
Definition: operatingsystem.h:659
A color consisting of three components R, G, B and an alpha.
Definition: col4.h:16
The following functions can be used to access vertex colors in both point and polygon mode.
- Warning
- In point mode one must not hand over the pointers for the Neighbor object and the polygon array.
These functions access the RGB color as a maxon::Color32 value:
These functions access the alpha part as a Float32 value:
const Int32 pointCount = polyObject->GetPointCount();
const Int32 polyCount = polyObject->GetPolygonCount();
const CPolygon*
const polys = polyObject->GetPolygonR();
if (!neighbor.
Init(pointCount, polys, polyCount,
nullptr))
{
if (vcTag->IsPerPointColor())
{
}
else
{
}
}
Definition: c4d_baseobject.h:2503
virtual Bool Init(Int32 pcnt, const CPolygon *vadr, Int32 vcnt, BaseSelect *bs)
Definition: c4d_string.h:39
static String FloatToString(Float32 v, Int32 vvk=-1, Int32 nnk=-3)
Definition: c4d_string.h:529
static maxon::Color32 GetColor(ConstVertexColorHandle dataptr, Neighbor *nb, const CPolygon *vadr, Int32 pIndex)
static Float32 GetAlpha(ConstVertexColorHandle dataptr, Neighbor *nb, const CPolygon *vadr, Int32 pIndex)
maxon::Float32 Float32
Definition: ge_sys_math.h:68
#define ApplicationOutput(formatString,...)
Definition: debugdiagnostics.h:210
const void * ConstVertexColorHandle
Handle for read-only vertex color data. See also VertexColorTag.
Definition: operatingsystem.h:466
Represents a polygon that can be either a triangle or a quadrangle.
Definition: c4d_baseobject.h:44
A color consisting of three components R, G and B.
Definition: col.h:16
String ToString(const FormatStatement *formatStatement=nullptr) const
Definition: col.h:380
These functions handle the RGBA values in form of a maxon::ColorA32 structure.
{
if (vcTag->IsPerPointColor())
else
}
Further Reading