#include <math.h>
#include <string>
#include <fstream>
+#include <thread>
#define GLEW_STATIC
#include <GL/glew.h>
* This flag lets the compiler know that we want to use shaders.
*/
-#define SHADERSs
+#define SHADERS
/**
* This structure contains a set of coordinates for ease of coding.
* Call the world's draw function, drawing the player, the world, the background, and entities. Also
* draw the player's inventory if it exists.
*/
- glUseProgramObjectARB(shaderProgram);
player->near=true; // Draw the player's name
}
glUseProgramObjectARB(0);
}
+
+ glUseProgramObjectARB(shaderProgram);
+ glUniform2f(glGetUniformLocation(shaderProgram, "lightLocation"), 250,250);
+ glUniform3f(glGetUniformLocation(shaderProgram, "lightColor"), 1,0,0);
+ glColor4f(0.0f,0.0f,0.0f,1.0f);
+ glRectf(-SCREEN_WIDTH/2,0,SCREEN_WIDTH/2,SCREEN_HEIGHT);
+ glUseProgramObjectARB(0);
+
player->inv->draw();
/*
* Here we draw a black overlay if it's been requested.
*/
- glUseProgramObjectARB(0);
+ //glUseProgramObjectARB(0);
if(fadeIntensity){
static volatile bool objectInteracting = false;
void logic(){
+
/*
* NPCSelected is used to insure that only one NPC is made interactable with the mouse
* if, for example, multiple entities are occupying one space.
subtype = 0;
health = maxHealth = 100;
speed = 1;
- //tex = new Texturec(3, "assets/player1.png", "assets/player.png", "assets/player2.png");
- tex = new Texturec(3, "assets/maybeplayer.png", "assets/maybeplayer.png", "assets/maybeplayer.png");
+ tex = new Texturec(3, "assets/player1.png", "assets/player.png", "assets/player2.png");
+ //tex = new Texturec(3, "assets/maybeplayer.png", "assets/maybeplayer.png", "assets/maybeplayer.png");
inv = new Inventory(PLAYER_INV_SIZE);
}
Player::~Player(){
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); //for the s direction
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); //for the t direction
glBegin(GL_QUADS);
- std::cout<<shade<<std::endl;
for(i=is;i<(unsigned)ie-GEN_INC;i++){
cline[i].y+=(yoff-DRAW_Y_OFFSET); // Add the y offset
if(!cline[i].y){
-#version 120\r
-void main(){\r
- gl_FragColor = glColor;\r
-}\r
+uniform vec2 lightLocation;\r
+uniform vec3 lightColor;\r
+uniform float screenHeight;\r
+\r
+float radius = 4.9;\r
+float minLight = .01;\r
+float a = .01;\r
+float b = 1.0 / (radius*radius * minLight);\r
+\r
+void main() {\r
+ float distance = length(lightLocation - gl_FragCoord.xy);\r
+ //float attenuation = 1.0 / (1.0 + a*distance + b*distance*distance);\r
+ float attenuation = clamp(1.0 - distance*distance/(radius*radius), 0.0, 1.0); attenuation *= attenuation;\r
+ vec4 color = vec4(attenuation, attenuation, attenuation, attenuation) * vec4(lightColor, 1);\r
+\r
+ gl_FragColor = color;\r
+}
\ No newline at end of file