parent
487e43ff4e
commit
f8841f96f2
|
@ -80,6 +80,7 @@ set(BASE_SOURCES
|
||||||
common/resources/outputstream.cpp
|
common/resources/outputstream.cpp
|
||||||
common/resources/sndfile.cpp
|
common/resources/sndfile.cpp
|
||||||
graphics/core/color.cpp
|
graphics/core/color.cpp
|
||||||
|
graphics/core/nulldevice.cpp
|
||||||
graphics/engine/camera.cpp
|
graphics/engine/camera.cpp
|
||||||
graphics/engine/cloud.cpp
|
graphics/engine/cloud.cpp
|
||||||
graphics/engine/engine.cpp
|
graphics/engine/engine.cpp
|
||||||
|
|
|
@ -31,6 +31,7 @@
|
||||||
#include "common/resources/resourcemanager.h"
|
#include "common/resources/resourcemanager.h"
|
||||||
|
|
||||||
#include "graphics/engine/modelmanager.h"
|
#include "graphics/engine/modelmanager.h"
|
||||||
|
#include "graphics/core/nulldevice.h"
|
||||||
#include "graphics/opengl/gldevice.h"
|
#include "graphics/opengl/gldevice.h"
|
||||||
|
|
||||||
#include "object/robotmain.h"
|
#include "object/robotmain.h"
|
||||||
|
@ -168,6 +169,7 @@ CApplication::CApplication()
|
||||||
m_runSceneRank = 0;
|
m_runSceneRank = 0;
|
||||||
|
|
||||||
m_sceneTest = false;
|
m_sceneTest = false;
|
||||||
|
m_headless = false;
|
||||||
m_resolutionOverride = false;
|
m_resolutionOverride = false;
|
||||||
|
|
||||||
m_language = LANGUAGE_ENV;
|
m_language = LANGUAGE_ENV;
|
||||||
|
@ -228,7 +230,8 @@ ParseArgsStatus CApplication::ParseArguments(int argc, char *argv[])
|
||||||
OPT_SAVEDIR,
|
OPT_SAVEDIR,
|
||||||
OPT_MOD,
|
OPT_MOD,
|
||||||
OPT_VBO,
|
OPT_VBO,
|
||||||
OPT_RESOLUTION
|
OPT_RESOLUTION,
|
||||||
|
OPT_HEADLESS
|
||||||
};
|
};
|
||||||
|
|
||||||
option options[] =
|
option options[] =
|
||||||
|
@ -245,6 +248,7 @@ ParseArgsStatus CApplication::ParseArguments(int argc, char *argv[])
|
||||||
{ "mod", required_argument, nullptr, OPT_MOD },
|
{ "mod", required_argument, nullptr, OPT_MOD },
|
||||||
{ "vbo", required_argument, nullptr, OPT_VBO },
|
{ "vbo", required_argument, nullptr, OPT_VBO },
|
||||||
{ "resolution", required_argument, nullptr, OPT_RESOLUTION },
|
{ "resolution", required_argument, nullptr, OPT_RESOLUTION },
|
||||||
|
{ "headless", no_argument, nullptr, OPT_HEADLESS },
|
||||||
{ nullptr, 0, nullptr, 0}
|
{ nullptr, 0, nullptr, 0}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -287,6 +291,7 @@ ParseArgsStatus CApplication::ParseArguments(int argc, char *argv[])
|
||||||
GetLogger()->Message(" -mod path load datadir mod from given path\n");
|
GetLogger()->Message(" -mod path load datadir mod from given path\n");
|
||||||
GetLogger()->Message(" -vbo mode set OpenGL VBO mode (one of: auto, enable, disable)\n");
|
GetLogger()->Message(" -vbo mode set OpenGL VBO mode (one of: auto, enable, disable)\n");
|
||||||
GetLogger()->Message(" -resolution WxH set resolution\n");
|
GetLogger()->Message(" -resolution WxH set resolution\n");
|
||||||
|
GetLogger()->Message(" -headless headless mode - disables graphics, sound and user interaction\n");
|
||||||
return PARSE_ARGS_HELP;
|
return PARSE_ARGS_HELP;
|
||||||
}
|
}
|
||||||
case OPT_DEBUG:
|
case OPT_DEBUG:
|
||||||
|
@ -402,6 +407,11 @@ ParseArgsStatus CApplication::ParseArguments(int argc, char *argv[])
|
||||||
m_resolutionOverride = true;
|
m_resolutionOverride = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case OPT_HEADLESS:
|
||||||
|
{
|
||||||
|
m_headless = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
assert(false); // should never get here
|
assert(false); // should never get here
|
||||||
}
|
}
|
||||||
|
@ -460,7 +470,11 @@ bool CApplication::Create()
|
||||||
|
|
||||||
//Create the sound instance.
|
//Create the sound instance.
|
||||||
#ifdef OPENAL_SOUND
|
#ifdef OPENAL_SOUND
|
||||||
m_sound = static_cast<CSoundInterface *>(new ALSound());
|
if(!m_headless) {
|
||||||
|
m_sound = static_cast<CSoundInterface *>(new ALSound());
|
||||||
|
} else {
|
||||||
|
m_sound = new CSoundInterface();
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
GetLogger()->Info("No sound support.\n");
|
GetLogger()->Info("No sound support.\n");
|
||||||
m_sound = new CSoundInterface();
|
m_sound = new CSoundInterface();
|
||||||
|
@ -505,35 +519,37 @@ bool CApplication::Create()
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// load settings from profile
|
if(!m_headless) {
|
||||||
int iValue;
|
// load settings from profile
|
||||||
if ( GetProfile().GetIntProperty("Setup", "Resolution", iValue) && !m_resolutionOverride )
|
int iValue;
|
||||||
{
|
if ( GetProfile().GetIntProperty("Setup", "Resolution", iValue) && !m_resolutionOverride )
|
||||||
std::vector<Math::IntPoint> modes;
|
{
|
||||||
GetVideoResolutionList(modes, true, true);
|
std::vector<Math::IntPoint> modes;
|
||||||
if (static_cast<unsigned int>(iValue) < modes.size())
|
GetVideoResolutionList(modes, true, true);
|
||||||
m_deviceConfig.size = modes.at(iValue);
|
if (static_cast<unsigned int>(iValue) < modes.size())
|
||||||
|
m_deviceConfig.size = modes.at(iValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( GetProfile().GetIntProperty("Setup", "Fullscreen", iValue) && !m_resolutionOverride )
|
||||||
|
{
|
||||||
|
m_deviceConfig.fullScreen = (iValue == 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! CreateVideoSurface())
|
||||||
|
return false; // dialog is in function
|
||||||
|
|
||||||
|
if (m_private->surface == nullptr)
|
||||||
|
{
|
||||||
|
m_errorMessage = std::string("SDL error while setting video mode:\n") +
|
||||||
|
std::string(SDL_GetError());
|
||||||
|
GetLogger()->Error(m_errorMessage.c_str());
|
||||||
|
m_exitCode = 4;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
SDL_WM_SetCaption(m_windowTitle.c_str(), m_windowTitle.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( GetProfile().GetIntProperty("Setup", "Fullscreen", iValue) && !m_resolutionOverride )
|
|
||||||
{
|
|
||||||
m_deviceConfig.fullScreen = (iValue == 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! CreateVideoSurface())
|
|
||||||
return false; // dialog is in function
|
|
||||||
|
|
||||||
if (m_private->surface == nullptr)
|
|
||||||
{
|
|
||||||
m_errorMessage = std::string("SDL error while setting video mode:\n") +
|
|
||||||
std::string(SDL_GetError());
|
|
||||||
GetLogger()->Error(m_errorMessage.c_str());
|
|
||||||
m_exitCode = 4;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
SDL_WM_SetCaption(m_windowTitle.c_str(), m_windowTitle.c_str());
|
|
||||||
|
|
||||||
// Enable translating key codes of key press events to unicode chars
|
// Enable translating key codes of key press events to unicode chars
|
||||||
SDL_EnableUNICODE(1);
|
SDL_EnableUNICODE(1);
|
||||||
SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL);
|
SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL);
|
||||||
|
@ -541,8 +557,12 @@ bool CApplication::Create()
|
||||||
// Don't generate joystick events
|
// Don't generate joystick events
|
||||||
SDL_JoystickEventState(SDL_IGNORE);
|
SDL_JoystickEventState(SDL_IGNORE);
|
||||||
|
|
||||||
// The video is ready, we can create and initalize the graphics device
|
if(!m_headless) {
|
||||||
m_device = new Gfx::CGLDevice(m_deviceConfig);
|
// The video is ready, we can create and initalize the graphics device
|
||||||
|
m_device = new Gfx::CGLDevice(m_deviceConfig);
|
||||||
|
} else {
|
||||||
|
m_device = new Gfx::CNullDevice();
|
||||||
|
}
|
||||||
if (! m_device->Create() )
|
if (! m_device->Create() )
|
||||||
{
|
{
|
||||||
m_errorMessage = std::string("Error in CDevice::Create()\n") + standardInfoMessage;
|
m_errorMessage = std::string("Error in CDevice::Create()\n") + standardInfoMessage;
|
||||||
|
|
|
@ -500,11 +500,11 @@ protected:
|
||||||
|
|
||||||
//! Low cpu mode
|
//! Low cpu mode
|
||||||
bool m_lowCPU;
|
bool m_lowCPU;
|
||||||
|
|
||||||
//! Show prototype levels
|
|
||||||
bool m_protoMode;
|
|
||||||
|
|
||||||
//! Screen resoultion overriden by commandline
|
//! Screen resoultion overriden by commandline
|
||||||
bool m_resolutionOverride;
|
bool m_resolutionOverride;
|
||||||
|
|
||||||
|
//! Headles mode
|
||||||
|
bool m_headless;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,359 @@
|
||||||
|
/*
|
||||||
|
* This file is part of the Colobot: Gold Edition source code
|
||||||
|
* Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam
|
||||||
|
* http://epsiteс.ch; http://colobot.info; http://github.com/colobot
|
||||||
|
*
|
||||||
|
* 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://gnu.org/licenses
|
||||||
|
*/
|
||||||
|
|
||||||
|
// * This file is part of the COLOBOT source code
|
||||||
|
// * 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/.
|
||||||
|
|
||||||
|
|
||||||
|
#include "graphics/core/nulldevice.h"
|
||||||
|
|
||||||
|
#include "common/config.h"
|
||||||
|
#include "common/logger.h"
|
||||||
|
|
||||||
|
#include "math/geometry.h"
|
||||||
|
|
||||||
|
|
||||||
|
// Graphics module namespace
|
||||||
|
namespace Gfx {
|
||||||
|
|
||||||
|
CNullDevice::CNullDevice()
|
||||||
|
{
|
||||||
|
m_matrix = Math::Matrix();
|
||||||
|
m_material = Material();
|
||||||
|
m_light = Light();
|
||||||
|
}
|
||||||
|
|
||||||
|
CNullDevice::~CNullDevice()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void CNullDevice::DebugHook()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void CNullDevice::DebugLights()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CNullDevice::Create()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CNullDevice::Destroy()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void CNullDevice::BeginScene()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void CNullDevice::EndScene()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void CNullDevice::Clear()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void CNullDevice::SetTransform(TransformType type, const Math::Matrix &matrix)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
const Math::Matrix& CNullDevice::GetTransform(TransformType type)
|
||||||
|
{
|
||||||
|
return m_matrix;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CNullDevice::MultiplyTransform(TransformType type, const Math::Matrix &matrix)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void CNullDevice::SetMaterial(const Material &material)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
const Material& CNullDevice::GetMaterial()
|
||||||
|
{
|
||||||
|
return m_material;
|
||||||
|
}
|
||||||
|
|
||||||
|
int CNullDevice::GetMaxLightCount()
|
||||||
|
{
|
||||||
|
return 99;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CNullDevice::SetLight(int index, const Light &light)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
const Light& CNullDevice::GetLight(int index)
|
||||||
|
{
|
||||||
|
return m_light;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CNullDevice::SetLightEnabled(int index, bool enabled)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CNullDevice::GetLightEnabled(int index)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
Texture CNullDevice::CreateTexture(CImage *image, const TextureCreateParams ¶ms)
|
||||||
|
{
|
||||||
|
Texture tex;
|
||||||
|
tex.id = 1; // tex.id = 0 => invalid texture
|
||||||
|
return tex;
|
||||||
|
}
|
||||||
|
|
||||||
|
Texture CNullDevice::CreateTexture(ImageData *data, const TextureCreateParams ¶ms)
|
||||||
|
{
|
||||||
|
Texture tex;
|
||||||
|
tex.id = 1; // tex.id = 0 => invalid texture
|
||||||
|
return tex;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CNullDevice::DestroyTexture(const Texture &texture)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void CNullDevice::DestroyAllTextures()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
int CNullDevice::GetMaxTextureStageCount()
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CNullDevice::SetTexture(int index, const Texture &texture)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void CNullDevice::SetTexture(int index, unsigned int textureId)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
Texture CNullDevice::GetTexture(int index)
|
||||||
|
{
|
||||||
|
return Texture();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CNullDevice::SetTextureEnabled(int index, bool enabled)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CNullDevice::GetTextureEnabled(int index)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CNullDevice::SetTextureStageParams(int index, const TextureStageParams ¶ms)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void CNullDevice::SetTextureStageWrap(int index, TexWrapMode wrapS, TexWrapMode wrapT)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
TextureStageParams CNullDevice::GetTextureStageParams(int index)
|
||||||
|
{
|
||||||
|
return TextureStageParams();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CNullDevice::DrawPrimitive(PrimitiveType type, const Vertex *vertices, int vertexCount,
|
||||||
|
Color color)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void CNullDevice::DrawPrimitive(PrimitiveType type, const VertexTex2 *vertices, int vertexCount,
|
||||||
|
Color color)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void CNullDevice::DrawPrimitive(PrimitiveType type, const VertexCol *vertices, int vertexCount)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int CNullDevice::CreateStaticBuffer(PrimitiveType primitiveType, const Vertex* vertices, int vertexCount)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int CNullDevice::CreateStaticBuffer(PrimitiveType primitiveType, const VertexTex2* vertices, int vertexCount)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int CNullDevice::CreateStaticBuffer(PrimitiveType primitiveType, const VertexCol* vertices, int vertexCount)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CNullDevice::UpdateStaticBuffer(unsigned int bufferId, PrimitiveType primitiveType, const Vertex* vertices, int vertexCount)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void CNullDevice::UpdateStaticBuffer(unsigned int bufferId, PrimitiveType primitiveType, const VertexTex2* vertices, int vertexCount)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void CNullDevice::UpdateStaticBuffer(unsigned int bufferId, PrimitiveType primitiveType, const VertexCol* vertices, int vertexCount)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void CNullDevice::DrawStaticBuffer(unsigned int bufferId)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void CNullDevice::DestroyStaticBuffer(unsigned int bufferId)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
int CNullDevice::ComputeSphereVisibility(const Math::Vector ¢er, float radius)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CNullDevice::SetRenderState(RenderState state, bool enabled)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CNullDevice::GetRenderState(RenderState state)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CNullDevice::SetDepthTestFunc(CompFunc func)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
CompFunc CNullDevice::GetDepthTestFunc()
|
||||||
|
{
|
||||||
|
return COMP_FUNC_NEVER;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CNullDevice::SetDepthBias(float factor)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
float CNullDevice::GetDepthBias()
|
||||||
|
{
|
||||||
|
return 0.0f;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CNullDevice::SetAlphaTestFunc(CompFunc func, float refValue)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void CNullDevice::GetAlphaTestFunc(CompFunc &func, float &refValue)
|
||||||
|
{
|
||||||
|
|
||||||
|
func = COMP_FUNC_NEVER;
|
||||||
|
refValue = 0.0f;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CNullDevice::SetBlendFunc(BlendFunc srcBlend, BlendFunc dstBlend)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void CNullDevice::GetBlendFunc(BlendFunc &srcBlend, BlendFunc &dstBlend)
|
||||||
|
{
|
||||||
|
srcBlend = BLEND_ZERO;
|
||||||
|
dstBlend = BLEND_ZERO;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CNullDevice::SetClearColor(const Color &color)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
Color CNullDevice::GetClearColor()
|
||||||
|
{
|
||||||
|
return Color(0.0f, 0.0f, 0.0f, 0.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CNullDevice::SetGlobalAmbient(const Color &color)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
Color CNullDevice::GetGlobalAmbient()
|
||||||
|
{
|
||||||
|
return Color(0.0f, 0.0f, 0.0f, 0.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CNullDevice::SetFogParams(FogMode mode, const Color &color, float start, float end, float density)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void CNullDevice::GetFogParams(FogMode &mode, Color &color, float &start, float &end, float &density)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
void CNullDevice::SetCullMode(CullMode mode)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
CullMode CNullDevice::GetCullMode()
|
||||||
|
{
|
||||||
|
return CULL_CW;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CNullDevice::SetShadeModel(ShadeModel model)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
ShadeModel CNullDevice::GetShadeModel()
|
||||||
|
{
|
||||||
|
return SHADE_FLAT;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CNullDevice::SetFillMode(FillMode mode)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
FillMode CNullDevice::GetFillMode()
|
||||||
|
{
|
||||||
|
return FILL_POINT;
|
||||||
|
}
|
||||||
|
|
||||||
|
void* CNullDevice::GetFrameBufferPixels() const
|
||||||
|
{
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
} // namespace Gfx
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,145 @@
|
||||||
|
/*
|
||||||
|
* This file is part of the Colobot: Gold Edition source code
|
||||||
|
* Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam
|
||||||
|
* http://epsiteс.ch; http://colobot.info; http://github.com/colobot
|
||||||
|
*
|
||||||
|
* 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://gnu.org/licenses
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \file graphics/core/device.h
|
||||||
|
* \brief Abstract graphics device - CDevice class and related structs/enums
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
|
||||||
|
#include "graphics/core/device.h"
|
||||||
|
|
||||||
|
// Graphics module namespace
|
||||||
|
namespace Gfx {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \class CNullDevice
|
||||||
|
* \brief Device implementation that doesn't render anything
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
class CNullDevice : public CDevice
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CNullDevice();
|
||||||
|
virtual ~CNullDevice();
|
||||||
|
|
||||||
|
virtual void DebugHook();
|
||||||
|
virtual void DebugLights();
|
||||||
|
|
||||||
|
virtual bool Create();
|
||||||
|
virtual void Destroy();
|
||||||
|
|
||||||
|
virtual void BeginScene();
|
||||||
|
virtual void EndScene();
|
||||||
|
|
||||||
|
virtual void Clear();
|
||||||
|
|
||||||
|
virtual void SetTransform(TransformType type, const Math::Matrix &matrix);
|
||||||
|
virtual const Math::Matrix& GetTransform(TransformType type);
|
||||||
|
virtual void MultiplyTransform(TransformType type, const Math::Matrix &matrix);
|
||||||
|
|
||||||
|
virtual void SetMaterial(const Material &material);
|
||||||
|
virtual const Material& GetMaterial();
|
||||||
|
|
||||||
|
virtual int GetMaxLightCount();
|
||||||
|
virtual void SetLight(int index, const Light &light);
|
||||||
|
virtual const Light& GetLight(int index);
|
||||||
|
virtual void SetLightEnabled(int index, bool enabled);
|
||||||
|
virtual bool GetLightEnabled(int index);
|
||||||
|
|
||||||
|
virtual Texture CreateTexture(CImage *image, const TextureCreateParams ¶ms);
|
||||||
|
virtual Texture CreateTexture(ImageData *data, const TextureCreateParams ¶ms);
|
||||||
|
virtual void DestroyTexture(const Texture &texture);
|
||||||
|
virtual void DestroyAllTextures();
|
||||||
|
|
||||||
|
virtual int GetMaxTextureStageCount();
|
||||||
|
virtual void SetTexture(int index, const Texture &texture);
|
||||||
|
virtual void SetTexture(int index, unsigned int textureId);
|
||||||
|
virtual Texture GetTexture(int index);
|
||||||
|
virtual void SetTextureEnabled(int index, bool enabled);
|
||||||
|
virtual bool GetTextureEnabled(int index);
|
||||||
|
|
||||||
|
virtual void SetTextureStageParams(int index, const TextureStageParams ¶ms);
|
||||||
|
virtual TextureStageParams GetTextureStageParams(int index);
|
||||||
|
|
||||||
|
virtual void SetTextureStageWrap(int index, Gfx::TexWrapMode wrapS, Gfx::TexWrapMode wrapT);
|
||||||
|
|
||||||
|
virtual void DrawPrimitive(PrimitiveType type, const Vertex *vertices , int vertexCount,
|
||||||
|
Color color = Color(1.0f, 1.0f, 1.0f, 1.0f));
|
||||||
|
virtual void DrawPrimitive(PrimitiveType type, const VertexTex2 *vertices, int vertexCount,
|
||||||
|
Color color = Color(1.0f, 1.0f, 1.0f, 1.0f));
|
||||||
|
virtual void DrawPrimitive(PrimitiveType type, const VertexCol *vertices , int vertexCount);
|
||||||
|
|
||||||
|
virtual unsigned int CreateStaticBuffer(PrimitiveType primitiveType, const Vertex* vertices, int vertexCount);
|
||||||
|
virtual unsigned int CreateStaticBuffer(PrimitiveType primitiveType, const VertexTex2* vertices, int vertexCount);
|
||||||
|
virtual unsigned int CreateStaticBuffer(PrimitiveType primitiveType, const VertexCol* vertices, int vertexCount);
|
||||||
|
virtual void UpdateStaticBuffer(unsigned int bufferId, PrimitiveType primitiveType, const Vertex* vertices, int vertexCount);
|
||||||
|
virtual void UpdateStaticBuffer(unsigned int bufferId, PrimitiveType primitiveType, const VertexTex2* vertices, int vertexCount);
|
||||||
|
virtual void UpdateStaticBuffer(unsigned int bufferId, PrimitiveType primitiveType, const VertexCol* vertices, int vertexCount);
|
||||||
|
virtual void DrawStaticBuffer(unsigned int bufferId);
|
||||||
|
virtual void DestroyStaticBuffer(unsigned int bufferId);
|
||||||
|
|
||||||
|
virtual int ComputeSphereVisibility(const Math::Vector ¢er, float radius);
|
||||||
|
|
||||||
|
virtual void SetRenderState(RenderState state, bool enabled);
|
||||||
|
virtual bool GetRenderState(RenderState state);
|
||||||
|
|
||||||
|
virtual void SetDepthTestFunc(CompFunc func);
|
||||||
|
virtual CompFunc GetDepthTestFunc();
|
||||||
|
|
||||||
|
virtual void SetDepthBias(float factor);
|
||||||
|
virtual float GetDepthBias();
|
||||||
|
|
||||||
|
virtual void SetAlphaTestFunc(CompFunc func, float refValue);
|
||||||
|
virtual void GetAlphaTestFunc(CompFunc &func, float &refValue);
|
||||||
|
|
||||||
|
virtual void SetBlendFunc(BlendFunc srcBlend, BlendFunc dstBlend);
|
||||||
|
virtual void GetBlendFunc(BlendFunc &srcBlend, BlendFunc &dstBlend);
|
||||||
|
|
||||||
|
virtual void SetClearColor(const Color &color);
|
||||||
|
virtual Color GetClearColor();
|
||||||
|
|
||||||
|
virtual void SetGlobalAmbient(const Color &color);
|
||||||
|
virtual Color GetGlobalAmbient();
|
||||||
|
|
||||||
|
virtual void SetFogParams(FogMode mode, const Color &color, float start, float end, float density);
|
||||||
|
virtual void GetFogParams(FogMode &mode, Color &color, float &start, float &end, float &density);
|
||||||
|
|
||||||
|
virtual void SetCullMode(CullMode mode);
|
||||||
|
virtual CullMode GetCullMode();
|
||||||
|
|
||||||
|
virtual void SetShadeModel(ShadeModel model);
|
||||||
|
virtual ShadeModel GetShadeModel();
|
||||||
|
|
||||||
|
virtual void SetFillMode(FillMode mode) ;
|
||||||
|
virtual FillMode GetFillMode();
|
||||||
|
|
||||||
|
virtual void* GetFrameBufferPixels() const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
Math::Matrix m_matrix;
|
||||||
|
Material m_material;
|
||||||
|
Light m_light;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
} // namespace Gfx
|
||||||
|
|
Loading…
Reference in New Issue