Skip to content
This repository has been archived by the owner on Dec 23, 2018. It is now read-only.

Commit

Permalink
Improve docs.
Browse files Browse the repository at this point in the history
Docs are still pretty bad, but this is at least an
improvement.
  • Loading branch information
adamlwgriffiths committed Mar 25, 2013
1 parent a621364 commit 89f6e11
Show file tree
Hide file tree
Showing 3 changed files with 80 additions and 40 deletions.
57 changes: 51 additions & 6 deletions docs/source/api_rendering.rst
Expand Up @@ -3,17 +3,62 @@
Rendering
*********

.. _sorter:
.. _api_rendering_gl:

Sorting
OpenGL
======

.. automodule:: pygly.gl
:members:
:undoc-members:


.. _api_rendering_shaders:

Shaders
=======

.. automodule:: pygly.sorter
.. automodule:: pygly.shader
:members:
:undoc-members:


.. _api_rendering_buffers:

Buffers
=======

.. automodule:: pygly.buffer
:members:
:undoc-members:


.. automodule:: pygly.vertex_array
:members:
:undoc-members:


.. seealso::
Class :py:class:`pygly.render_node.RenderNode`
Documentation of the :py:class:`pygly.render_node.RenderNode` class, the parent of this class.
.. _api_rendering_texturing:

Texturing
=========

.. automodule:: pygly.texture
:members:
:undoc-members:

.. automodule:: pygly.pil_texture
:members:
:undoc-members:



.. _api_rendering_sorter:

Sorting
=======

.. automodule:: pygly.sort
:members:
:undoc-members:

2 changes: 2 additions & 0 deletions pygly/numpy_utils.py
Expand Up @@ -17,6 +17,8 @@ def dtype_offset( dtype, name = None ):
"""Returns the initial offset of the named property.
If no name is given, 0 is returned.
:raise KeyError: Raised if the specified name is not found.
"""
if name:
# get the dtype for the named value
Expand Down
61 changes: 27 additions & 34 deletions pygly/sort.py
@@ -1,7 +1,3 @@
'''
.. moduleauthor:: Adam Griffiths <adam.lw.griffiths@gmail.com>
'''

import numpy

import pyrr
Expand All @@ -18,15 +14,14 @@ def sort_plane_front_to_back(
Sorts objects based upon their dot product value along
the camera direction.
Args:
render_position: The position of the camera the scene
:param numpy.array render_position: The position of the camera the scene
is being rendered from.
render_direction: The direction the camera is facing.
objects: List of objects to be sorted.
object_positions: List of object positions. These values
:param numpy.array render_direction: The direction the camera is facing.
:param list objects: List of objects to be sorted.
:param list object_positions: List of object positions. These values
map directly to the objects list.
Returns:
Returns a sorted list containing the objects.
:rtype: numpy.array
:return: A sorted list containing the objects.
"""
if len( object_positions ) <= 0:
return numpy.empty( 0 )
Expand Down Expand Up @@ -63,15 +58,14 @@ def sort_plane_back_to_front(
Sorts objects based upon their dot product value along
the camera direction.
Args:
render_position: The position of the camera the scene
:param numpy.array render_position: The position of the camera the scene
is being rendered from.
render_direction: The direction the camera is facing.
objects: List of objects to be sorted.
object_positions: List of object positions. These values
:param numpy.array render_direction: The direction the camera is facing.
:param list objects: List of objects to be sorted.
:param list object_positions: List of object positions. These values
map directly to the objects list.
Returns:
Returns a sorted list containing the objects.
:rtype: numpy.array
:return: A sorted list containing the objects.
"""
# sort front to back
sorted_objects = sort_plane_front_to_back(
Expand All @@ -93,15 +87,14 @@ def sort_radius_front_to_back(
"""Sorts objects from front to back based on their distance
from the camera.
Args:
render_position: The position of the camera the scene
is being rendered from.
render_direction: The direction the camera is facing.
objects: List of objects to be sorted.
object_positions: List of object positions. These values
map directly to the objects list.
Returns:
Returns a sorted list containing the objects.
:param numpy.array render_position: The position of the camera the scene
is being rendered from.
:param numpy.array render_direction: The direction the camera is facing.
:param list objects: List of objects to be sorted.
:param list object_positions: List of object positions. These values
map directly to the objects list.
:rtype: numpy.array
:return: A sorted list containing the objects.
If no objects are passed, an empty numpy array is returned.
"""
if len( object_positions ) <= 0:
Expand Down Expand Up @@ -137,15 +130,15 @@ def sort_radius_back_to_front(
"""Sorts objects from back to front based on their distance
from the camera.
Args:
render_position: The position of the camera the scene
:param numpy.array render_position: The position of the camera the scene
is being rendered from.
render_direction: The direction the camera is facing.
objects: List of objects to be sorted.
object_positions: List of object positions. These values
:param numpy.array render_direction: The direction the camera is facing.
:param list objects: List of objects to be sorted.
:param list object_positions: List of object positions. These values
map directly to the objects list.
Returns:
Returns a sorted list containing the objects.
:rtype: numpy.array
:return: A sorted list containing the objects.
If no objects are passed, an empty numpy array is returned.
"""
# sort front to back
sorted_objects = sort_radius_front_to_back(
Expand Down

0 comments on commit 89f6e11

Please sign in to comment.