pve, pygl
This commit is contained in:
15
pygl/__init__.py
Normal file
15
pygl/__init__.py
Normal file
@ -0,0 +1,15 @@
|
||||
# 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/>.
|
||||
41
pygl/libgl/__init__.py
Normal file
41
pygl/libgl/__init__.py
Normal file
@ -0,0 +1,41 @@
|
||||
# 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/>.
|
||||
|
||||
import ctypes
|
||||
|
||||
Texture_p = ctypes.c_void_p
|
||||
VertexBuffer_p = ctypes.c_void_p
|
||||
|
||||
def create_texture(width, height, channels, depth):
|
||||
return None
|
||||
|
||||
def delete_texture(texture):
|
||||
pass
|
||||
|
||||
def upload_texture(texture, view, line_size):
|
||||
pass
|
||||
|
||||
def dowload_texture(texture, view, line_size):
|
||||
pass
|
||||
|
||||
def create_vertex_buffer(size):
|
||||
return None
|
||||
|
||||
def delete_vertex_buffer(buffer):
|
||||
pass
|
||||
|
||||
def upload_vertex_buffer(buffer, view, size):
|
||||
pass
|
||||
66
pygl/texture.py
Normal file
66
pygl/texture.py
Normal file
@ -0,0 +1,66 @@
|
||||
# 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/>.
|
||||
|
||||
import libgl
|
||||
|
||||
class Texture:
|
||||
__slots__ = '_geometry', '_format', '_texture'
|
||||
|
||||
def __init__(self, geometry, format):
|
||||
self._geometry = geometry
|
||||
self._format = format
|
||||
self._texture = libgl.create_texture(geometry.width, geometry.height, format.channels, format.depth)
|
||||
|
||||
def __del__(self):
|
||||
libgl.delete_texture(self._texture)
|
||||
|
||||
@property
|
||||
def geometry(self):
|
||||
return self._geometry
|
||||
|
||||
@property
|
||||
def width(self):
|
||||
return self._geometry._width
|
||||
|
||||
@property
|
||||
def height(self):
|
||||
return self._geometry._height
|
||||
|
||||
@property
|
||||
def ratio(self):
|
||||
return self._geometry._ratio
|
||||
|
||||
@property
|
||||
def format(self):
|
||||
return self._format
|
||||
|
||||
@property
|
||||
def channels(self):
|
||||
return self._format._channels
|
||||
|
||||
@property
|
||||
def depth(self):
|
||||
return self._format._depth
|
||||
|
||||
def upload(self, pixmap):
|
||||
assert (self._format == pixmap.format)
|
||||
assert (self._geometry >= pixmap.geometry)
|
||||
return libgl.upload_texture(self._texture, pixmap.view, pixmap.line_size)
|
||||
|
||||
def download(self, pixmap):
|
||||
assert (self._format == pixmap.format)
|
||||
assert (self._geometry >= pixmap.geometry)
|
||||
return libgl.upload_texture(self._texture, pixmap.view, pixmap.line_size)
|
||||
35
pygl/vertexbuffer.py
Normal file
35
pygl/vertexbuffer.py
Normal file
@ -0,0 +1,35 @@
|
||||
# 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/>.
|
||||
|
||||
import libgl
|
||||
|
||||
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)
|
||||
Reference in New Issue
Block a user