mirror of
https://github.com/PixarAnimationStudios/OpenSubdiv
synced 2024-11-25 13:00:07 +00:00
Merge pull request #459 from takahito-tejima/dev
glImaging: Fix out-of-bound access when creating varying buffer.
This commit is contained in:
commit
f95099a808
@ -411,14 +411,18 @@ void runTest(ShapeDesc const &shapeDesc, std::string const &kernel,
|
||||
std::vector<float> vertex;
|
||||
vertex.resize(nverts * numVertexElements);
|
||||
for (int i = 0; i < nverts; ++i) {
|
||||
// normalize xyz
|
||||
for (int j = 0; j < 3; ++j) {
|
||||
vertex[i*numVertexElements+j] =
|
||||
(shape->verts[i*3+j] - center[j])/radius;
|
||||
}
|
||||
for (int j = 0; j < 4; ++j) {
|
||||
// set rgb from xyz
|
||||
for (int j = 0; j < 3; ++j) {
|
||||
vertex[i*numVertexElements+j+3] =
|
||||
(shape->verts[i*3+j] - pmin[j])*2.0f/radius;
|
||||
}
|
||||
// set alpha to 1.0
|
||||
vertex[i*numVertexElements+3+3] = 1.0f;
|
||||
}
|
||||
mesh->UpdateVertexBuffer(&vertex[0], 0, nverts);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user