Skip to content

Commit b6a6cdc

Browse files
committed
Now includes generated make/proj files, other small changes
1 parent b4215c0 commit b6a6cdc

File tree

13 files changed

+80
-63
lines changed

13 files changed

+80
-63
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,5 @@ bin/log.txt
44
bin/*.exe
55
bin/*.dll
66
bin/*.so
7+
obj/*
8+
build/obj/*

bin/data/base/shaders/bump.fp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ void main(void)
4444
if(shine > EPSILON)
4545
{
4646
shine = 1.0 / shine;
47-
specular = pow(clamp(dot(reflect(-eye, bump), light), 0.0, 1.0), shine) * 1.0;
47+
specular = pow(clamp(dot(reflect(-eye, bump), light), 0.0, 1.0), shine) * 0.5; // 1.0
4848
}
4949
else
5050
specular = 0.0f;
@@ -79,12 +79,12 @@ void main(void)
7979
else
8080
atten_frag = 1.0;
8181

82-
/*vec4 fog_color = vec4(0.0, 0.0, 0.0, 1.0);*/
83-
/*float fog_factor = eye_dist / 20.0f;*/
82+
vec4 fog_color = vec4(0.0, 0.0, 0.0, 1.0);
83+
float fog_factor = eye_dist / 20.0f;
84+
85+
vec4 lit = color_frag * occ * atten_frag * lightcolor;
8486

85-
vec4 lit = color_frag * occ * atten_frag * lightcolor;
86-
87-
gl_FragColor = lit;
88-
/*gl_FragColor = mix(lit, fog_color, clamp(fog_factor,0.0,1.0));*/
87+
/*gl_FragColor = lit;*/
88+
gl_FragColor = mix(lit, fog_color, clamp(fog_factor,0.0,1.0));
8989
}
9090

build.sh

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
#!/bin/bash
22

3-
rm bin/qor
3+
rm bin/qor > /dev/null
4+
5+
# generate project/make files
6+
premake4 vs2010 > /dev/null
47
premake4 gmake > /dev/null
5-
pushd build > /dev/null
8+
9+
# run native make file
610
make 2>&1
7-
popd
11+

premake4.lua

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
solution("qor")
22
configurations {"Debug", "Release"}
33

4-
location("build")
54
targetdir("bin")
65

76
configuration "Debug"

src/Actor.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Actor::Actor(Input* input)
1313
m_fAccel = 80.0f;
1414
m_fDecel = 20.0f;
1515
m_fRadius = 0.3f;
16-
m_fHeight = 2.0f, // 1.6
16+
m_fHeight = 1.6f, // 2.0
1717
m_fJumpAccel = 100.0f;
1818
m_fJumpLength = 1.0f/16.0f;
1919
m_fJumpForce = m_fJumpLength;

