mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 18:31:55 -04:00
Changes from Fei Wang to support vertex colors
This commit is contained in:
parent
596e6e1482
commit
8006b3fc73
@ -655,6 +655,13 @@ make_polyset(INode *max_node, Mesh *mesh,
|
|||||||
n3d = n3d * vertex_frame;
|
n3d = n3d * vertex_frame;
|
||||||
vert.set_normal(n3d);
|
vert.set_normal(n3d);
|
||||||
|
|
||||||
|
// Get the vertex color
|
||||||
|
if(mesh->vcFace) { // if has vcFace, has used vertex color
|
||||||
|
VertColor vertexColor = get_max_vertex_color(mesh, iFace, iVertex);
|
||||||
|
Colorf pVC(vertexColor.x, vertexColor.y, vertexColor.z, 1);
|
||||||
|
vert.set_color(pVC);
|
||||||
|
}
|
||||||
|
|
||||||
// Get the UVs for this vertex
|
// Get the UVs for this vertex
|
||||||
for (int iChan=0; iChan<pmat._map_channels.size(); iChan++) {
|
for (int iChan=0; iChan<pmat._map_channels.size(); iChan++) {
|
||||||
int channel = pmat._map_channels[iChan];
|
int channel = pmat._map_channels[iChan];
|
||||||
@ -719,6 +726,17 @@ UVVert MaxToEggConverter::get_max_vertex_texcoord(Mesh *mesh, int faceNo, int ve
|
|||||||
return uvVert;
|
return uvVert;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
VertColor MaxToEggConverter::get_max_vertex_color(Mesh *mesh, int FaceNo, int VertexNo) {
|
||||||
|
VertColor vc(0,0,0);
|
||||||
|
// We get the color from vcFace
|
||||||
|
TVFace& _vcface = mesh->vcFace[FaceNo];
|
||||||
|
// Get its index into the vertCol array
|
||||||
|
int VertexColorIndex = _vcface.t[VertexNo];
|
||||||
|
// Get its color
|
||||||
|
vc = mesh->vertCol[VertexColorIndex];
|
||||||
|
return vc;
|
||||||
|
}
|
||||||
|
|
||||||
Point3 MaxToEggConverter::get_max_vertex_normal(Mesh *mesh, int faceNo, int vertNo)
|
Point3 MaxToEggConverter::get_max_vertex_normal(Mesh *mesh, int faceNo, int vertNo)
|
||||||
{
|
{
|
||||||
Face f = mesh->faces[faceNo];
|
Face f = mesh->faces[faceNo];
|
||||||
|
@ -86,6 +86,7 @@ class MaxToEggConverter {
|
|||||||
Shader *default_shader = NULL);
|
Shader *default_shader = NULL);
|
||||||
|
|
||||||
Point3 get_max_vertex_normal(Mesh *mesh, int faceNo, int vertNo);
|
Point3 get_max_vertex_normal(Mesh *mesh, int faceNo, int vertNo);
|
||||||
|
VertColor get_max_vertex_color(Mesh *mesh, int FaceNo, int VertexNo);
|
||||||
UVVert get_max_vertex_texcoord(Mesh *mesh, int faceNo, int vertNo, int channel);
|
UVVert get_max_vertex_texcoord(Mesh *mesh, int faceNo, int vertNo, int channel);
|
||||||
|
|
||||||
void get_vertex_weights(INode *max_node, EggVertexPool *vpool);
|
void get_vertex_weights(INode *max_node, EggVertexPool *vpool);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user