mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-02 09:52:27 -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;
|
||||
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
|
||||
for (int iChan=0; iChan<pmat._map_channels.size(); iChan++) {
|
||||
int channel = pmat._map_channels[iChan];
|
||||
@ -718,7 +725,18 @@ UVVert MaxToEggConverter::get_max_vertex_texcoord(Mesh *mesh, int faceNo, int ve
|
||||
}
|
||||
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)
|
||||
{
|
||||
Face f = mesh->faces[faceNo];
|
||||
|
@ -86,6 +86,7 @@ class MaxToEggConverter {
|
||||
Shader *default_shader = NULL);
|
||||
|
||||
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);
|
||||
|
||||
void get_vertex_weights(INode *max_node, EggVertexPool *vpool);
|
||||
|
Loading…
x
Reference in New Issue
Block a user