Class cocos.grid.Grid3D

GridBase --+
           |
          Grid3D

Grid3D is a 3D grid implementation. Each vertex has 3 dimensions: x,y,z

The vindexed ertex array will be built with:

self.vertex_list.vertices: x,y,z (floats)
self.vertex_list.tex_coords: x,y,z (floats)
self.vertex_list.colors: RGBA, with values from 0 - 255

Methods

(float, float, float) get_vertex(self, x, y)
Get the current vertex coordinate
(float, float, float) get_original_vertex(self, x, y)
Get the original vertex coordinate.
  set_vertex(self, x, y, v)
Set a vertex point is a certain value
  __init__(self) (Inherited from cocos.grid.GridBase)
  after_draw(self, camera)
Called by CocosNode when the texture is already grabbed.
(Inherited from cocos.grid.GridBase)
  before_draw(self)
Binds the framebuffer to a texture and set a 2d projection before binding to prevent calculating a new texture
(Inherited from cocos.grid.GridBase)
  init(self, grid)
Initializes the grid creating both a vertex_list for an independent-tiled grid and creating also a vertex_list_indexed for a "united" (non independent tile) grid.
(Inherited from cocos.grid.GridBase)

Properties

  active
Determines whether the grid is active or not :type: bool
(Inherited from cocos.grid.GridBase)

Instance Variables

  vertex_list
indexed vertex array that can be transformed.
  vertex_points
original vertex array of the grid.
  grid
size of the grid.
(Inherited from cocos.grid.GridBase)
  x_step
x pixels between each vertex (float)
(Inherited from cocos.grid.GridBase)
  y_step
y pixels between each vertex (float)
(Inherited from cocos.grid.GridBase)

Class Variables

  texture = None (Inherited from cocos.grid.GridBase)

Method Details

get_vertex

get_vertex(self, x, y)
Get the current vertex coordinate
Parameters:
x : int
x-vertex
y : int
y-vertex
Returns: (float, float, float)

get_original_vertex

get_original_vertex(self, x, y)
Get the original vertex coordinate. The original vertices are the ones weren't modified by the current action.
Parameters:
x : int
x-vertex
y : int
y-vertex
Returns: (float, float, float)

set_vertex

set_vertex(self, x, y, v)
Set a vertex point is a certain value
Parameters:
x : int
x-vertex
y : int
y-vertex
v : (float, float, float)
tuple value for the vertex

Instance Variable Details

vertex_list

indexed vertex array that can be transformed. it has these attributes:

  • vertices
  • colors
  • tex_coords

for more information refer to pyglet's documentation: pyglet.graphics.vertex_list_indexed

vertex_points

original vertex array of the grid. (read-only)