X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;ds=inline;f=source%2Fmupen64plus-video-arachnoid%2Fsrc%2FCombiner%2FDummyCombiner.cpp;fp=source%2Fmupen64plus-video-arachnoid%2Fsrc%2FCombiner%2FDummyCombiner.cpp;h=29ff59d4415c40f27ad8135df45467304c24a4b1;hb=22726e4d55be26faa48b57b22689cbedde27ae44;hp=0000000000000000000000000000000000000000;hpb=fc5d46b49a19d41f9f2da5a9336daec452900475;p=mupen64plus-pandora.git diff --git a/source/mupen64plus-video-arachnoid/src/Combiner/DummyCombiner.cpp b/source/mupen64plus-video-arachnoid/src/Combiner/DummyCombiner.cpp new file mode 100755 index 0000000..29ff59d --- /dev/null +++ b/source/mupen64plus-video-arachnoid/src/Combiner/DummyCombiner.cpp @@ -0,0 +1,83 @@ +/****************************************************************************** + * Arachnoid Graphics Plugin for Mupen64Plus + * http://bitbucket.org/wahrhaft/mupen64plus-video-arachnoid/ + * + * Copyright (C) 2007 Kristofer Karlsson, Rickard Niklasson + * + * 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 2 + * 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + *****************************************************************************/ + +#include "DummyCombiner.h" +#include "CombinerStructs.h" +#include "ExtensionChecker.h" +#include "MultiTexturingExt.h" + +//----------------------------------------------------------------------------- +//* Initialize +//! Checks if multitexturing is supported +//----------------------------------------------------------------------------- +void DummyCombiner::initialize() +{ + ARB_multitexture = isExtensionSupported("GL_ARB_multitexture"); +} + +//----------------------------------------------------------------------------- +//* Create New Texture Enviroment +//! Allocates a new texture enviroment +//! @param[in] colorCombiner How to combine and get a color +//! @param[in] alphaCombiner How to combine and get an alpha value +//! @return The texture enviroment that was created +//----------------------------------------------------------------------------- +TexEnvCombiner* DummyCombiner::createNewTextureEnviroment(Combiner* colorCombiner, Combiner *alphaCombiner) +{ + TexEnvCombiner* texEnv = new TexEnvCombiner(); + texEnv->usesT0 = false; + texEnv->usesT1 = false; + texEnv->mode = GL_REPLACE; + texEnv->vertex.color = COMBINED; + texEnv->vertex.alpha = COMBINED; + + //For each stage in alpha combiner + for (int i = 0; i < alphaCombiner->numStages; i++) + { + //For each operation in stage + for (int j = 0; j < alphaCombiner->stage[i].numOps; j++) + { + CombinerOp* op = &colorCombiner->stage[i].op[j]; + + if ( op->param1 == TEXEL0 ) + { + texEnv->usesT0 = true; + } + } + } + return texEnv; +} + +//----------------------------------------------------------------------------- +//* Set Texture Enviroment +//! Sets OpenGL (enables texturing) +//----------------------------------------------------------------------------- +void DummyCombiner::setTextureEnviroment(TexEnvCombiner* texEnv) +{ + //Enable Texturing + if ( ARB_multitexture ) + glActiveTextureARB( GL_TEXTURE0_ARB ); + + if ( texEnv->usesT0 ) + glEnable( GL_TEXTURE_2D ); + else + glDisable( GL_TEXTURE_2D ); +}