From 4531ac88d3c022866d564be40c20593de4c70bfc Mon Sep 17 00:00:00 2001 From: Piotr Dziwinski Date: Fri, 22 Jun 2012 15:54:16 +0200 Subject: Moved old implementations to src/old --- src/graphics/common/planet.cpp | 247 ----------------------------------------- 1 file changed, 247 deletions(-) delete mode 100644 src/graphics/common/planet.cpp (limited to 'src/graphics/common/planet.cpp') diff --git a/src/graphics/common/planet.cpp b/src/graphics/common/planet.cpp deleted file mode 100644 index 6be1d31..0000000 --- a/src/graphics/common/planet.cpp +++ /dev/null @@ -1,247 +0,0 @@ -// * This file is part of the COLOBOT source code -// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch -// * -// * 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/. - -// planet.cpp - - -#include -#include -#include - -#include "common/struct.h" -#include "math/const.h" -#include "graphics/d3d/d3dengine.h" -#include "math/old/d3dmath.h" -#include "common/event.h" -#include "common/misc.h" -#include "common/iman.h" -#include "math/old/math3d.h" -#include "graphics/common/planet.h" - - - - -// Constructor of the terrain. - -CPlanet::CPlanet(CInstanceManager* iMan, CD3DEngine* engine) -{ - m_iMan = iMan; - m_iMan->AddInstance(CLASS_PLANET, this); - - m_engine = engine; - Flush(); - -} - -// Destructor of the terrain. - -CPlanet::~CPlanet() -{ -} - - -// Removes all the planets. - -void CPlanet::Flush() -{ - int i, j; - - for ( j=0 ; j<2 ; j++ ) - { - for ( i=0 ; iRetPause() ) return true; - - m_time += event.rTime; - - for ( i=0 ; iLoadTexture(m_planet[j][i].name); - } - } -} - -// Draws all the planets. - -void CPlanet::Draw() -{ - LPDIRECT3DDEVICE7 device; - D3DVERTEX2 vertex[4]; // 2 triangles - Math::Vector n; - Math::Point p1, p2; - float eyeDirH, eyeDirV, dp, u1, u2, v1, v2, a; - int i; - - device = m_engine->RetD3DDevice(); - eyeDirH = m_engine->RetEyeDirH(); - eyeDirV = m_engine->RetEyeDirV(); - - n = Math::Vector(0.0f, 0.0f, -1.0f); // normal - dp = 0.5f/256.0f; - - for ( i=0 ; iSetTexture(m_planet[m_mode][i].name); - - if ( m_planet[m_mode][i].bTGA ) - { - m_engine->SetState(D3DSTATEWRAP|D3DSTATEALPHA); - } - else - { - m_engine->SetState(D3DSTATEWRAP|D3DSTATETTb); - } - - a = eyeDirH + m_planet[m_mode][i].angle.x; - p1.x = Math::Mod(a, Math::PI*2.0f)-0.5f; - - a = eyeDirV + m_planet[m_mode][i].angle.y; - p1.y = 0.4f+(Math::Mod(a+Math::PI, Math::PI*2.0f)-Math::PI)*(2.0f/Math::PI); - - p1.x -= m_planet[m_mode][i].dim/2.0f*0.75f; - p1.y -= m_planet[m_mode][i].dim/2.0f; - p2.x = p1.x+m_planet[m_mode][i].dim*0.75f; - p2.y = p1.y+m_planet[m_mode][i].dim; - - u1 = m_planet[m_mode][i].uv1.x + dp; - v1 = m_planet[m_mode][i].uv1.y + dp; - u2 = m_planet[m_mode][i].uv2.x - dp; - v2 = m_planet[m_mode][i].uv2.y - dp; - - vertex[0] = D3DVERTEX2(Math::Vector(p1.x, p1.y, 0.0f), n, u1,v2); - vertex[1] = D3DVERTEX2(Math::Vector(p1.x, p2.y, 0.0f), n, u1,v1); - vertex[2] = D3DVERTEX2(Math::Vector(p2.x, p1.y, 0.0f), n, u2,v2); - vertex[3] = D3DVERTEX2(Math::Vector(p2.x, p2.y, 0.0f), n, u2,v1); - - device->DrawPrimitive(D3DPT_TRIANGLESTRIP, D3DFVF_VERTEX2, vertex, 4, NULL); - m_engine->AddStatisticTriangle(2); - } -} - - -// Creates a new planet. - -bool CPlanet::Create(int mode, Math::Point start, float dim, float speed, - float dir, char *name, Math::Point uv1, Math::Point uv2) -{ - int i; - - if ( mode < 0 ) mode = 0; - if ( mode > 1 ) mode = 1; - - for ( i=0 ; i 1 ) mode = 1; - m_mode = mode; -} - -int CPlanet::RetMode() -{ - return m_mode; -} - -- cgit v1.2.3-1-g7c22