Skip to content

Commit

Permalink
libgui|GLUniform: Setting contents of a vec3 array
Browse files Browse the repository at this point in the history
  • Loading branch information
skyjake committed Sep 1, 2019
1 parent 07ef7ec commit 3a4a30f
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
1 change: 1 addition & 0 deletions doomsday/libs/gui/include/de/graphics/gluniform.h
Expand Up @@ -122,6 +122,7 @@ class LIBGUI_PUBLIC GLUniform
GLUniform &set(dint const *intArray, dsize count);
GLUniform &set(float const *floatArray, dsize count);
GLUniform &set(Vector2f const *vectorArray, dsize count);
GLUniform &set(Vector3f const *vectorArray, dsize count);
GLUniform &set(Vector4f const *vectorArray, dsize count);
GLUniform &set(Matrix4f const *mat4Array, dsize count);

Expand Down
11 changes: 11 additions & 0 deletions doomsday/libs/gui/src/graphics/gluniform.cpp
Expand Up @@ -445,6 +445,17 @@ GLUniform &GLUniform::set(float const *floatArray, dsize count)
return *this;
}

GLUniform &GLUniform::set(const Vector3f *vectorArray, dsize count)
{
DENG2_ASSERT(d->type == Vec3Array);
DENG2_ASSERT(count <= d->elemCount);

memcpy(d->value.vector, vectorArray, sizeof(Vector3f) * count);
d->usedElemCount = duint16(count);
d->markAsChanged();
return *this;
}

GLUniform &GLUniform::set(Vector4f const *vectorArray, dsize count)
{
DENG2_ASSERT(d->type == Vec4Array);
Expand Down
4 changes: 2 additions & 2 deletions doomsday/libs/gui/src/graphics/image.cpp
Expand Up @@ -817,13 +817,13 @@ GLPixelFormat Image::glFormat(Format imageFormat)
return GLPixelFormat(GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE, 4);

case R_16f:
return GLPixelFormat(GL_R16F, GL_RED, GL_FLOAT, 2);
return GLPixelFormat(GL_R16F, GL_RED, GL_FLOAT, 4);

case RG_16f:
return GLPixelFormat(GL_RG16F, GL_RG, GL_FLOAT, 4);

case RGB_16f:
return GLPixelFormat(GL_RGB16F, GL_RGB, GL_FLOAT, 2);
return GLPixelFormat(GL_RGB16F, GL_RGB, GL_FLOAT, 4);

case RGBA_16f:
return GLPixelFormat(GL_RGBA16F, GL_RGBA, GL_FLOAT, 4);
Expand Down

0 comments on commit 3a4a30f

Please sign in to comment.