Python API: new GPUVertFormat constructor and vbo.fill_attribute method
Reviewer: fclem Differential Revision: https://developer.blender.org/D3760
This commit is contained in:
@@ -87,6 +87,7 @@ uint GPU_vertformat_attr_add(
|
||||
GPUVertFormat *, const char *name,
|
||||
GPUVertCompType, uint comp_len, GPUVertFetchMode);
|
||||
void GPU_vertformat_alias_add(GPUVertFormat *, const char *alias);
|
||||
int GPU_vertformat_attr_id_get(const GPUVertFormat *, const char *name);
|
||||
|
||||
/* format conversion */
|
||||
|
||||
|
||||
@@ -34,6 +34,8 @@
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "BLI_utildefines.h"
|
||||
|
||||
#define PACK_DEBUG 0
|
||||
|
||||
#if PACK_DEBUG
|
||||
@@ -204,6 +206,19 @@ void GPU_vertformat_alias_add(GPUVertFormat *format, const char *alias)
|
||||
attrib->name[attrib->name_len++] = copy_attrib_name(format, alias);
|
||||
}
|
||||
|
||||
int GPU_vertformat_attr_id_get(const GPUVertFormat *format, const char *name)
|
||||
{
|
||||
for (int i = 0; i < format->attr_len; i++) {
|
||||
const GPUVertAttr *attrib = format->attribs + i;
|
||||
for (int j = 0; j < attrib->name_len; j++) {
|
||||
if (STREQ(name, attrib->name[j])) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
uint padding(uint offset, uint alignment)
|
||||
{
|
||||
const uint mod = offset % alignment;
|
||||
|
||||
Reference in New Issue
Block a user