83 if (normals.count() > 0
86 && normals.count() ==
mTangent.count()
90 normals.bindBufferBase(9);
105 vertices.bindBufferBase(8);
106 texCoords.bindBufferBase(10);
109 for (
int i = 0; i < shapes.size(); i++)
111 auto shape = shapes[i];
112 auto mtl = shape->material;
117 pbr.color = { mtl->baseColor.x, mtl->baseColor.y, mtl->baseColor.z };
118 pbr.metallic = mtl->metallic;
119 pbr.roughness = mtl->roughness;
120 pbr.alpha = mtl->alpha;
127 glActiveTexture(GL_TEXTURE10);
128 glBindTexture(GL_TEXTURE_2D, 0);
129 glActiveTexture(GL_TEXTURE11);
130 glBindTexture(GL_TEXTURE_2D, 0);
132 if (mtl->texColor.isValid()) {
134 mtl->texColor.bind(GL_TEXTURE10);
140 if (mtl->texBump.isValid()) {
141 mtl->texBump.bind(GL_TEXTURE11);
148 auto color = this->varBaseColor()->getValue();
149 pbr.color = { color.r, color.g, color.b };
150 pbr.metallic = this->varMetallic()->getValue();
151 pbr.roughness = this->varRoughness()->getValue();
152 pbr.alpha = this->varAlpha()->getValue();
160 int numTriangles = shape->glVertexIndex.count();
167 shape->glVertexIndex.bind();
168 glEnableVertexAttribArray(0);
169 glVertexAttribIPointer(0, 1, GL_INT,
sizeof(
int), (
void*)0);
171 if (shape->glNormalIndex.count() == numTriangles) {
172 shape->glNormalIndex.bind();
173 glEnableVertexAttribArray(1);
174 glVertexAttribIPointer(1, 1, GL_INT,
sizeof(
int), (
void*)0);
178 glDisableVertexAttribArray(1);
179 glVertexAttribI4i(1, -1, -1, -1, -1);
182 if (shape->glTexCoordIndex.count() == numTriangles) {
183 shape->glTexCoordIndex.bind();
184 glEnableVertexAttribArray(2);
185 glVertexAttribIPointer(2, 1, GL_INT,
sizeof(
int), (
void*)0);
189 glDisableVertexAttribArray(2);
190 glVertexAttribI4i(2, -1, -1, -1, -1);
194 if (
mOffset.size() >= shapes.size())
205 glDrawArraysInstanced(GL_TRIANGLES, 0, numTriangles * 3,
mLists[i].size());
210 printf(
"GLPhotorealisticInstanceRender::inTransform Is Error !!!!!!\n");