add shot-ring shader and create shot-ring attributes buffer
This commit is contained in:
1 parent
ba0bc9b77d
commit
741a325a5f
4 files changed
+44
No files matched your search
@@ -17,6 +17,8 @@ using namespace std;
|
||||
#define SKY_DIST 2000
|
||||
#define NUM_SKY_STEPS 9
|
||||
#define LAVA_SIZE 100
|
||||
#define SHOT_RING_WIDTH 20.0f
|
||||
#define NUM_SHOT_RING_STEPS 24
|
||||
|
||||
/* points of a horizontal hexagon 1.0 units high */
|
||||
static const float overlay_hex_attributes[][3] = {
|
||||
@@ -183,6 +185,29 @@ bool Client::initgl()
|
||||
cerr << "Error creating sky attribute buffer" << endl;
|
||||
return false;
|
||||
}
|
||||
vector<GLfloat> shot_ring_attributes((NUM_SHOT_RING_STEPS + 1) * 2 * 4);
|
||||
for (int i = 0, idx = 0; i <= NUM_SHOT_RING_STEPS; i++)
|
||||
{
|
||||
double angle = i * M_PI * 2.0 / NUM_SHOT_RING_STEPS;
|
||||
GLfloat x = sin(angle);
|
||||
GLfloat y = cos(angle);
|
||||
shot_ring_attributes[idx++] = x;
|
||||
shot_ring_attributes[idx++] = y;
|
||||
shot_ring_attributes[idx++] = 0.0f;
|
||||
shot_ring_attributes[idx++] = 0.0f;
|
||||
|
||||
shot_ring_attributes[idx++] = x;
|
||||
shot_ring_attributes[idx++] = y;
|
||||
shot_ring_attributes[idx++] = 0.0f;
|
||||
shot_ring_attributes[idx++] = SHOT_RING_WIDTH;
|
||||
}
|
||||
if (!m_shot_ring_attributes.create(GL_ARRAY_BUFFER, GL_STATIC_DRAW,
|
||||
&shot_ring_attributes[0],
|
||||
sizeof(shot_ring_attributes[0]) * shot_ring_attributes.size()))
|
||||
{
|
||||
cerr << "Error creating shot ring attributes buffer" << endl;
|
||||
return false;
|
||||
}
|
||||
unsigned int lava_texture_length;
|
||||
const uint8_t *lava_texture = CFS.get_file("textures/lava.jpg",
|
||||
&lava_texture_length);
|
||||
|
||||
@@ -52,6 +52,7 @@ class Client
|
||||
GLBuffer m_sky_attributes;
|
||||
GLBuffer m_tex_quad_attributes;
|
||||
GLBuffer m_quad_attributes;
|
||||
GLBuffer m_shot_ring_attributes;
|
||||
refptr<Network> m_net_client;
|
||||
bool client_has_focus;
|
||||
sf::Texture m_lava_texture;
|
||||
|
||||
Reference in new issue
Block a user