Changeset View
Changeset View
Standalone View
Standalone View
release/scripts/modules/_gpu_utils/shader.py
- This file was added.
| import bpy | |||||
| import gpu | |||||
| def new_batch(shader, type, content, indices=None): | |||||
| length = max(len(data) for data in content.values()) | |||||
| vbo_format = shader.format_calc() | |||||
| vbo = gpu.types.GPUVertBuf(vbo_format, length) | |||||
| for identifier, data in content.items(): | |||||
| vbo.fill_attribute(identifier, data) | |||||
| if indices is None: | |||||
| return gpu.types.GPUBatch(type=type, buf=vbo) | |||||
| else: | |||||
| ibo = gpu.types.GPUIndexBuf(type=type, seq=indices) | |||||
| return gpu.types.GPUBatch(type=type, buf=vbo, elem=ibo) | |||||
| No newline at end of file | |||||