AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
35
src/data/assets/README.txt
Normal file
@ -0,0 +1,35 @@
|
||||
***************************************************************
|
||||
* Toutes les images fournies proviennent du domaine publique. *
|
||||
***************************************************************
|
||||
|
||||
dry_ground.jpg
|
||||
--------------
|
||||
Attribution : By Lover of Freedom [Public domain]
|
||||
Source : http://pdtextures.blogspot.ca/2008/03/first-set.html
|
||||
|
||||
granite_floor.jpg
|
||||
-----------------
|
||||
Attribution : By Coyau [Public domain], via Wikimedia Commons
|
||||
Source : https://commons.wikimedia.org/wiki/File%3AGranite_paving_tileable_2048x2048.jpg
|
||||
|
||||
grass.jpg
|
||||
---------
|
||||
Attribution : By Moohasha at English Wikibooks [Public domain], via Wikimedia Commons
|
||||
Source : https://commons.wikimedia.org/wiki/File%3ABlender3DNoobToPro-Grass.jpg
|
||||
|
||||
limestone_wall.jpg
|
||||
------------------
|
||||
Attribution : By Coyau [Public domain], via Wikimedia Commons
|
||||
Source : https://commons.wikimedia.org/wiki/File%3ALimestone_wall_tileable.jpg
|
||||
|
||||
pierre_bouchardee.jpg
|
||||
---------------------
|
||||
Attribution : Original work by Pierre-Yves Beaudouin [Public domain]. Derivative work by Coyau [Public domain], via Wikimedia Commons
|
||||
Source : https://commons.wikimedia.org/wiki/File%3APierre_bouchard%C3%A9e_tileable_1024x1024.jpg
|
||||
|
||||
wood_floor.jpg
|
||||
--------------
|
||||
Attribution : By Tom Havik [Public domain]
|
||||
Source : http://www.pixnio.com/textures-and-patterns/wood-texture/wood-pattern-parquet-floor-tiles
|
||||
|
||||
|
||||
BIN
src/data/assets/dry_ground.jpg
Normal file
|
After Width: | Height: | Size: 232 KiB |
BIN
src/data/assets/granite_floor.jpg
Normal file
|
After Width: | Height: | Size: 426 KiB |
BIN
src/data/assets/grass.jpg
Normal file
|
After Width: | Height: | Size: 402 KiB |
BIN
src/data/assets/limestone_wall.jpg
Normal file
|
After Width: | Height: | Size: 499 KiB |
BIN
src/data/assets/pierre_bouchardee.jpg
Normal file
|
After Width: | Height: | Size: 390 KiB |
BIN
src/data/assets/wood_floor.jpg
Normal file
|
After Width: | Height: | Size: 95 KiB |
BIN
src/data/dry_ground.jpg
Normal file
|
After Width: | Height: | Size: 232 KiB |
BIN
src/data/granite_floor.jpg
Normal file
|
After Width: | Height: | Size: 426 KiB |
BIN
src/data/grass.jpg
Normal file
|
After Width: | Height: | Size: 402 KiB |
BIN
src/data/lab2_assets v2.00.zip
Normal file
BIN
src/data/limestone_wall.jpg
Normal file
|
After Width: | Height: | Size: 499 KiB |
BIN
src/data/pierre_bouchardee.jpg
Normal file
|
After Width: | Height: | Size: 390 KiB |
BIN
src/data/wood_floor.jpg
Normal file
|
After Width: | Height: | Size: 95 KiB |
@ -368,6 +368,13 @@ void Viewer::initShaders()
|
||||
s_texture = new QOpenGLTexture(QImage("src/data/uvLayoutGrid.png"));//*/
|
||||
s_texture->setMinificationFilter(QOpenGLTexture::LinearMipMapLinear);
|
||||
s_texture->setMagnificationFilter(QOpenGLTexture::Linear);
|
||||
|
||||
// load remaining textures
|
||||
for(int i = 0; i<TEX_LENGTH; i++){
|
||||
TexturePrograms[i] = new QOpenGLTexture(QImage(TexturePaths[i]));
|
||||
TexturePrograms[i]->setMinificationFilter(QOpenGLTexture::LinearMipMapLinear);
|
||||
TexturePrograms[i]->setMagnificationFilter(QOpenGLTexture::Linear);
|
||||
}//*/
|
||||
}
|
||||
|
||||
// Creates the basic shapes in memory. We only have 3, so we just prep them all in advance.
|
||||
@ -608,10 +615,10 @@ void Viewer::visit(Cube &s)
|
||||
|
||||
void Viewer::visit(Sphere &s)
|
||||
{
|
||||
return;
|
||||
// std::cout << "Sphere found";
|
||||
QMatrix4x4 modelViewMatrix = modelStack.top() * QMatrix4x4(s.transform);
|
||||
|
||||
if(!isPickingActivated){
|
||||
glBindVertexArray(m_VAOs[VAO_Sphere]);
|
||||
m_program->setUniformValue(m_isSkyLoc, false);
|
||||
m_program->setUniformValue(m_mvMatrixLocation, modelViewMatrix);
|
||||
@ -620,6 +627,7 @@ void Viewer::visit(Sphere &s)
|
||||
m_program->setUniformValue(m_drawTextLoc, false);
|
||||
m_program->setUniformValue(m_isLightLoc, true);
|
||||
|
||||
|
||||
// This will save the current position of this light ball as the next point
|
||||
// This means point lights are technically 1 frame behind
|
||||
|
||||
@ -637,6 +645,7 @@ void Viewer::visit(Sphere &s)
|
||||
currentPoint = (currentPoint + 1) % 3;
|
||||
|
||||
glDrawElements(GL_TRIANGLES, numTriSphere*3, GL_UNSIGNED_INT, 0);
|
||||
}
|
||||
}
|
||||
|
||||
void Viewer::visit(SceneGroup &s)
|
||||
@ -678,6 +687,8 @@ Shape* Viewer::pickGeom(int x, int y){
|
||||
m_program->bind();
|
||||
m_program->setUniformValue(m_isPickingModeLoc, true);
|
||||
|
||||
isPickingActivated = true;
|
||||
|
||||
QMap<QRgb, Shape*> mapColorToShape;
|
||||
QColor c;
|
||||
QRgb startColor = 0xFF0001; // alpha must be 100%, glReadPixels doesn't resturn alpha
|
||||
@ -739,6 +750,8 @@ Shape* Viewer::pickGeom(int x, int y){
|
||||
std::cout << "Picked Color: " << pickedColor->red() << " " << pickedColor->green() << " " << pickedColor->blue() << " " << pickedColor->alpha() << endl;
|
||||
std::cout << "Picked Shape: " << pickedShape << endl;
|
||||
|
||||
m_program->setUniformValue(m_isPickingModeLoc, true);
|
||||
//m_program->setUniformValue(m_isPickingModeLoc, false);
|
||||
//isPickingActivated = false;
|
||||
|
||||
return pickedShape;
|
||||
}
|
||||
|
||||
@ -111,6 +111,7 @@ private:
|
||||
int m_c3Loc;
|
||||
|
||||
int m_isPickingModeLoc;
|
||||
bool isPickingActivated = false;
|
||||
|
||||
float angle_mult;
|
||||
|
||||
@ -128,6 +129,29 @@ private:
|
||||
|
||||
Shape* generateShapeFromIndex(int);
|
||||
|
||||
enum Textures{
|
||||
TEX_DRYGOUND,
|
||||
TEX_GRANITEFLOOR,
|
||||
TEX_GRASS,
|
||||
TEX_LIMESTONEWALLS,
|
||||
TEX_PIERREBOUCHARDEE,
|
||||
TEX_WOODFLOOR,
|
||||
|
||||
TEX_LENGTH
|
||||
};
|
||||
|
||||
QString TexturePaths[TEX_LENGTH] = {
|
||||
"src/data/dry_gound.jpg",
|
||||
"src/data/granite_floor.jpg",
|
||||
"src/data/grass.jpg",
|
||||
"src/data/limestone_walls.jpg",
|
||||
"src/data/pierre_bouchardee.jpg",
|
||||
"src/data/wood_floor.jpg"
|
||||
};
|
||||
|
||||
QOpenGLTexture *TexturePrograms[TEX_LENGTH];
|
||||
|
||||
|
||||
QQuaternion rot;
|
||||
unsigned int frame;
|
||||
};
|
||||
|
||||