src/Console.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
class Console : public IFallible
1212
{
13-
static const int FONT_HEIGHT = 18;
13+
static const int FONT_HEIGHT = 10;
1414

1515
//Font* m_pFont;
1616
std::shared_ptr<FTGLPixmapFont> m_spFont;

src/EulerNode.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,9 @@ void EulerNode :: tilt(float deg)
154154

155155
glm::vec3 EulerNode :: getRotationHeading() const
156156
{
157-
if(floatcmp(abs(m_pitch.degrees()), 90.0f))
157+
if(floatcmp(m_pitch.degrees(), 90.0f))
158+
return -Matrix::upXZ(*matrix_c());
159+
else if(floatcmp(m_pitch.degrees(), -90.0f))
158160
return Matrix::upXZ(*matrix_c());
159161
return Matrix::headingXZ(*matrix_c());
160162
// return matrix_c()->up().XZ().unit();

src/Light.h

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,12 @@ class Light : public Node
2121
Light():
2222
m_Type(POINT),
2323
m_Atten(glm::vec3(1.0f, 0.0f, 0.0f))
24-
{}
24+
{
25+
// TODO: Use light cutoffs for AABB, instead of temp:
26+
m_Box.min = glm::vec3(-0.5f);
27+
m_Box.max = glm::vec3(0.5f);
28+
}
29+
virtual ~Light() {}
2530

2631
// bind: to be called only by Scene during a render
2732
// id is generated at time of render and may change!
@@ -99,6 +104,9 @@ class Light : public Node
99104

100105
virtual SCOPED_ENUM_TYPE(NodeType) nodeType() const { return NodeType::LIGHT; }
101106
virtual std::string nodeTypeString() const { return "light"; }
107+
108+
virtual const AABB* box(unsigned int flags = 0) const { return &m_Box; }
109+
virtual AABB* box(unsigned int flags = 0) { return &m_Box; }
102110

103111
private:
104112

@@ -107,6 +115,8 @@ class Light : public Node
107115
Color m_Specular;
108116
glm::vec3 m_Atten; // c, l, q
109117
Type m_Type;
118+
119+
AABB m_Box;
110120
};
111121

112122
#endif

src/Node.cpp

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -178,14 +178,20 @@ void Node :: render(Partitioner* partitioner, unsigned int flags) const
178178
// glMultMatrixf(glm::value_ptr(*matrix_c()));
179179
//else
180180
//{
181-
glm::mat4 modelview = *Renderer::get().getViewMatrix() * *matrix_c(S_WORLD);
182-
glLoadMatrixf(glm::value_ptr(modelview));
181+
//
183182
//}
184183
//glMultMatrixf(glm::value_ptr(*matrix_c()));
184+
if(flags & RENDER_USE_STACK)
185+
glMultMatrixf(glm::value_ptr(*matrix_c()));
185186

186187
// render self
187-
if(visible() && (!hasAttribute(NodeAttributes::SIZE) || inView(partitioner)))
188+
if(visible() && (!hasAttribute(NodeAttributes::SIZE) || inView(partitioner))) {
189+
if(!(flags & RENDER_USE_STACK)) {
190+
glm::mat4 modelview = *Renderer::get().getViewMatrix() * *matrix_c(S_WORLD);
191+
glLoadMatrixf(glm::value_ptr(modelview));
192+
}
188193
renderSelf(partitioner, flags);
194+
}
189195

190196
// render children
191197
if(!(flags & RENDER_SELF_ONLY))

src/Node.h

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,11 @@
1-
/**
2-
* @file Node.h
3-
* @author Grady O'Connell <grady <at> prolificaxis <dot> com>
1+
/*
2+
* Node.h
43
*
5-
* @section LICENSE
6-
*
7-
* For internal use only. Do not redistribute.
8-
* © 2011 Prolific Axis, LLC
9-
*
10-
* @section DESCRIPTION
11-
*
12-
* Basic Node Class
13-
* Connects to a parent to store hierarchal transformations
14-
* Handles children using a simple list (no smart ordering or partioning)
15-
* Handles position and transformation through a 4x4 Matrix.
16-
* Transform can be changed (to Euler or Quat, perhaps) by overloading matrix[_c]() accessors
17-
*/
18-
4+
* - Connects to a parent to store hierarchal transformations
5+
* - Handles children using a simple list (no smart ordering or partioning)
6+
* - Handles position and transformation through a 4x4 Matrix.
7+
* - Transform can be changed (to Euler or Quat, perhaps) by overloading matrix[_c]() accessors
8+
*/
199

2010
#ifndef _NODE_H
2111
#define _NODE_H
@@ -211,8 +201,9 @@ class Node : public std::enable_shared_from_this<Node>
211201
enum eRenderFlags
212202
{
213203
RENDER_USE_STACK=BIT(0),
214-
RENDER_SELF_ONLY=BIT(1)
215-
//RENDER_AMBIENT_PASS=BIT(2)
204+
RENDER_SELF_ONLY=BIT(1),
205+
RENDER_AMBIENT_PASS=BIT(2),
206+
RENDER_INDICATORS=BIT(3)
216207
};
217208
virtual void renderSelf(Partitioner* partitioner = NULL, unsigned int flags = 0) const;
218209
virtual void render(Partitioner* partitioner = NULL, unsigned int flags = 0) const;

src/Scene.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -480,7 +480,7 @@ void Scene::render(Node* from) const
480480
// initial pass
481481
// TODO: bind an ambient shader here!
482482
glDisable(GL_BLEND);
483-
m_spRoot->render(m_spPartitioner.get());
483+
m_spRoot->render(m_spPartitioner.get(), Node::RENDER_AMBIENT_PASS);
484484

485485
if(Renderer::get().lighting()) { // do multi-pass only if lighting is enabled
486486
// multi-pass light rendering utilizing partitioner

src/editor/SelectorNode.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,10 @@ void SelectorNode :: logicSelf(unsigned int advance)
1212

1313
void SelectorNode :: renderSelf(Frustum* view, unsigned int flags) const
1414
{
15-
//if(!(flags & RENDER_AMBIENT_PASS))
16-
// return;
15+
if(!(flags & RENDER_AMBIENT_PASS))
16+
return;
17+
if(!(flags & RENDER_INDICATORS))
18+
return;
1719

1820
glDisable(GL_DEPTH_TEST);
1921

src/game/GameState.cpp

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ GameState::GameState(Engine* engine, TransitionInfo* trans)
1111
nullify();
1212
m_pEngine = engine;
1313

14-
m_pScene = new Scene("data/ne/maps/Apartment/apartment_scene.obj", Scene::F_PHYSICS);
14+
m_pScene = new Scene("data/ne/maps/gothicTower/gothicTower.obj", Scene::F_PHYSICS);
1515
//m_pScene = new Scene("testmap.fml", Scene::F_PHYSICS);
1616
//m_pScene = new Scene("data/maps/office/ctf_office.obj");
1717

@@ -28,8 +28,8 @@ GameState::GameState(Engine* engine, TransitionInfo* trans)
2828
//n = m_pScene->loadAI("data/assets/tree1.obj");
2929
//n->move(glm::vec3(-20.0, 0.0, 0.0));
3030

31-
n = m_pScene->loadAI("data/ne/environment/officebuilding.obj");
32-
n->move(glm::vec3(20.0, 0.0, 0.0));
31+
//n = m_pScene->loadAI("data/ne/environment/officebuilding.obj");
32+
//n->move(glm::vec3(20.0, 0.0, 0.0));
3333

3434
//for(int i=0; i<10; i++)
3535
// for(int j=0; j<10; j++)
@@ -53,8 +53,8 @@ GameState::GameState(Engine* engine, TransitionInfo* trans)
5353
);
5454

5555
//glm::vec3 gunpos = glm::vec3(0.15f,-0.2f,-0.4f);//glock
56-
//glm::vec3 gunpos = glm::vec3(0.15f,-0.3f,-0.5f);
57-
glm::vec3 gunpos = glm::vec3(0.0f,-0.25f,-0.2f); // ADS
56+
glm::vec3 gunpos = glm::vec3(0.15f,-0.3f,-0.5f);//ump45
57+
//glm::vec3 gunpos = glm::vec3(0.0f,-0.25f,-0.2f); //ump45 ADS
5858
*e->matrix() = glm::gtx::transform2::lookAt(glm::vec3(0.0f), glm::vec3(0.0, 0.0f, -1000.0f) - gunpos, Axis::Y);
5959
//Matrix::translation(*e->matrix(), glm::vec3(0.2f,-0.25f,-0.4f));
6060
Matrix::translation(*e->matrix(), gunpos);
@@ -92,11 +92,12 @@ GameState::GameState(Engine* engine, TransitionInfo* trans)
9292
// end particle system demo
9393

9494
Light* light;
95-
// add three lights
95+
//// add three lights
9696
m_pScene->add(light = new Light());
9797
light->lightType(Light::DIRECTIONAL);
9898
light->atten(glm::vec3(1.0f, 0.0f, 0.0f));
99-
light->diffuse(Color(0.2f, 0.1f, 0.6f));
99+
light->diffuse(Color((ubyte)0xDC, (ubyte)0xCD, (ubyte)0xFF));
100+
light->specular(Color(0.0f,0.0f,0.0f));
100101

101102
// Colored Lights Demo
102103
//m_pScene->add(light = new Light());
@@ -115,22 +116,22 @@ GameState::GameState(Engine* engine, TransitionInfo* trans)
115116
//light->diffuse(Color(0.5f, 0.4f, 0.3f));
116117

117118
// Other colors demo
118-
//m_pScene->add(light = new Light());
119-
//light->move(glm::vec3(-2.5f, 0.0, -5.0f));
120-
//light->diffuse(Color(0.8f, 0.4f, 0.6f));
121-
//light->atten(glm::vec3(0.0f, 0.0f, 0.5f));
122-
//m_pScene->add(light = new Light());
123-
//light->move(glm::vec3(2.5f, 0.0, -5.0f));
124-
//light->diffuse(Color(0.0f, 0.5f, 0.5f));
125-
//light->atten(glm::vec3(0.0f, 0.0f, 0.5f));
126-
//m_pScene->add(light = new Light());
127-
//light->move(glm::vec3(-5.0f, 0.0, -5.0f));
128-
//light->diffuse(Color(0.1f, 0.1f, 0.3f));
129-
//light->atten(glm::vec3(0.0f, 0.0f, 0.5f));
130-
//m_pScene->add(light = new Light());
131-
//light->move(glm::vec3(5.0f, 0.0, -5.0f));
132-
//light->diffuse(Color(0.3f, 0.0f, 0.1f));
133-
//light->atten(glm::vec3(0.0f, 0.0f, 0.5f));
119+
m_pScene->add(light = new Light());
120+
light->move(glm::vec3(-2.5f, 0.0, -5.0f));
121+
light->diffuse(Color(0.8f, 0.4f, 0.6f));
122+
light->atten(glm::vec3(0.0f, 0.0f, 0.1f));
123+
m_pScene->add(light = new Light());
124+
light->move(glm::vec3(2.5f, 0.0, -5.0f));
125+
light->diffuse(Color(0.0f, 0.5f, 0.5f));
126+
light->atten(glm::vec3(0.0f, 0.0f, 0.1f));
127+
m_pScene->add(light = new Light());
128+
light->move(glm::vec3(-5.0f, 0.0, -5.0f));
129+
light->diffuse(Color(0.1f, 0.1f, 0.3f));
130+
light->atten(glm::vec3(0.0f, 0.0f, 0.1f));
131+
m_pScene->add(light = new Light());
132+
light->move(glm::vec3(5.0f, 0.0, -5.0f));
133+
light->diffuse(Color(0.3f, 0.0f, 0.1f));
134+
light->atten(glm::vec3(0.0f, 0.0f, 0.1f));
134135

135136
// Sound Demo
136137
//Sound* fire_sound = new Sound(

0 commit comments

Comments
 (0)