OpenGL ES SDK for Android ARM Developer Center
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GroundMesh Class Reference

#include <GroundMesh.h>

Classes

struct  Block
 
struct  DrawInfo
 
struct  InstanceData
 

Public Member Functions

 GroundMesh (unsigned int size, unsigned int levels, float clip_scale)
 
 ~GroundMesh ()
 
void set_frustum (const Frustum &frustum)
 
void update_level_offsets (const vec2 &camera_pos)
 [Snapping clipmap level to a grid] More...
 
const std::vector< vec2 > & get_level_offsets () const
 
void render ()
 [Rendering the entire terrain] More...
 

Private Types

typedef bool(* TrimConditional )(const vec2 &offset)
 

Private Member Functions

void setup_vertex_buffer (unsigned int size)
 
void setup_index_buffer (unsigned int size)
 
void setup_block_ranges (unsigned int size)
 [Generating index buffer] More...
 
void setup_uniform_buffer ()
 
void setup_vertex_array ()
 
void update_draw_list ()
 
void render_draw_list ()
 [Rendering the entire terrain] More...
 
vec2 get_offset_level (const vec2 &camera_pos, unsigned int level)
 [Snapping clipmap level to a grid] More...
 
void update_draw_list (DrawInfo &info, size_t &ubo_offset)
 
DrawInfo get_draw_info_blocks (InstanceData *instance_data)
 
DrawInfo get_draw_info_vert_fixup (InstanceData *instance_data)
 
DrawInfo get_draw_info_horiz_fixup (InstanceData *instance_data)
 
DrawInfo get_draw_info_degenerate (InstanceData *instance_data, const Block &block, const vec2 &offset, const vec2 &ring_offset)
 
DrawInfo get_draw_info_degenerate_left (InstanceData *instance_data)
 
DrawInfo get_draw_info_degenerate_right (InstanceData *instance_data)
 
DrawInfo get_draw_info_degenerate_top (InstanceData *instance_data)
 
DrawInfo get_draw_info_degenerate_bottom (InstanceData *instance_data)
 
DrawInfo get_draw_info_trim_full (InstanceData *instance_data)
 
DrawInfo get_draw_info_trim (InstanceData *instance_data, const Block &block, TrimConditional cond)
 
DrawInfo get_draw_info_trim_top_right (InstanceData *instance_data)
 
DrawInfo get_draw_info_trim_top_left (InstanceData *instance_data)
 
DrawInfo get_draw_info_trim_bottom_right (InstanceData *instance_data)
 
DrawInfo get_draw_info_trim_bottom_left (InstanceData *instance_data)
 
bool intersects_frustum (const vec2 &offset, const vec2 &range, unsigned int level)
 

Private Attributes

GLuint vertex_buffer
 
GLuint index_buffer
 
GLuint vertex_array
 
GLuint uniform_buffer
 
unsigned int size
 
unsigned int level_size
 
unsigned int levels
 
size_t uniform_buffer_size
 
size_t num_indices
 
float clipmap_scale
 
Block block
 
Block vertical
 
Block horizontal
 
Block trim_full
 
Block trim_top_right
 
Block trim_bottom_right
 
Block trim_bottom_left
 
Block trim_top_left
 
Block degenerate_left
 
Block degenerate_top
 
Block degenerate_right
 
Block degenerate_bottom
 
std::vector< DrawInfodraw_list
 
GLint uniform_buffer_align
 
std::vector< vec2level_offsets
 
Frustum view_proj_frustum
 

Detailed Description

Definition at line 30 of file GroundMesh.h.

Member Typedef Documentation

typedef bool(* GroundMesh::TrimConditional)(const vec2 &offset)
private

Definition at line 101 of file GroundMesh.h.

Constructor & Destructor Documentation

GroundMesh::GroundMesh ( unsigned int  size,
unsigned int  levels,
float  clip_scale 
)

Definition at line 31 of file GroundMesh.cpp.

GroundMesh::~GroundMesh ( )

Definition at line 45 of file GroundMesh.cpp.

Member Function Documentation

GroundMesh::DrawInfo GroundMesh::get_draw_info_blocks ( InstanceData instance_data)
private

Definition at line 371 of file GroundMesh.cpp.

GroundMesh::DrawInfo GroundMesh::get_draw_info_degenerate ( InstanceData instance_data,
const Block block,
const vec2 offset,
const vec2 ring_offset 
)
private

Definition at line 204 of file GroundMesh.cpp.

GroundMesh::DrawInfo GroundMesh::get_draw_info_degenerate_bottom ( InstanceData instance_data)
private

Definition at line 256 of file GroundMesh.cpp.

GroundMesh::DrawInfo GroundMesh::get_draw_info_degenerate_left ( InstanceData instance_data)
private

Definition at line 241 of file GroundMesh.cpp.

GroundMesh::DrawInfo GroundMesh::get_draw_info_degenerate_right ( InstanceData instance_data)
private

Definition at line 246 of file GroundMesh.cpp.

GroundMesh::DrawInfo GroundMesh::get_draw_info_degenerate_top ( InstanceData instance_data)
private

Definition at line 251 of file GroundMesh.cpp.

GroundMesh::DrawInfo GroundMesh::get_draw_info_horiz_fixup ( InstanceData instance_data)
private

Definition at line 107 of file GroundMesh.cpp.

GroundMesh::DrawInfo GroundMesh::get_draw_info_trim ( InstanceData instance_data,
const Block block,
TrimConditional  cond 
)
private

Definition at line 287 of file GroundMesh.cpp.

GroundMesh::DrawInfo GroundMesh::get_draw_info_trim_bottom_left ( InstanceData instance_data)
private

