[Change] Single GLUQuadric object.
[Fix?] Was meant to have fixed laser drawing, I kinda failed. :D
This commit is contained in:
parent
c88dfe6703
commit
415b111735
@ -75,6 +75,7 @@ public:
|
|||||||
static SpaceStationView* spaceStationView;
|
static SpaceStationView* spaceStationView;
|
||||||
|
|
||||||
static ShipCpanel* cpan;
|
static ShipCpanel* cpan;
|
||||||
|
static GLUquadric* gluQuadric;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static void InitOpenGL(void);
|
static void InitOpenGL(void);
|
||||||
|
@ -43,6 +43,7 @@ StarSystem* L3D::selected_system;
|
|||||||
MTRand L3D::rng;
|
MTRand L3D::rng;
|
||||||
double L3D::gameTime;
|
double L3D::gameTime;
|
||||||
float L3D::frameTime;
|
float L3D::frameTime;
|
||||||
|
GLUquadric* L3D::gluQuadric;
|
||||||
|
|
||||||
void L3D::Init(IniConfig& config) {
|
void L3D::Init(IniConfig& config) {
|
||||||
int width = config.Int("ScrWidth");
|
int width = config.Int("ScrWidth");
|
||||||
@ -104,6 +105,8 @@ void L3D::InitOpenGL() {
|
|||||||
|
|
||||||
glClearColor(0, 0, 0, 0);
|
glClearColor(0, 0, 0, 0);
|
||||||
glViewport(0, 0, scrWidth, scrHeight);
|
glViewport(0, 0, scrWidth, scrHeight);
|
||||||
|
|
||||||
|
gluQuadric = gluNewQuadric();
|
||||||
}
|
}
|
||||||
|
|
||||||
void L3D::Quit(void) {
|
void L3D::Quit(void) {
|
||||||
@ -234,9 +237,6 @@ void L3D::MainLoop(void) {
|
|||||||
|
|
||||||
SetView(world_view);
|
SetView(world_view);
|
||||||
|
|
||||||
GLUquadric* quad = gluNewQuadric();
|
|
||||||
gluQuadricOrientation(quad, GLU_INSIDE);
|
|
||||||
|
|
||||||
Uint32 last_stats = SDL_GetTicks();
|
Uint32 last_stats = SDL_GetTicks();
|
||||||
int frame_stat = 0;
|
int frame_stat = 0;
|
||||||
char fps_readout[32];
|
char fps_readout[32];
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#include "libs.h"
|
#include "libs.h"
|
||||||
#include "planet.h"
|
#include "planet.h"
|
||||||
#include "frame.h"
|
#include "frame.h"
|
||||||
|
#include "l3d.h"
|
||||||
|
|
||||||
Planet::Planet(StarSystem::SBody::SubType subtype) : Body() {
|
Planet::Planet(StarSystem::SBody::SubType subtype) : Body() {
|
||||||
m_radius = 6378135.0;
|
m_radius = 6378135.0;
|
||||||
@ -33,10 +34,6 @@ void Planet::SetRadius(double radius) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Planet::Render(const Frame* a_camFrame) {
|
void Planet::Render(const Frame* a_camFrame) {
|
||||||
static GLUquadricObj* qobj = NULL;
|
|
||||||
|
|
||||||
if(!qobj) qobj = gluNewQuadric();
|
|
||||||
|
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
glDisable(GL_DEPTH_TEST);
|
glDisable(GL_DEPTH_TEST);
|
||||||
|
|
||||||
@ -63,7 +60,7 @@ void Planet::Render(const Frame* a_camFrame) {
|
|||||||
glEnd();
|
glEnd();
|
||||||
glEnable(GL_LIGHTING);
|
glEnable(GL_LIGHTING);
|
||||||
} else {
|
} else {
|
||||||
gluSphere(qobj, rad, 100, 100);
|
gluSphere(L3D::gluQuadric, rad, 100, 100);
|
||||||
}
|
}
|
||||||
glEnable(GL_DEPTH_TEST);
|
glEnable(GL_DEPTH_TEST);
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
|
@ -29,21 +29,10 @@ SectorView::SectorView(void) : GenericSystemView() {
|
|||||||
m_zoomOutButton->SetShortcut(SDLK_F8, KMOD_NONE);
|
m_zoomOutButton->SetShortcut(SDLK_F8, KMOD_NONE);
|
||||||
m_rightButtonBar->Add(m_zoomOutButton, 66, 2);
|
m_rightButtonBar->Add(m_zoomOutButton, 66, 2);
|
||||||
|
|
||||||
GLUquadricObj* qobj = gluNewQuadric();
|
|
||||||
|
|
||||||
/*
|
|
||||||
m_gluSphereDlist = glGenLists(1);
|
|
||||||
glNewList(m_gluSphereDlist, GL_COMPILE);
|
|
||||||
gluDisk(qobj, 0.0, 0.2, 32, 1);
|
|
||||||
glEndList();
|
|
||||||
*/
|
|
||||||
|
|
||||||
m_gluDiskDlist = glGenLists(1);
|
m_gluDiskDlist = glGenLists(1);
|
||||||
glNewList(m_gluDiskDlist, GL_COMPILE);
|
glNewList(m_gluDiskDlist, GL_COMPILE);
|
||||||
gluDisk(qobj, 0.0, 0.2, 20, 1);
|
gluDisk(L3D::gluQuadric, 0.0, 0.2, 20, 1);
|
||||||
glEndList();
|
glEndList();
|
||||||
|
|
||||||
gluDeleteQuadric(qobj);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SectorView::~SectorView(void) {
|
SectorView::~SectorView(void) {
|
||||||
|
@ -137,5 +137,9 @@ void Ship::Render(const Frame* camFrame) {
|
|||||||
strncpy(params.pText[0], GetLabel().c_str(), sizeof(params.pText));
|
strncpy(params.pText[0], GetLabel().c_str(), sizeof(params.pText));
|
||||||
|
|
||||||
RenderSbreModel(camFrame, stype.sbreModel, ¶ms);
|
RenderSbreModel(camFrame, stype.sbreModel, ¶ms);
|
||||||
|
glPushMatrix();
|
||||||
|
TransformToModelCoords(camFrame);
|
||||||
|
RenderLaserfire();
|
||||||
|
glPopMatrix();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#include "libs.h"
|
#include "libs.h"
|
||||||
#include "star.h"
|
#include "star.h"
|
||||||
|
#include "l3d.h"
|
||||||
|
|
||||||
Star::Star(StarSystem::SBody::SubType subtype): Body() {
|
Star::Star(StarSystem::SBody::SubType subtype): Body() {
|
||||||
m_subtype = subtype;
|
m_subtype = subtype;
|
||||||
@ -21,10 +22,6 @@ void Star::TransformToModelCoords(const Frame* camFrame) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Star::Render(const Frame* a_camFrame) {
|
void Star::Render(const Frame* a_camFrame) {
|
||||||
static GLUquadricObj* qobj = NULL;
|
|
||||||
|
|
||||||
if(!qobj) qobj = gluNewQuadric();
|
|
||||||
|
|
||||||
glDisable(GL_LIGHTING);
|
glDisable(GL_LIGHTING);
|
||||||
glDisable(GL_DEPTH_TEST);
|
glDisable(GL_DEPTH_TEST);
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
@ -44,7 +41,7 @@ void Star::Render(const Frame* a_camFrame) {
|
|||||||
|
|
||||||
//TransformToModelCoords(a_camFrame);
|
//TransformToModelCoords(a_camFrame);
|
||||||
glColor3fv(StarSystem::starColors[m_subtype]);
|
glColor3fv(StarSystem::starColors[m_subtype]);
|
||||||
gluSphere(qobj, rad, 100, 100);
|
gluSphere(L3D::gluQuadric, rad, 100, 100);
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
glEnable(GL_DEPTH_TEST);
|
glEnable(GL_DEPTH_TEST);
|
||||||
glEnable(GL_LIGHTING);
|
glEnable(GL_LIGHTING);
|
||||||
|
Loading…
Reference in New Issue
Block a user