mirror of
https://github.com/glest/glest-source.git
synced 2025-02-24 19:52:25 +01:00
- updated copyright headers is some files that had them missing
- added a new language string for battle end screen
This commit is contained in:
parent
39c85914e9
commit
ee2c02610d
@ -141,7 +141,7 @@ IF(BUILD_MEGAGLEST)
|
|||||||
${GLEST_LIB_INCLUDE_ROOT}util
|
${GLEST_LIB_INCLUDE_ROOT}util
|
||||||
${GLEST_LIB_INCLUDE_ROOT}graphics
|
${GLEST_LIB_INCLUDE_ROOT}graphics
|
||||||
${GLEST_LIB_INCLUDE_ROOT}graphics/gl
|
${GLEST_LIB_INCLUDE_ROOT}graphics/gl
|
||||||
${GLEST_LIB_INCLUDE_ROOT}graphics/md5
|
${GLEST_LIB_INCLUDE_ROOT}graphics/iqm
|
||||||
${GLEST_LIB_INCLUDE_ROOT}sound
|
${GLEST_LIB_INCLUDE_ROOT}sound
|
||||||
${GLEST_LIB_INCLUDE_ROOT}sound/openal
|
${GLEST_LIB_INCLUDE_ROOT}sound/openal
|
||||||
${GLEST_LIB_INCLUDE_ROOT}xml
|
${GLEST_LIB_INCLUDE_ROOT}xml
|
||||||
|
@ -4,6 +4,14 @@
|
|||||||
//
|
//
|
||||||
// Feel free to customize this file to suit your needs
|
// Feel free to customize this file to suit your needs
|
||||||
//
|
//
|
||||||
|
// Copyright (C) 2012 Mark Vejvoda
|
||||||
|
//
|
||||||
|
// You can redistribute this code and/or modify it under
|
||||||
|
// the terms of the GNU General Public License as published
|
||||||
|
// by the Free Software Foundation; either version 2 of the
|
||||||
|
// License, or (at your option) any later version
|
||||||
|
// ==============================================================
|
||||||
|
|
||||||
|
|
||||||
#import <Cocoa/Cocoa.h>
|
#import <Cocoa/Cocoa.h>
|
||||||
|
|
||||||
|
@ -1,9 +1,16 @@
|
|||||||
/* SDLMain.m - main entry point for our Cocoa-ized SDL app
|
// SDLMain.m - main entry point for our Cocoa-ized SDL app
|
||||||
Initial Version: Darrell Walisser <dwaliss1@purdue.edu>
|
// Initial Version: Darrell Walisser <dwaliss1@purdue.edu>
|
||||||
Non-NIB-Code & other changes: Max Horn <max@quendi.de>
|
// Non-NIB-Code & other changes: Max Horn <max@quendi.de>
|
||||||
|
//
|
||||||
|
// Feel free to customize this file to suit your needs
|
||||||
|
|
||||||
Feel free to customize this file to suit your needs
|
// Copyright (C) 2012 Mark Vejvoda
|
||||||
*/
|
//
|
||||||
|
// You can redistribute this code and/or modify it under
|
||||||
|
// the terms of the GNU General Public License as published
|
||||||
|
// by the Free Software Foundation; either version 2 of the
|
||||||
|
// License, or (at your option) any later version
|
||||||
|
// ==============================================================
|
||||||
|
|
||||||
#import <SDL/SDL.h>
|
#import <SDL/SDL.h>
|
||||||
#import "macosx_main.h"
|
#import "macosx_main.h"
|
||||||
|
@ -1,4 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
|
// Copyright (C) 2012 Mark Vejvoda, Titus Tscharntke and Tom Reynolds
|
||||||
|
// The Megaglest Team, under GNU GPL v3.0
|
||||||
|
// ==============================================================
|
||||||
|
|
||||||
define( 'INCLUSION_PERMITTED', true );
|
define( 'INCLUSION_PERMITTED', true );
|
||||||
require_once( 'config.php' );
|
require_once( 'config.php' );
|
||||||
require_once( 'functions.php' );
|
require_once( 'functions.php' );
|
||||||
|
@ -1,4 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
|
// Copyright (C) 2012 Mark Vejvoda, Titus Tscharntke and Tom Reynolds
|
||||||
|
// The Megaglest Team, under GNU GPL v3.0
|
||||||
|
// ==============================================================
|
||||||
|
|
||||||
// This script can be invoked directly by a cron job on a regular basis:
|
// This script can be invoked directly by a cron job on a regular basis:
|
||||||
// /path/to/php -f /path/to/script.php
|
// /path/to/php -f /path/to/script.php
|
||||||
|
|
||||||
|
@ -1,4 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
|
// Copyright (C) 2012 Mark Vejvoda, Titus Tscharntke and Tom Reynolds
|
||||||
|
// The Megaglest Team, under GNU GPL v3.0
|
||||||
|
// ==============================================================
|
||||||
|
|
||||||
if ( !defined('INCLUSION_PERMITTED') || ( defined('INCLUSION_PERMITTED') && INCLUSION_PERMITTED !== true ) ) { die( 'This file must not be invoked directly.' ); }
|
if ( !defined('INCLUSION_PERMITTED') || ( defined('INCLUSION_PERMITTED') && INCLUSION_PERMITTED !== true ) ) { die( 'This file must not be invoked directly.' ); }
|
||||||
|
|
||||||
define( 'MYSQL_HOST', '127.0.0.1' );
|
define( 'MYSQL_HOST', '127.0.0.1' );
|
||||||
|
@ -3,6 +3,9 @@
|
|||||||
--
|
--
|
||||||
-- SQL should be compatible to MySQL 5.0
|
-- SQL should be compatible to MySQL 5.0
|
||||||
--
|
--
|
||||||
|
-- Copyright (C) 2012 Mark Vejvoda, Titus Tscharntke and Tom Reynolds
|
||||||
|
-- The Megaglest Team, under GNU GPL v3.0
|
||||||
|
-- ==============================================================
|
||||||
|
|
||||||
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
|
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
|
||||||
|
|
||||||
|
@ -1,4 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
|
// Copyright (C) 2012 Mark Vejvoda, Titus Tscharntke and Tom Reynolds
|
||||||
|
// The Megaglest Team, under GNU GPL v3.0
|
||||||
|
// ==============================================================
|
||||||
|
|
||||||
if ( !defined('INCLUSION_PERMITTED') || ( defined('INCLUSION_PERMITTED') && INCLUSION_PERMITTED !== true ) ) { die( 'This file must not be invoked directly.' ); }
|
if ( !defined('INCLUSION_PERMITTED') || ( defined('INCLUSION_PERMITTED') && INCLUSION_PERMITTED !== true ) ) { die( 'This file must not be invoked directly.' ); }
|
||||||
|
|
||||||
# This function cleans out special characters
|
# This function cleans out special characters
|
||||||
|
@ -1,3 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
// Copyright (C) 2012 Mark Vejvoda, Titus Tscharntke and Tom Reynolds
|
||||||
|
// The Megaglest Team, under GNU GPL v3.0
|
||||||
|
// ==============================================================
|
||||||
|
|
||||||
require_once('showServers.php');
|
require_once('showServers.php');
|
||||||
?>
|
?>
|
||||||
|
@ -1,4 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
// Copyright (C) 2012 Mark Vejvoda, Titus Tscharntke and Tom Reynolds
|
||||||
|
// The Megaglest Team, under GNU GPL v3.0
|
||||||
|
// ==============================================================
|
||||||
|
|
||||||
define( 'INCLUSION_PERMITTED', true );
|
define( 'INCLUSION_PERMITTED', true );
|
||||||
require_once( 'config.php' );
|
require_once( 'config.php' );
|
||||||
|
@ -1,4 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
|
// Copyright (C) 2012 Mark Vejvoda, Titus Tscharntke and Tom Reynolds
|
||||||
|
// The Megaglest Team, under GNU GPL v3.0
|
||||||
|
// ==============================================================
|
||||||
|
|
||||||
define( 'INCLUSION_PERMITTED', true );
|
define( 'INCLUSION_PERMITTED', true );
|
||||||
require_once( 'config.php' );
|
require_once( 'config.php' );
|
||||||
require_once( 'functions.php' );
|
require_once( 'functions.php' );
|
||||||
|
@ -1,4 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
// Copyright (C) 2012 Mark Vejvoda, Titus Tscharntke and Tom Reynolds
|
||||||
|
// The Megaglest Team, under GNU GPL v3.0
|
||||||
|
// ==============================================================
|
||||||
|
|
||||||
define( 'INCLUSION_PERMITTED', true );
|
define( 'INCLUSION_PERMITTED', true );
|
||||||
require_once( 'config.php' );
|
require_once( 'config.php' );
|
||||||
|
@ -1,4 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
|
// Copyright (C) 2012 Mark Vejvoda, Titus Tscharntke and Tom Reynolds
|
||||||
|
// The Megaglest Team, under GNU GPL v3.0
|
||||||
|
// ==============================================================
|
||||||
|
|
||||||
define( 'INCLUSION_PERMITTED', true );
|
define( 'INCLUSION_PERMITTED', true );
|
||||||
require_once( 'config.php' );
|
require_once( 'config.php' );
|
||||||
require_once( 'functions.php' );
|
require_once( 'functions.php' );
|
||||||
|
@ -1,4 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
|
// Copyright (C) 2012 Mark Vejvoda, Titus Tscharntke and Tom Reynolds
|
||||||
|
// The Megaglest Team, under GNU GPL v3.0
|
||||||
|
// ==============================================================
|
||||||
|
|
||||||
define( 'INCLUSION_PERMITTED', true );
|
define( 'INCLUSION_PERMITTED', true );
|
||||||
require_once( 'config.php' );
|
require_once( 'config.php' );
|
||||||
require_once( 'functions.php' );
|
require_once( 'functions.php' );
|
||||||
|
@ -1,4 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
|
// Copyright (C) 2012 Mark Vejvoda, Titus Tscharntke and Tom Reynolds
|
||||||
|
// The Megaglest Team, under GNU GPL v3.0
|
||||||
|
// ==============================================================
|
||||||
|
|
||||||
define( 'INCLUSION_PERMITTED', true );
|
define( 'INCLUSION_PERMITTED', true );
|
||||||
require_once( 'config.php' );
|
require_once( 'config.php' );
|
||||||
require_once( 'functions.php' );
|
require_once( 'functions.php' );
|
||||||
|
@ -1,4 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
// Copyright (C) 2012 Mark Vejvoda, Titus Tscharntke and Tom Reynolds
|
||||||
|
// The Megaglest Team, under GNU GPL v3.0
|
||||||
|
// ==============================================================
|
||||||
|
|
||||||
define( 'INCLUSION_PERMITTED', true );
|
define( 'INCLUSION_PERMITTED', true );
|
||||||
require_once( 'config.php' );
|
require_once( 'config.php' );
|
||||||
|
@ -1,4 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
// Copyright (C) 2012 Mark Vejvoda, Titus Tscharntke and Tom Reynolds
|
||||||
|
// The Megaglest Team, under GNU GPL v3.0
|
||||||
|
// ==============================================================
|
||||||
|
|
||||||
define( 'INCLUSION_PERMITTED', true );
|
define( 'INCLUSION_PERMITTED', true );
|
||||||
require_once( 'config.php' );
|
require_once( 'config.php' );
|
||||||
|
@ -251,7 +251,7 @@ IF(BUILD_MEGAGLEST_MODEL_VIEWER OR BUILD_MEGAGLEST_MAP_EDITOR OR BUILD_MEGAGLEST
|
|||||||
graphics
|
graphics
|
||||||
graphics/freetype-gl
|
graphics/freetype-gl
|
||||||
graphics/gl
|
graphics/gl
|
||||||
graphics/md5
|
graphics/iqm
|
||||||
lua
|
lua
|
||||||
map
|
map
|
||||||
platform/common
|
platform/common
|
||||||
|
@ -1,12 +1,8 @@
|
|||||||
// ==============================================================
|
// ==============================================================
|
||||||
// This file is part of Glest Shared Library (www.glest.org)
|
// This file is part of MegaGlest Shared Library (www.megaglest.org)
|
||||||
//
|
//
|
||||||
// Copyright (C) 2001-2010 Martiño Figueroa and others
|
// Copyright (C) 2012 Mark Vejvoda, Titus Tscharntke
|
||||||
//
|
// The Megaglest Team, under GNU GPL v3.0
|
||||||
// You can redistribute this code and/or modify it under
|
|
||||||
// the terms of the GNU General Public License as published
|
|
||||||
// by the Free Software Foundation; either version 2 of the
|
|
||||||
// License, or (at your option) any later version
|
|
||||||
// ==============================================================
|
// ==============================================================
|
||||||
|
|
||||||
#ifndef FILE_READER_H
|
#ifndef FILE_READER_H
|
||||||
|
@ -1,3 +1,10 @@
|
|||||||
|
// ==============================================================
|
||||||
|
// This file is part of MegaGlest Shared Library (www.megaglest.org)
|
||||||
|
//
|
||||||
|
// Copyright (C) 2012 Mark Vejvoda, Titus Tscharntke
|
||||||
|
// The Megaglest Team, under GNU GPL v3.0
|
||||||
|
// ==============================================================
|
||||||
|
|
||||||
#ifndef _SHARED_GRAPHICS_BUFFER_H_
|
#ifndef _SHARED_GRAPHICS_BUFFER_H_
|
||||||
#define _SHARED_GRAPHICS_BUFFER_H_
|
#define _SHARED_GRAPHICS_BUFFER_H_
|
||||||
|
|
||||||
|
58
source/shared_lib/include/graphics/d3d9/context_d3d9.h
Normal file
58
source/shared_lib/include/graphics/d3d9/context_d3d9.h
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
// This file is part of MegaGlest Shared Library (www.megaglest.org)
|
||||||
|
//
|
||||||
|
// Copyright (C) 2012 Mark Vejvoda
|
||||||
|
//
|
||||||
|
// You can redistribute this code and/or modify it under
|
||||||
|
// the terms of the GNU General Public License as published
|
||||||
|
// by the Free Software Foundation; either version 2 of the
|
||||||
|
// License, or (at your option) any later version
|
||||||
|
// ==============================================================
|
||||||
|
|
||||||
|
#ifndef _SHARED_D3D9_DEVICECONTEXTD3D9_H_
|
||||||
|
#define _SHARED_D3D9_DEVICECONTEXTD3D9_H_
|
||||||
|
|
||||||
|
#include "context.h"
|
||||||
|
|
||||||
|
#include <d3d9.h>
|
||||||
|
|
||||||
|
namespace Shared{ namespace Graphics{ namespace D3d9{
|
||||||
|
|
||||||
|
// ===============================
|
||||||
|
// class ContextD3d9
|
||||||
|
// ===============================
|
||||||
|
|
||||||
|
class ContextD3d9: public Context{
|
||||||
|
private:
|
||||||
|
bool windowed;
|
||||||
|
bool hardware;
|
||||||
|
|
||||||
|
IDirect3D9 *d3dObject;
|
||||||
|
IDirect3DDevice9 *d3dDevice;
|
||||||
|
D3DCAPS9 caps;
|
||||||
|
D3DPRESENT_PARAMETERS d3dPresentParameters;
|
||||||
|
|
||||||
|
public:
|
||||||
|
bool getWindowed() const {return windowed;}
|
||||||
|
bool getHardware() const {return hardware;}
|
||||||
|
|
||||||
|
void setWindowed(bool windowed) {this->windowed= windowed;}
|
||||||
|
void setHardware(bool hardware) {this->hardware= hardware;}
|
||||||
|
|
||||||
|
ContextD3d9();
|
||||||
|
|
||||||
|
virtual void init();
|
||||||
|
virtual void end();
|
||||||
|
virtual void reset();
|
||||||
|
|
||||||
|
virtual void makeCurrent();
|
||||||
|
virtual void swapBuffers();
|
||||||
|
|
||||||
|
const D3DCAPS9 *getCaps() const {return ∩︀};
|
||||||
|
|
||||||
|
|
||||||
|
IDirect3DDevice9 *getD3dDevice() {return d3dDevice;}
|
||||||
|
};
|
||||||
|
|
||||||
|
}}}//end namespace
|
||||||
|
|
||||||
|
#endif
|
@ -1,3 +1,10 @@
|
|||||||
|
// ==============================================================
|
||||||
|
// This file is part of MegaGlest Shared Library (www.megaglest.org)
|
||||||
|
//
|
||||||
|
// Copyright (C) 2012 Mark Vejvoda, Titus Tscharntke
|
||||||
|
// The Megaglest Team, under GNU GPL v3.0
|
||||||
|
// ==============================================================
|
||||||
|
|
||||||
#ifndef _SHARED_D3D9_D3D9UTIL_H_
|
#ifndef _SHARED_D3D9_D3D9UTIL_H_
|
||||||
#define _SHARED_D3D9_D3D9UTIL_H_
|
#define _SHARED_D3D9_D3D9UTIL_H_
|
||||||
|
|
||||||
|
33
source/shared_lib/include/graphics/d3d9/font_d3d9.h
Normal file
33
source/shared_lib/include/graphics/d3d9/font_d3d9.h
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
// ==============================================================
|
||||||
|
// This file is part of MegaGlest Shared Library (www.megaglest.org)
|
||||||
|
//
|
||||||
|
// Copyright (C) 2012 Mark Vejvoda, Titus Tscharntke
|
||||||
|
// The Megaglest Team, under GNU GPL v3.0
|
||||||
|
// ==============================================================
|
||||||
|
|
||||||
|
#ifndef _SHARED_D3D9_FONTD3D9_H_
|
||||||
|
#define _SHARED_D3D9_FONTD3D9_H_
|
||||||
|
|
||||||
|
#include "font.h"
|
||||||
|
|
||||||
|
#include <d3dx9.h>
|
||||||
|
|
||||||
|
namespace Shared{ namespace Graphics{ namespace D3d9{
|
||||||
|
|
||||||
|
// ===============================
|
||||||
|
// class FontD3d9
|
||||||
|
// ===============================
|
||||||
|
|
||||||
|
class Font2DD3d9: public Font2D{
|
||||||
|
private:
|
||||||
|
LPD3DXFONT d3dFont;
|
||||||
|
|
||||||
|
public:
|
||||||
|
LPD3DXFONT getD3dFont() const {return d3dFont;}
|
||||||
|
virtual void init();
|
||||||
|
virtual void end();
|
||||||
|
};
|
||||||
|
|
||||||
|
}}}//end namespace
|
||||||
|
|
||||||
|
#endif
|
@ -0,0 +1,60 @@
|
|||||||
|
// ==============================================================
|
||||||
|
// This file is part of MegaGlest Shared Library (www.megaglest.org)
|
||||||
|
//
|
||||||
|
// Copyright (C) 2012 Mark Vejvoda, Titus Tscharntke
|
||||||
|
// The Megaglest Team, under GNU GPL v3.0
|
||||||
|
// ==============================================================
|
||||||
|
|
||||||
|
#ifndef _SHARED_D3D9_MODELRENDERERD3D9_H_
|
||||||
|
#define _SHARED_D3D9_MODELRENDERERD3D9_H_
|
||||||
|
|
||||||
|
#include "model_renderer.h"
|
||||||
|
#include "model.h"
|
||||||
|
|
||||||
|
#include <d3d9.h>
|
||||||
|
|
||||||
|
namespace Shared{ namespace Graphics{ namespace D3d9{
|
||||||
|
|
||||||
|
// ===============================
|
||||||
|
// class ModelRendererD3d9
|
||||||
|
// ===============================
|
||||||
|
|
||||||
|
class ModelRendererD3d9: public ModelRenderer{
|
||||||
|
private:
|
||||||
|
static const int defBufferPointCount= 100; //buffer size in vertices
|
||||||
|
static const int defBufferIndexCount= 100; //buffer size in vertices
|
||||||
|
|
||||||
|
struct CustomVertexPNTT{
|
||||||
|
Vec3f vertex;
|
||||||
|
Vec3f normal;
|
||||||
|
Vec2f texCoord;
|
||||||
|
Vec3f tangent;
|
||||||
|
};
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool rendering;
|
||||||
|
int bufferPointCount;
|
||||||
|
int bufferIndexCount;
|
||||||
|
|
||||||
|
IDirect3DDevice9 *d3dDevice;
|
||||||
|
IDirect3DVertexBuffer9 *d3dVertexBuffer;
|
||||||
|
IDirect3DIndexBuffer9 *d3dIndexBuffer;
|
||||||
|
IDirect3DVertexDeclaration9 *d3dVertexDeclarationPNT;
|
||||||
|
IDirect3DVertexDeclaration9 *d3dVertexDeclarationPNTT;
|
||||||
|
|
||||||
|
public:
|
||||||
|
ModelRendererD3d9();
|
||||||
|
~ModelRendererD3d9();
|
||||||
|
virtual void begin(bool renderNormals= true, bool renderTextures= true, bool renderColors= true);
|
||||||
|
virtual void end();
|
||||||
|
virtual void render(const Model *model);
|
||||||
|
virtual void renderNormalsOnly(const Model *model);
|
||||||
|
|
||||||
|
private:
|
||||||
|
void renderMesh(const Mesh *mesh);
|
||||||
|
void readyBuffers(int newPointCount, int newIndexCount);
|
||||||
|
};
|
||||||
|
|
||||||
|
}}}//end namespace
|
||||||
|
|
||||||
|
#endif
|
116
source/shared_lib/include/graphics/d3d9/shader_d3d9.h
Normal file
116
source/shared_lib/include/graphics/d3d9/shader_d3d9.h
Normal file
@ -0,0 +1,116 @@
|
|||||||
|
// ==============================================================
|
||||||
|
// This file is part of MegaGlest Shared Library (www.megaglest.org)
|
||||||
|
//
|
||||||
|
// Copyright (C) 2012 Mark Vejvoda, Titus Tscharntke
|
||||||
|
// The Megaglest Team, under GNU GPL v3.0
|
||||||
|
// ==============================================================
|
||||||
|
|
||||||
|
#ifndef _SHARED_D3D9_SHADERD3D9_H_
|
||||||
|
#define _SHARED_D3D9_SHADERD3D9_H_
|
||||||
|
|
||||||
|
#include "shader.h"
|
||||||
|
#include "vec.h"
|
||||||
|
|
||||||
|
#include <d3d9.h>
|
||||||
|
#include <d3dx9shader.h>
|
||||||
|
|
||||||
|
namespace Shared{ namespace Graphics{ namespace D3d9{
|
||||||
|
|
||||||
|
// ===============================
|
||||||
|
// class ShaderProgramD3d9
|
||||||
|
// ===============================
|
||||||
|
|
||||||
|
class VertexShaderD3d9;
|
||||||
|
class PixelShaderD3d9;
|
||||||
|
|
||||||
|
class ShaderProgramD3d9: public virtual ShaderProgram{
|
||||||
|
protected:
|
||||||
|
IDirect3DDevice9 *d3dDevice;
|
||||||
|
ID3DXConstantTable *d3dVsConstantTable;
|
||||||
|
ID3DXConstantTable *d3dPsConstantTable;
|
||||||
|
|
||||||
|
VertexShaderD3d9 *vertexShader;
|
||||||
|
PixelShaderD3d9 *pixelShader;
|
||||||
|
|
||||||
|
public:
|
||||||
|
ShaderProgramD3d9();
|
||||||
|
|
||||||
|
virtual void init(){};
|
||||||
|
virtual void end(){};
|
||||||
|
|
||||||
|
virtual void attach(VertexShader *vs, FragmentShader *fs);
|
||||||
|
virtual void activate();
|
||||||
|
|
||||||
|
virtual bool link(string &messages);
|
||||||
|
|
||||||
|
virtual void setUniform(const string &name, int value);
|
||||||
|
virtual void setUniform(const string &name, float value);
|
||||||
|
virtual void setUniform(const string &name, const Vec2f &value);
|
||||||
|
virtual void setUniform(const string &name, const Vec3f &value);
|
||||||
|
virtual void setUniform(const string &name, const Vec4f &value);
|
||||||
|
virtual void setUniform(const string &name, const Matrix3f &value);
|
||||||
|
virtual void setUniform(const string &name, const Matrix4f &value);
|
||||||
|
//virtual void setUniform(const string &name, const Texture *value);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// ===============================
|
||||||
|
// class ShaderD3d9
|
||||||
|
// ===============================
|
||||||
|
|
||||||
|
class ShaderD3d9: virtual public Shader{
|
||||||
|
protected:
|
||||||
|
ShaderSource source;
|
||||||
|
string target;
|
||||||
|
|
||||||
|
IDirect3DDevice9 *d3dDevice;
|
||||||
|
ID3DXConstantTable *d3dConstantTable;
|
||||||
|
|
||||||
|
public:
|
||||||
|
ShaderD3d9();
|
||||||
|
virtual void init(){};
|
||||||
|
virtual void end();
|
||||||
|
virtual void load(const string &path);
|
||||||
|
|
||||||
|
ID3DXConstantTable *getD3dConstantTable() const {return d3dConstantTable;}
|
||||||
|
|
||||||
|
void setTarget(const string &target) {this->target= target;}
|
||||||
|
};
|
||||||
|
|
||||||
|
// ===============================
|
||||||
|
// class VertexShaderD3d9
|
||||||
|
// ===============================
|
||||||
|
|
||||||
|
class VertexShaderD3d9: public ShaderD3d9, public VertexShader{
|
||||||
|
private:
|
||||||
|
IDirect3DVertexShader9 *d3dVertexShader;
|
||||||
|
|
||||||
|
public:
|
||||||
|
VertexShaderD3d9();
|
||||||
|
virtual void end();
|
||||||
|
|
||||||
|
virtual bool compile(string &messages);
|
||||||
|
|
||||||
|
IDirect3DVertexShader9 *getD3dVertexShader() const {return d3dVertexShader;}
|
||||||
|
};
|
||||||
|
|
||||||
|
// ===============================
|
||||||
|
// class PixelShaderD3d9
|
||||||
|
// ===============================
|
||||||
|
|
||||||
|
class PixelShaderD3d9: public ShaderD3d9, public FragmentShader{
|
||||||
|
private:
|
||||||
|
IDirect3DPixelShader9 *d3dPixelShader;
|
||||||
|
|
||||||
|
public:
|
||||||
|
PixelShaderD3d9();
|
||||||
|
virtual void end();
|
||||||
|
|
||||||
|
virtual bool compile(string &messages);
|
||||||
|
|
||||||
|
IDirect3DPixelShader9 *getD3dPixelShader() const {return d3dPixelShader;}
|
||||||
|
};
|
||||||
|
|
||||||
|
}}}//end namespace
|
||||||
|
|
||||||
|
#endif
|
32
source/shared_lib/include/graphics/d3d9/text_renderer_d3d9.h
Normal file
32
source/shared_lib/include/graphics/d3d9/text_renderer_d3d9.h
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
// ==============================================================
|
||||||
|
// This file is part of MegaGlest Shared Library (www.megaglest.org)
|
||||||
|
//
|
||||||
|
// Copyright (C) 2012 Mark Vejvoda, Titus Tscharntke
|
||||||
|
// The Megaglest Team, under GNU GPL v3.0
|
||||||
|
// ==============================================================
|
||||||
|
|
||||||
|
#ifndef _SHARED_D3D9_TEXTRENDERERD3D9_H_
|
||||||
|
#define _SHARED_D3D9_TEXTRENDERERD3D9_H_
|
||||||
|
|
||||||
|
#include "text_renderer.h"
|
||||||
|
|
||||||
|
namespace Shared{ namespace Graphics{ namespace D3d9{
|
||||||
|
|
||||||
|
// ===============================
|
||||||
|
// class TextRenderer2DD3d9
|
||||||
|
// ===============================
|
||||||
|
|
||||||
|
class TextRenderer2DD3d9: public TextRenderer2D{
|
||||||
|
private:
|
||||||
|
const Font *font;
|
||||||
|
Vec4f color;
|
||||||
|
|
||||||
|
public:
|
||||||
|
virtual void begin(const Font2D *font);
|
||||||
|
virtual void render(const string &text, int x, int y, bool centered= false);
|
||||||
|
virtual void end();
|
||||||
|
};
|
||||||
|
|
||||||
|
}}}//end namespace
|
||||||
|
|
||||||
|
#endif
|
48
source/shared_lib/include/graphics/d3d9/texture_d3d9.h
Normal file
48
source/shared_lib/include/graphics/d3d9/texture_d3d9.h
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
// ==============================================================
|
||||||
|
// This file is part of MegaGlest Shared Library (www.megaglest.org)
|
||||||
|
//
|
||||||
|
// Copyright (C) 2012 Mark Vejvoda, Titus Tscharntke
|
||||||
|
// The Megaglest Team, under GNU GPL v3.0
|
||||||
|
// ==============================================================
|
||||||
|
|
||||||
|
#ifndef _SHARED_D3D9_TEXTURED3D9_H_
|
||||||
|
#define _SHARED_D3D9_TEXTURED3D9_H_
|
||||||
|
|
||||||
|
#include "texture.h"
|
||||||
|
#include <d3d9.h>
|
||||||
|
|
||||||
|
namespace Shared{ namespace Graphics{ namespace D3d9{
|
||||||
|
|
||||||
|
// ===============================
|
||||||
|
// class Texture2DD3d9
|
||||||
|
// ===============================
|
||||||
|
|
||||||
|
class Texture2DD3d9: public Texture2D{
|
||||||
|
private:
|
||||||
|
IDirect3DTexture9 *d3dTexture;
|
||||||
|
|
||||||
|
public:
|
||||||
|
IDirect3DTexture9 *getD3dTexture() const {return d3dTexture;}
|
||||||
|
|
||||||
|
virtual void init(Filter textureFilter, int maxAnisotropy= 1);
|
||||||
|
virtual void end();
|
||||||
|
};
|
||||||
|
|
||||||
|
// ===============================
|
||||||
|
// class TextureCubeD3d9
|
||||||
|
// ===============================
|
||||||
|
|
||||||
|
class TextureCubeD3d9: public TextureCube{
|
||||||
|
private:
|
||||||
|
IDirect3DCubeTexture9 *d3dCubeTexture;
|
||||||
|
|
||||||
|
public:
|
||||||
|
IDirect3DCubeTexture9 *getD3dCubeTexture() const {return d3dCubeTexture;}
|
||||||
|
|
||||||
|
virtual void init(Filter textureFilter, int maxAnisotropy= 1);
|
||||||
|
virtual void end();
|
||||||
|
};
|
||||||
|
|
||||||
|
}}}//end namespace
|
||||||
|
|
||||||
|
#endif
|
@ -1,7 +1,8 @@
|
|||||||
// ==============================================================
|
// ==============================================================
|
||||||
// This file is part of Glest Shared Library (www.glest.org)
|
// This file is part of MegaGlest Shared Library (www.megaglest.org)
|
||||||
//
|
//
|
||||||
// Copyright (C) 2001-2008 Martiño Figueroa
|
// Copyright (C) 2012 Mark Vejvoda, Titus Tscharntke
|
||||||
|
// 2001-2008 Martiño Figueroa
|
||||||
//
|
//
|
||||||
// You can redistribute this code and/or modify it under
|
// You can redistribute this code and/or modify it under
|
||||||
// the terms of the GNU General Public License as published
|
// the terms of the GNU General Public License as published
|
||||||
|
@ -1,3 +1,10 @@
|
|||||||
|
// ==============================================================
|
||||||
|
// This file is part of MegaGlest Shared Library (www.megaglest.org)
|
||||||
|
//
|
||||||
|
// Copyright (C) 2012 Mark Vejvoda, Titus Tscharntke
|
||||||
|
// The Megaglest Team, under GNU GPL v3.0
|
||||||
|
// ==============================================================
|
||||||
|
|
||||||
#include "FileReader.h"
|
#include "FileReader.h"
|
||||||
|
|
||||||
namespace Shared {
|
namespace Shared {
|
||||||
|
62
source/shared_lib/sources/graphics/buffer.cpp
Normal file
62
source/shared_lib/sources/graphics/buffer.cpp
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
// ==============================================================
|
||||||
|
// This file is part of MegaGlest Shared Library (www.megaglest.org)
|
||||||
|
//
|
||||||
|
// Copyright (C) 2012 Mark Vejvoda, Titus Tscharntke
|
||||||
|
// The Megaglest Team, under GNU GPL v3.0
|
||||||
|
// ==============================================================
|
||||||
|
|
||||||
|
#include "buffer.h"
|
||||||
|
|
||||||
|
#include "leak_dumper.h"
|
||||||
|
|
||||||
|
namespace Shared{ namespace Graphics{
|
||||||
|
|
||||||
|
// =====================================================
|
||||||
|
// class VertexBuffer
|
||||||
|
// =====================================================
|
||||||
|
|
||||||
|
VertexBuffer::VertexBuffer(){
|
||||||
|
positionPointer= NULL;
|
||||||
|
normalPointer= NULL;
|
||||||
|
for(int i= 0; i<texCoordCount; ++i){
|
||||||
|
texCoordPointers[i]= NULL;
|
||||||
|
texCoordCoordCounts[i]= -1;
|
||||||
|
}
|
||||||
|
for(int i= 0; i<attribCount; ++i){
|
||||||
|
attribPointers[i]= NULL;
|
||||||
|
attribCoordCounts[i]= -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void VertexBuffer::setPositionPointer(void *pointer){
|
||||||
|
positionPointer= pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
void VertexBuffer::setNormalPointer(void *pointer){
|
||||||
|
normalPointer= pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
void VertexBuffer::setTexCoordPointer(void *pointer, int texCoordIndex, int coordCount){
|
||||||
|
texCoordPointers[texCoordIndex]= pointer;
|
||||||
|
texCoordCoordCounts[texCoordIndex]= coordCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
void VertexBuffer::setAttribPointer(void *pointer, int attribIndex, int coordCount, const string &name){
|
||||||
|
attribPointers[attribIndex]= pointer;
|
||||||
|
attribCoordCounts[attribIndex]= coordCount;
|
||||||
|
attribNames[attribIndex]= name;
|
||||||
|
}
|
||||||
|
|
||||||
|
// =====================================================
|
||||||
|
// class IndexBuffer
|
||||||
|
// =====================================================
|
||||||
|
|
||||||
|
IndexBuffer::IndexBuffer(){
|
||||||
|
indexPointer= NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
void IndexBuffer::setIndexPointer(void *pointer){
|
||||||
|
indexPointer= pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
}}//end namespace
|
@ -1,3 +1,13 @@
|
|||||||
|
// This file is part of MegaGlest Shared Library (www.megaglest.org)
|
||||||
|
//
|
||||||
|
// Copyright (C) 2012 Mark Vejvoda
|
||||||
|
//
|
||||||
|
// You can redistribute this code and/or modify it under
|
||||||
|
// the terms of the GNU General Public License as published
|
||||||
|
// by the Free Software Foundation; either version 2 of the
|
||||||
|
// License, or (at your option) any later version
|
||||||
|
// ==============================================================
|
||||||
|
|
||||||
#include "context_d3d9.h"
|
#include "context_d3d9.h"
|
||||||
|
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
@ -1,3 +1,10 @@
|
|||||||
|
// ==============================================================
|
||||||
|
// This file is part of MegaGlest Shared Library (www.megaglest.org)
|
||||||
|
//
|
||||||
|
// Copyright (C) 2012 Mark Vejvoda, Titus Tscharntke
|
||||||
|
// The Megaglest Team, under GNU GPL v3.0
|
||||||
|
// ==============================================================
|
||||||
|
|
||||||
#include "d3d9_util.h"
|
#include "d3d9_util.h"
|
||||||
|
|
||||||
namespace Shared{ namespace Graphics{ namespace D3d9{
|
namespace Shared{ namespace Graphics{ namespace D3d9{
|
||||||
|
@ -1,3 +1,10 @@
|
|||||||
|
// ==============================================================
|
||||||
|
// This file is part of MegaGlest Shared Library (www.megaglest.org)
|
||||||
|
//
|
||||||
|
// Copyright (C) 2012 Mark Vejvoda, Titus Tscharntke
|
||||||
|
// The Megaglest Team, under GNU GPL v3.0
|
||||||
|
// ==============================================================
|
||||||
|
|
||||||
#include "font_d3d9.h"
|
#include "font_d3d9.h"
|
||||||
|
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
180
source/shared_lib/sources/graphics/d3d9/model_renderer_d3d9.cpp
Normal file
180
source/shared_lib/sources/graphics/d3d9/model_renderer_d3d9.cpp
Normal file
@ -0,0 +1,180 @@
|
|||||||
|
// ==============================================================
|
||||||
|
// This file is part of MegaGlest Shared Library (www.megaglest.org)
|
||||||
|
//
|
||||||
|
// Copyright (C) 2012 Mark Vejvoda, Titus Tscharntke
|
||||||
|
// The Megaglest Team, under GNU GPL v3.0
|
||||||
|
// ==============================================================
|
||||||
|
|
||||||
|
#include "model_renderer_d3d9.h"
|
||||||
|
|
||||||
|
#include <cassert>
|
||||||
|
|
||||||
|
#include "graphics_interface.h"
|
||||||
|
#include "context_d3d9.h"
|
||||||
|
#include "texture_d3d9.h"
|
||||||
|
#include "interpolation.h"
|
||||||
|
#include "d3d9_util.h"
|
||||||
|
|
||||||
|
#include "leak_dumper.h"
|
||||||
|
|
||||||
|
namespace Shared{ namespace Graphics{ namespace D3d9{
|
||||||
|
|
||||||
|
// ===============================================
|
||||||
|
// class ModelRendererD3d9
|
||||||
|
// ===============================================
|
||||||
|
|
||||||
|
D3DVERTEXELEMENT9 d3dVertexElementsPNT[]=
|
||||||
|
{
|
||||||
|
{0, 0, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0},
|
||||||
|
{0, 12, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_NORMAL, 0},
|
||||||
|
{0, 24, D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 0},
|
||||||
|
D3DDECL_END()
|
||||||
|
};
|
||||||
|
|
||||||
|
D3DVERTEXELEMENT9 d3dVertexElementsPNTT[]=
|
||||||
|
{
|
||||||
|
{0, 0, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0},
|
||||||
|
{0, 12, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_NORMAL, 0},
|
||||||
|
{0, 24, D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 0},
|
||||||
|
{0, 32, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TANGENT, 0},
|
||||||
|
D3DDECL_END()
|
||||||
|
};
|
||||||
|
|
||||||
|
ModelRendererD3d9::ModelRendererD3d9(){
|
||||||
|
rendering= false;
|
||||||
|
|
||||||
|
GraphicsInterface &gi= GraphicsInterface::getInstance();
|
||||||
|
d3dDevice= static_cast<ContextD3d9*>(gi.getCurrentContext())->getD3dDevice();
|
||||||
|
|
||||||
|
bufferPointCount= 0;
|
||||||
|
bufferIndexCount= 0;
|
||||||
|
|
||||||
|
D3DCALL(d3dDevice->CreateVertexDeclaration(d3dVertexElementsPNT, &d3dVertexDeclarationPNT));
|
||||||
|
D3DCALL(d3dDevice->CreateVertexDeclaration(d3dVertexElementsPNTT, &d3dVertexDeclarationPNTT));
|
||||||
|
|
||||||
|
readyBuffers(defBufferPointCount, defBufferIndexCount);
|
||||||
|
}
|
||||||
|
|
||||||
|
ModelRendererD3d9::~ModelRendererD3d9(){
|
||||||
|
d3dVertexBuffer->Release();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ModelRendererD3d9::begin(bool renderNormals, bool renderTextures, bool renderColors){
|
||||||
|
rendering= true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ModelRendererD3d9::end(){
|
||||||
|
rendering= false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ModelRendererD3d9::render(const Model *model){
|
||||||
|
assert(rendering);
|
||||||
|
|
||||||
|
//render every mesh
|
||||||
|
for(uint32 i=0; i<model->getMeshCount(); ++i){
|
||||||
|
renderMesh(model->getMesh(i));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ModelRendererD3d9::renderNormalsOnly(const Model *model){
|
||||||
|
}
|
||||||
|
|
||||||
|
// ====================== Private ===============================================
|
||||||
|
|
||||||
|
void ModelRendererD3d9::renderMesh(const Mesh *mesh){
|
||||||
|
|
||||||
|
CustomVertexPNTT *vertices;
|
||||||
|
uint32 *indices;
|
||||||
|
|
||||||
|
readyBuffers(mesh->getVertexCount(), mesh->getIndexCount());
|
||||||
|
|
||||||
|
//lock vertex buffer
|
||||||
|
D3DCALL(d3dVertexBuffer->Lock(0, mesh->getVertexCount()*sizeof(CustomVertexPNTT), (void**) &vertices, 0));
|
||||||
|
|
||||||
|
//copy data vertex buffer
|
||||||
|
const InterpolationData *interpolationData= mesh->getInterpolationData();
|
||||||
|
|
||||||
|
for(int i=0; i<mesh->getVertexCount(); ++i){
|
||||||
|
vertices[i].vertex= interpolationData->getVertices()[i];
|
||||||
|
vertices[i].normal= interpolationData->getNormals()[i];
|
||||||
|
Vec2f texCoord= mesh->getTexCoords()[i];
|
||||||
|
vertices[i].texCoord= Vec2f(texCoord.x, texCoord.y);
|
||||||
|
}
|
||||||
|
if(mesh->getTangents()!=NULL){
|
||||||
|
for(int i=0; i<mesh->getVertexCount(); ++i){
|
||||||
|
vertices[i].tangent= mesh->getTangents()[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//unlock vertex buffer
|
||||||
|
D3DCALL(d3dVertexBuffer->Unlock());
|
||||||
|
|
||||||
|
//lock index buffer
|
||||||
|
D3DCALL(d3dIndexBuffer->Lock(0, mesh->getIndexCount()*sizeof(uint32), (void**) &indices, 0));
|
||||||
|
|
||||||
|
//copy data
|
||||||
|
for(int i=0; i<mesh->getIndexCount(); i+=3){
|
||||||
|
indices[i]= mesh->getIndices()[i];
|
||||||
|
indices[i+1]= mesh->getIndices()[i+2];
|
||||||
|
indices[i+2]= mesh->getIndices()[i+1];
|
||||||
|
}
|
||||||
|
|
||||||
|
//unlock
|
||||||
|
D3DCALL(d3dIndexBuffer->Unlock());
|
||||||
|
|
||||||
|
//set stream data
|
||||||
|
D3DCALL(d3dDevice->SetStreamSource(0, d3dVertexBuffer, 0, sizeof(CustomVertexPNTT)));
|
||||||
|
D3DCALL(d3dDevice->SetVertexDeclaration(mesh->getTangents()==NULL? d3dVertexDeclarationPNT: d3dVertexDeclarationPNTT));
|
||||||
|
D3DCALL(d3dDevice->SetIndices(d3dIndexBuffer));
|
||||||
|
|
||||||
|
//set textures
|
||||||
|
int textureUnit= 0;
|
||||||
|
for(int i=0; i<meshTextureCount; ++i){
|
||||||
|
if(mesh->getTexture(i)!=NULL){
|
||||||
|
const Texture2DD3d9* texture2DD3d9= static_cast<const Texture2DD3d9*>(mesh->getTexture(i));
|
||||||
|
D3DCALL(d3dDevice->SetTexture(textureUnit, texture2DD3d9->getD3dTexture()));
|
||||||
|
++textureUnit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//render
|
||||||
|
D3DCALL(d3dDevice->BeginScene());
|
||||||
|
D3DCALL(d3dDevice->DrawIndexedPrimitive(D3DPT_TRIANGLELIST, 0, 0, mesh->getVertexCount(), 0, mesh->getIndexCount()/3));
|
||||||
|
D3DCALL(d3dDevice->EndScene());
|
||||||
|
|
||||||
|
//reset textures
|
||||||
|
for(int i=0; i<meshTextureCount; ++i){
|
||||||
|
D3DCALL(d3dDevice->SetTexture(i, NULL));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ModelRendererD3d9::readyBuffers(int newPointCount, int newIndexCount){
|
||||||
|
|
||||||
|
//vertices, if the buffer is to small allocate a new buffer
|
||||||
|
if(bufferPointCount<newPointCount){
|
||||||
|
bufferPointCount= newPointCount;
|
||||||
|
|
||||||
|
D3DCALL(d3dDevice->CreateVertexBuffer(
|
||||||
|
bufferPointCount*sizeof(CustomVertexPNTT),
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
D3DPOOL_MANAGED,
|
||||||
|
&d3dVertexBuffer,
|
||||||
|
NULL));
|
||||||
|
}
|
||||||
|
|
||||||
|
//indices
|
||||||
|
if(bufferIndexCount<newIndexCount){
|
||||||
|
bufferIndexCount= newIndexCount;
|
||||||
|
|
||||||
|
D3DCALL(d3dDevice->CreateIndexBuffer(
|
||||||
|
bufferIndexCount*sizeof(uint32),
|
||||||
|
0,
|
||||||
|
D3DFMT_INDEX32,
|
||||||
|
D3DPOOL_MANAGED,
|
||||||
|
&d3dIndexBuffer,
|
||||||
|
NULL));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}}}//end namespace
|
@ -1,3 +1,10 @@
|
|||||||
|
// ==============================================================
|
||||||
|
// This file is part of MegaGlest Shared Library (www.megaglest.org)
|
||||||
|
//
|
||||||
|
// Copyright (C) 2012 Mark Vejvoda, Titus Tscharntke
|
||||||
|
// The Megaglest Team, under GNU GPL v3.0
|
||||||
|
// ==============================================================
|
||||||
|
|
||||||
#include "shader_d3d9.h"
|
#include "shader_d3d9.h"
|
||||||
|
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
@ -0,0 +1,47 @@
|
|||||||
|
// ==============================================================
|
||||||
|
// This file is part of MegaGlest Shared Library (www.megaglest.org)
|
||||||
|
//
|
||||||
|
// Copyright (C) 2012 Mark Vejvoda, Titus Tscharntke
|
||||||
|
// The Megaglest Team, under GNU GPL v3.0
|
||||||
|
// ==============================================================
|
||||||
|
|
||||||
|
#include "text_renderer_d3d9.h"
|
||||||
|
|
||||||
|
#include <d3d9.h>
|
||||||
|
#include <d3d9types.h>
|
||||||
|
|
||||||
|
#include "font_d3d9.h"
|
||||||
|
#include "d3d9_util.h"
|
||||||
|
#include "leak_dumper.h"
|
||||||
|
|
||||||
|
namespace Shared{ namespace Graphics{ namespace D3d9{
|
||||||
|
|
||||||
|
// ===============================================
|
||||||
|
// class TextRenderer2DD3d9
|
||||||
|
// ===============================================
|
||||||
|
|
||||||
|
void TextRenderer2DD3d9::begin(const Font2D *font){
|
||||||
|
this->font= font;
|
||||||
|
this->color= Vec4f(1.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
void TextRenderer2DD3d9::render(const string &text, int x, int y, bool centered){
|
||||||
|
RECT rect;
|
||||||
|
rect.bottom= y;
|
||||||
|
rect.left= x;
|
||||||
|
rect.top= y;
|
||||||
|
rect.right= x;
|
||||||
|
|
||||||
|
D3DCOLOR d3dColor= D3DCOLOR_ARGB(
|
||||||
|
static_cast<int>(color.w*255),
|
||||||
|
static_cast<int>(color.x*255),
|
||||||
|
static_cast<int>(color.y*255),
|
||||||
|
static_cast<int>(color.z*255));
|
||||||
|
|
||||||
|
static_cast<const Font2DD3d9*>(font)->getD3dFont()->DrawText(text.c_str(), -1, &rect, DT_NOCLIP, d3dColor);
|
||||||
|
}
|
||||||
|
|
||||||
|
void TextRenderer2DD3d9::end(){
|
||||||
|
}
|
||||||
|
|
||||||
|
}}}//end namespace
|
@ -1,3 +1,10 @@
|
|||||||
|
// ==============================================================
|
||||||
|
// This file is part of MegaGlest Shared Library (www.megaglest.org)
|
||||||
|
//
|
||||||
|
// Copyright (C) 2012 Mark Vejvoda, Titus Tscharntke
|
||||||
|
// The Megaglest Team, under GNU GPL v3.0
|
||||||
|
// ==============================================================
|
||||||
|
|
||||||
#include "texture_d3d9.h"
|
#include "texture_d3d9.h"
|
||||||
|
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
@ -1,3 +1,15 @@
|
|||||||
|
// ==============================================================
|
||||||
|
// This file is part of MegaGlest Shared Library (www.megaglest.org)
|
||||||
|
//
|
||||||
|
// Copyright (C) 2012 Mark Vejvoda, Titus Tscharntke
|
||||||
|
// 2001-2008 Martiño Figueroa
|
||||||
|
//
|
||||||
|
// You can redistribute this code and/or modify it under
|
||||||
|
// the terms of the GNU General Public License as published
|
||||||
|
// by the Free Software Foundation; either version 2 of the
|
||||||
|
// License, or (at your option) any later version
|
||||||
|
// ==============================================================
|
||||||
|
|
||||||
#include "randomgen.h"
|
#include "randomgen.h"
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user