Definition at line 365 of file GroundMesh.cpp.

GroundMesh::DrawInfo GroundMesh::get_draw_info_trim_bottom_right ( InstanceData instance_data)
private

Definition at line 360 of file GroundMesh.cpp.

GroundMesh::DrawInfo GroundMesh::get_draw_info_trim_full ( InstanceData instance_data)
private

Definition at line 262 of file GroundMesh.cpp.

GroundMesh::DrawInfo GroundMesh::get_draw_info_trim_top_left ( InstanceData instance_data)
private

Definition at line 355 of file GroundMesh.cpp.

GroundMesh::DrawInfo GroundMesh::get_draw_info_trim_top_right ( InstanceData instance_data)
private

Definition at line 350 of file GroundMesh.cpp.

GroundMesh::DrawInfo GroundMesh::get_draw_info_vert_fixup ( InstanceData instance_data)
private

Definition at line 160 of file GroundMesh.cpp.

const std::vector<vec2>& GroundMesh::get_level_offsets ( ) const
inline

Definition at line 38 of file GroundMesh.h.

vec2 GroundMesh::get_offset_level ( const vec2 camera_pos,
unsigned int  level 
)
private

[Snapping clipmap level to a grid]

Definition at line 56 of file GroundMesh.cpp.

bool GroundMesh::intersects_frustum ( const vec2 offset,
const vec2 range,
unsigned int  level 
)
private

Definition at line 444 of file GroundMesh.cpp.

void GroundMesh::render ( )

[Rendering the entire terrain]

[Render scene]

Definition at line 575 of file GroundMesh.cpp.

void GroundMesh::render_draw_list ( )
private

[Rendering the entire terrain]

Definition at line 556 of file GroundMesh.cpp.

void GroundMesh::set_frustum ( const Frustum frustum)
inline

Definition at line 36 of file GroundMesh.h.

void GroundMesh::setup_block_ranges ( unsigned int  size)
private

[Generating index buffer]

Definition at line 229 of file GroundMeshSetup.cpp.

void GroundMesh::setup_index_buffer ( unsigned int  size)
private

Definition at line 250 of file GroundMeshSetup.cpp.

void GroundMesh::setup_uniform_buffer ( )
private

Definition at line 405 of file GroundMeshSetup.cpp.

void GroundMesh::setup_vertex_array ( )
private

Definition at line 421 of file GroundMeshSetup.cpp.

void GroundMesh::setup_vertex_buffer ( unsigned int  size)
private

[Generating vertex buffer]

[Generating vertex buffer]

Definition at line 27 of file GroundMeshSetup.cpp.

void GroundMesh::update_draw_list ( )
private

Definition at line 482 of file GroundMesh.cpp.

void GroundMesh::update_draw_list ( DrawInfo info,
size_t &  ubo_offset 
)
private

Definition at line 473 of file GroundMesh.cpp.

void GroundMesh::update_level_offsets ( const vec2 camera_pos)

[Snapping clipmap level to a grid]

Definition at line 81 of file GroundMesh.cpp.

Member Data Documentation

Block GroundMesh::block
private

Definition at line 68 of file GroundMesh.h.

float GroundMesh::clipmap_scale
private

Definition at line 50 of file GroundMesh.h.

Block GroundMesh::degenerate_bottom
private

Definition at line 79 of file GroundMesh.h.

Block GroundMesh::degenerate_left
private

Definition at line 76 of file GroundMesh.h.

Block GroundMesh::degenerate_right
private

Definition at line 78 of file GroundMesh.h.

Block GroundMesh::degenerate_top
private

Definition at line 77 of file GroundMesh.h.

std::vector<DrawInfo> GroundMesh::draw_list
private

Definition at line 96 of file GroundMesh.h.

Block GroundMesh::horizontal
private

Definition at line 70 of file GroundMesh.h.

GLuint GroundMesh::index_buffer
private

Definition at line 43 of file GroundMesh.h.

std::vector<vec2> GroundMesh::level_offsets
private

Definition at line 99 of file GroundMesh.h.

unsigned int GroundMesh::level_size
private

Definition at line 45 of file GroundMesh.h.

unsigned int GroundMesh::levels
private

Definition at line 46 of file GroundMesh.h.

size_t GroundMesh::num_indices
private

Definition at line 48 of file GroundMesh.h.

unsigned int GroundMesh::size
private

Definition at line 44 of file GroundMesh.h.

Block GroundMesh::trim_bottom_left
private

Definition at line 74 of file GroundMesh.h.

Block GroundMesh::trim_bottom_right
private

Definition at line 73 of file GroundMesh.h.

Block GroundMesh::trim_full
private

Definition at line 71 of file GroundMesh.h.

Block GroundMesh::trim_top_left
private

Definition at line 75 of file GroundMesh.h.

Block GroundMesh::trim_top_right
private

Definition at line 72 of file GroundMesh.h.

GLuint GroundMesh::uniform_buffer
private

Definition at line 43 of file GroundMesh.h.

GLint GroundMesh::uniform_buffer_align
private

Definition at line 97 of file GroundMesh.h.

size_t GroundMesh::uniform_buffer_size
private

Definition at line 47 of file GroundMesh.h.

GLuint GroundMesh::vertex_array
private

Definition at line 43 of file GroundMesh.h.

GLuint GroundMesh::vertex_buffer
private

Definition at line 43 of file GroundMesh.h.

Block GroundMesh::vertical
private

Definition at line 69 of file GroundMesh.h.

Frustum GroundMesh::view_proj_frustum
private

Definition at line 122 of file GroundMesh.h.


The documentation for this class was generated from the following files: