Change of paths in src/graphics

- moved abstract core to src/graphics/core
- moved proper graphics engine to src/graphics/engine
dev-ui
Piotr Dziwinski 2012-07-26 22:26:19 +02:00
parent 045f17a274
commit 4ddcd9f810
42 changed files with 167 additions and 128 deletions

View File

@ -43,19 +43,19 @@ common/iman.cpp
# common/profile.cpp
# common/restext.cpp
common/stringutils.cpp
graphics/common/camera.cpp
graphics/common/cloud.cpp
graphics/common/color.cpp
graphics/common/engine.cpp
graphics/common/light.cpp
graphics/common/lightning.cpp
graphics/common/modelfile.cpp
graphics/common/particle.cpp
graphics/common/planet.cpp
graphics/common/pyro.cpp
graphics/common/terrain.cpp
graphics/common/text.cpp
graphics/common/water.cpp
graphics/core/color.cpp
graphics/engine/camera.cpp
graphics/engine/cloud.cpp
graphics/engine/engine.cpp
graphics/engine/lightman.cpp
graphics/engine/lightning.cpp
graphics/engine/modelfile.cpp
graphics/engine/particle.cpp
graphics/engine/planet.cpp
graphics/engine/pyro.cpp
graphics/engine/terrain.cpp
graphics/engine/text.cpp
graphics/engine/water.cpp
graphics/opengl/gldevice.cpp
# object/auto/auto.cpp
# object/auto/autobase.cpp

View File

@ -22,8 +22,8 @@
#include "common/misc.h"
#include "common/singleton.h"
#include "graphics/common/device.h"
#include "graphics/common/engine.h"
#include "graphics/core/device.h"
#include "graphics/engine/engine.h"
#include <string>
#include <vector>

View File

@ -1,5 +0,0 @@
src/graphics/common
Universal structs and classes used in graphics engine
Concrete implementation in OpenGL is in graphics/opengl directory.

View File

@ -0,0 +1,6 @@
src/graphics/core
Abstract core of graphics engine
Core types, enums, structs and CDevice abstract class that define
the abstract graphics device used in graphics engine

View File

@ -16,7 +16,7 @@
// color.cpp
#include "graphics/common/color.h"
#include "graphics/core/color.h"
#include "math/func.h"

View File

@ -20,11 +20,11 @@
#pragma once
#include "graphics/common/color.h"
#include "graphics/common/light.h"
#include "graphics/common/material.h"
#include "graphics/common/texture.h"
#include "graphics/common/vertex.h"
#include "graphics/core/color.h"
#include "graphics/core/light.h"
#include "graphics/core/material.h"
#include "graphics/core/texture.h"
#include "graphics/core/vertex.h"
#include "math/matrix.h"
#include <string>

91
src/graphics/core/light.h Normal file
View File

@ -0,0 +1,91 @@
// * This file is part of the COLOBOT source code
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
// * Copyright (C) 2012, Polish Portal of Colobot (PPC)
// *
// * This program is free software: you can redistribute it and/or modify
// * it under the terms of the GNU General Public License as published by
// * the Free Software Foundation, either version 3 of the License, or
// * (at your option) any later version.
// *
// * This program is distributed in the hope that it will be useful,
// * but WITHOUT ANY WARRANTY; without even the implied warranty of
// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// * GNU General Public License for more details.
// *
// * You should have received a copy of the GNU General Public License
// * along with this program. If not, see http://www.gnu.org/licenses/.
// light.h
#pragma once
#include "graphics/core/color.h"
#include "math/vector.h"
namespace Gfx {
/**
\enum LightType
\brief Type of light in 3D scene */
enum LightType
{
LIGHT_POINT,
LIGHT_SPOT,
LIGHT_DIRECTIONAL
};
/**
\struct Light
\brief Properties of light in 3D scene
This structure was created as analog to DirectX's D3DLIGHT. */
struct Light
{
//! Type of light source
Gfx::LightType type;
//! Color of ambient light
Gfx::Color ambient;
//! Color of diffuse light
Gfx::Color diffuse;
//! Color of specular light
Gfx::Color specular;
//! Position in world space (for point & spot lights)
Math::Vector position;
//! Direction in world space (for directional & spot lights)
Math::Vector direction;
//! Constant attenuation factor
float attenuation0;
//! Linear attenuation factor
float attenuation1;
//! Quadratic attenuation factor
float attenuation2;
//! Angle of spotlight cone (0-90 degrees)
float spotAngle;
//! Intensity of spotlight (0 = uniform; 128 = most intense)
float spotIntensity;
//! Constructor; calls LoadDefault()
Light()
{
LoadDefault();
}
//! Loads default values
void LoadDefault()
{
type = LIGHT_POINT;
ambient = Gfx::Color(0.4f, 0.4f, 0.4f);
diffuse = Gfx::Color(0.8f, 0.8f, 0.8f);
specular = Gfx::Color(1.0f, 1.0f, 1.0f);
position = Math::Vector(0.0f, 0.0f, 0.0f);
direction = Math::Vector(0.0f, 0.0f, 1.0f);
attenuation0 = 1.0f;
attenuation1 = attenuation2 = 0.0f;
spotAngle = 90.0f;
spotIntensity = 0.0f;
}
};
}; // namespace Gfx

View File

@ -19,7 +19,7 @@
#pragma once
#include "graphics/common/color.h"
#include "graphics/core/color.h"
namespace Gfx {

View File

@ -19,7 +19,7 @@
#pragma once
#include "graphics/common/color.h"
#include "graphics/core/color.h"
#include "math/vector.h"
#include "math/point.h"

View File

@ -0,0 +1,8 @@
src/graphics/engine
Graphics engine
CEngine class and various other classes implementing the main features
of graphics engine from model loading to decorative particles
Graphics operations are done on abstract interface from src/graphics/core

View File

@ -17,7 +17,7 @@
// camera.cpp
#include "graphics/common/camera.h"
#include "graphics/engine/camera.h"
// TODO implementation

View File

@ -17,7 +17,7 @@
// cloud.cpp
#include "graphics/common/cloud.h"
#include "graphics/engine/cloud.h"
// TODO implementation

View File

@ -20,7 +20,7 @@
#pragma once
#include "common/event.h"
#include "graphics/common/color.h"
#include "graphics/core/color.h"
#include "math/point.h"
#include "math/vector.h"

View File

@ -17,14 +17,14 @@
// engine.cpp
#include "graphics/common/engine.h"
#include "graphics/engine/engine.h"
#include "app/app.h"
#include "common/iman.h"
#include "common/image.h"
#include "common/key.h"
#include "common/logger.h"
#include "graphics/common/device.h"
#include "graphics/core/device.h"
#include "math/geometry.h"
// Initial size of various vectors

View File

@ -21,10 +21,10 @@
#include "common/event.h"
#include "graphics/common/color.h"
#include "graphics/common/material.h"
#include "graphics/common/texture.h"
#include "graphics/common/vertex.h"
#include "graphics/core/color.h"
#include "graphics/core/material.h"
#include "graphics/core/texture.h"
#include "graphics/core/vertex.h"
#include "math/intpoint.h"
#include "math/matrix.h"
#include "math/point.h"

View File

@ -17,10 +17,10 @@
// light.cpp
#include "graphics/common/light.h"
#include "graphics/engine/lightman.h"
#include "common/iman.h"
#include "graphics/common/device.h"
#include "graphics/core/device.h"
#include "math/geometry.h"
#include <cmath>

View File

@ -15,80 +15,19 @@
// * You should have received a copy of the GNU General Public License
// * along with this program. If not, see http://www.gnu.org/licenses/.
// light.h
// lightman.h
#pragma once
#include "graphics/common/engine.h"
#include "graphics/common/color.h"
#include "graphics/core/color.h"
#include "graphics/core/light.h"
#include "graphics/engine/engine.h"
#include "math/vector.h"
namespace Gfx {
/**
\enum LightType
\brief Type of light in 3D scene */
enum LightType
{
LIGHT_POINT,
LIGHT_SPOT,
LIGHT_DIRECTIONAL
};
/**
\struct Light
\brief Properties of light in 3D scene
This structure was created as analog to DirectX's D3DLIGHT. */
struct Light
{
//! Type of light source
Gfx::LightType type;
//! Color of ambient light
Gfx::Color ambient;
//! Color of diffuse light
Gfx::Color diffuse;
//! Color of specular light
Gfx::Color specular;
//! Position in world space (for point & spot lights)
Math::Vector position;
//! Direction in world space (for directional & spot lights)
Math::Vector direction;
//! Constant attenuation factor
float attenuation0;
//! Linear attenuation factor
float attenuation1;
//! Quadratic attenuation factor
float attenuation2;
//! Angle of spotlight cone (0-90 degrees)
float spotAngle;
//! Intensity of spotlight (0 = uniform; 128 = most intense)
float spotIntensity;
//! Constructor; calls LoadDefault()
Light()
{
LoadDefault();
}
//! Loads default values
void LoadDefault()
{
type = LIGHT_POINT;
ambient = Gfx::Color(0.4f, 0.4f, 0.4f);
diffuse = Gfx::Color(0.8f, 0.8f, 0.8f);
specular = Gfx::Color(1.0f, 1.0f, 1.0f);
position = Math::Vector(0.0f, 0.0f, 0.0f);
direction = Math::Vector(0.0f, 0.0f, 1.0f);
attenuation0 = 1.0f;
attenuation1 = attenuation2 = 0.0f;
spotAngle = 90.0f;
spotIntensity = 0.0f;
}
};
/**
\struct LightProgression
\brief Describes the progression of light parameters change */

View File

@ -17,7 +17,7 @@
// lightning.cpp (aka blitz.cpp)
#include "graphics/common/lightning.h"
#include "graphics/engine/lightning.h"
// TODO implementation

View File

@ -17,7 +17,7 @@
// modelfile.cpp (aka modfile.cpp)
#include "graphics/common/modelfile.h"
#include "graphics/engine/modelfile.h"
#include "common/iman.h"
#include "common/ioutils.h"

View File

@ -17,9 +17,9 @@
// modelfile.h (aka modfile.h)
#include "graphics/common/engine.h"
#include "graphics/common/vertex.h"
#include "graphics/common/material.h"
#include "graphics/engine/engine.h"
#include "graphics/core/vertex.h"
#include "graphics/core/material.h"
#include "math/vector.h"
#include <string>

View File

@ -17,7 +17,7 @@
// particle.cpp (aka particule.cpp)
#include "graphics/common/particle.h"
#include "graphics/engine/particle.h"
// TODO implementation

View File

@ -17,7 +17,7 @@
// planet.cpp
#include "graphics/common/planet.h"
#include "graphics/engine/planet.h"
// TODO implementation

View File

@ -17,7 +17,7 @@
// pyro.cpp
#include "graphics/common/pyro.h"
#include "graphics/engine/pyro.h"
// TODO implementation

View File

@ -20,7 +20,7 @@
#pragma once
#include "common/misc.h"
#include "graphics/common/engine.h"
#include "graphics/engine/engine.h"
//#include "object/object.h"
// TEMPORARILY!
enum ObjectType {};

View File

@ -17,7 +17,7 @@
// terrain.cpp
#include "graphics/common/terrain.h"
#include "graphics/engine/terrain.h"
// TODO implementation

View File

@ -19,7 +19,7 @@
#pragma once
#include "graphics/common/engine.h"
#include "graphics/engine/engine.h"
class CInstanceManager;

View File

@ -1,4 +1,4 @@
#include "graphics/common/modelfile.h"
#include "graphics/engine/modelfile.h"
#include "common/iman.h"
#include <iostream>

View File

@ -17,7 +17,7 @@
// text.cpp
#include "graphics/common/text.h"
#include "graphics/engine/text.h"
// TODO implementation

View File

@ -19,8 +19,8 @@
#pragma once
#include "graphics/common/engine.h"
#include "graphics/common/device.h"
#include "graphics/engine/engine.h"
#include "graphics/core/device.h"
#include "math/point.h"

View File

@ -17,7 +17,7 @@
// water.cpp
#include "graphics/common/water.h"
#include "graphics/engine/water.h"
// TODO implementation

View File

@ -19,8 +19,8 @@
#pragma once
#include "graphics/common/engine.h"
#include "graphics/common/particle.h"
#include "graphics/engine/engine.h"
#include "graphics/engine/particle.h"
#include "common/event.h"

View File

@ -2,5 +2,5 @@ src/graphics/opengl
OpenGL engine implementation
Contains the concreate implementation using OpenGL of functions
of grahpics engine in graphics/common.
Contains the concrete implementation using OpenGL of abstract CDevice class
from src/graphics/core

View File

@ -19,7 +19,7 @@
#pragma once
#include "graphics/common/device.h"
#include "graphics/core/device.h"
#include <string>
#include <vector>

View File

@ -37,7 +37,7 @@ texture_test.cpp
set(MODEL_SOURCES
../gldevice.cpp
../../common/modelfile.cpp
../../engine/modelfile.cpp
../../../common/logger.cpp
../../../common/image.cpp
../../../common/iman.cpp
@ -84,4 +84,4 @@ add_executable(transform_test ${TRANSFORM_SOURCES})
target_link_libraries(transform_test ${LIBS})
add_executable(light_test ${LIGHT_SOURCES})
target_link_libraries(light_test ${LIBS})
target_link_libraries(light_test ${LIBS})

View File

@ -2,7 +2,7 @@
#include "common/logger.h"
#include "common/image.h"
#include "common/iman.h"
#include "graphics/common/modelfile.h"
#include "graphics/engine/modelfile.h"
#include "graphics/opengl/gldevice.h"
#include "math/geometry.h"