Merged in holtrop/master

This commit is contained in:
xethm55 2012-09-27 23:29:56 -04:00
commit 37120edb73
4 changed files with 44 additions and 0 deletions

View File

@ -0,0 +1,5 @@
void main(void)
{
gl_FragColor = vec4(1.0, 0.1, 0.1, 1.0);
}

View File

@ -0,0 +1,13 @@
uniform mat4 projection;
uniform mat4 modelview;
uniform float scale;
/* pos.xyz is position, pos.w is offset */
attribute vec4 pos;
void main(void)
{
vec3 pos3 = pos.xyz * (scale + pos.w);
gl_Position = projection * modelview * vec4(pos3, 1);
}

View File

@ -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);

View File

@ -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;