2025-10-04 13:51:41 +02:00
|
|
|
# People's Video Editor: high quality, GPU accelerated mp4 editor
|
|
|
|
|
# Copyright (C) 2025 Roz K <roz@rozk.net>
|
|
|
|
|
#
|
|
|
|
|
# This file is part of People's Video Editor.
|
|
|
|
|
#
|
|
|
|
|
# People's Video Editor is free software: you can redistribute it and/or modify it under the terms of the
|
|
|
|
|
# GNU General Public License as published by the Free Software Foundation, either version 3 of the License,
|
|
|
|
|
# or (at your option) any later version.
|
|
|
|
|
#
|
|
|
|
|
# People's Video Editor is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
|
|
|
|
# without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
|
# See the GNU General Public License for more details.
|
|
|
|
|
#
|
|
|
|
|
# You should have received a copy of the GNU General Public License along with People's Video Editor.
|
|
|
|
|
# If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
|
|
2025-10-21 13:18:23 +02:00
|
|
|
from . import libgl
|
2025-10-04 13:51:41 +02:00
|
|
|
|
2025-10-21 11:08:13 +02:00
|
|
|
class VertexBuffer:
|
|
|
|
|
__slots__ = '_buffer', '_size'
|
|
|
|
|
|
|
|
|
|
def __init__(self, size):
|
|
|
|
|
self._buffer = libgl.create_vertex_buffer(size)
|
|
|
|
|
self._size = size
|
|
|
|
|
|
|
|
|
|
def __del__(self):
|
|
|
|
|
libgl.delete_vertex_buffer(self._buffer)
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
def size(self):
|
|
|
|
|
return self._size
|
|
|
|
|
|
|
|
|
|
def upload(self, mesh):
|
|
|
|
|
assert (self._size >= mesh.size)
|
|
|
|
|
return libgl.upload_vertex_buffer(self._buffer, mesh.view, mesh.size)
|