# Home    # nevrax.com   
Nevrax
Nevrax.org
#News
#Mailing-list
#Documentation
#CVS
#Bugs
#License
Docs
 
Documentation  
Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages   Search  

ps_attrib_maker_bin_op.cpp

Go to the documentation of this file.
00001 
00007 /* Copyright, 2001 Nevrax Ltd.
00008  *
00009  * This file is part of NEVRAX NEL.
00010  * NEVRAX NEL is free software; you can redistribute it and/or modify
00011  * it under the terms of the GNU General Public License as published by
00012  * the Free Software Foundation; either version 2, or (at your option)
00013  * any later version.
00014 
00015  * NEVRAX NEL is distributed in the hope that it will be useful, but
00016  * WITHOUT ANY WARRANTY; without even the implied warranty of
00017  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
00018  * General Public License for more details.
00019 
00020  * You should have received a copy of the GNU General Public License
00021  * along with NEVRAX NEL; see the file COPYING. If not, write to the
00022  * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
00023  * MA 02111-1307, USA.
00024  */
00025 
00026 #include "std3d.h"
00027 
00028 #include "ps_attrib_maker_bin_op.h"
00029 
00030 
00031 namespace NL3D
00032 {
00033 
00034         void MakePrivate(uint8 * dest, const NLMISC::CRGBA *src1, const NLMISC::CRGBA *src2, uint32 stride, uint32 numAttrib, CPSBinOp::BinOp op)
00035         {
00036                 switch (op)
00037                 {
00038                         case CPSBinOp::modulate:
00039                         {
00040                                 // CRGBA OPTIMISATION
00041                                 NLMISC::CRGBA::modulateColors((NLMISC::CRGBA *) dest, src1, src2, numAttrib, sizeof(NLMISC::CRGBA), stride);                            
00042                         }
00043                         break;
00044                         case CPSBinOp::add:
00045                         {
00046                                 // CRGBA OPTIMISATION
00047                                 NLMISC::CRGBA::addColors((NLMISC::CRGBA *) dest, src1, src2, numAttrib, sizeof(NLMISC::CRGBA), stride);                         
00048                         }
00049                         break;
00050                         case CPSBinOp::subtract:
00051                         {
00052                                 // CRGBA OPTIMISATION
00053                                 NLMISC::CRGBA::subtractColors((NLMISC::CRGBA *) dest, src1, src2, numAttrib, sizeof(NLMISC::CRGBA), stride);
00054                         }
00055                         break;
00056                         default: break;
00057                 }
00058         }
00059 
00060         void Make4Private(uint8 * dest, const NLMISC::CRGBA *src1, const NLMISC::CRGBA *src2, uint32 stride, uint32 numAttrib, CPSBinOp::BinOp op)
00061         {               
00062                 switch (op)
00063                 {
00064                         case CPSBinOp::modulate:
00065                         {
00066                                 // CRGBA OPTIMISATION
00067                                 NLMISC::CRGBA::modulateColors((NLMISC::CRGBA *) dest, src1, src2, numAttrib, sizeof(NLMISC::CRGBA), stride, 4);                         
00068                         }
00069                         break;
00070                         case CPSBinOp::add:
00071                         {
00072                                 // CRGBA OPTIMISATION
00073                                 NLMISC::CRGBA::addColors((NLMISC::CRGBA *) dest, src1, src2, numAttrib, sizeof(NLMISC::CRGBA), stride, 4);                              
00074                         }
00075                         break;
00076                         case CPSBinOp::subtract:
00077                         {
00078                                 // CRGBA OPTIMISATION
00079                                 NLMISC::CRGBA::subtractColors((NLMISC::CRGBA *) dest, src1, src2, numAttrib, sizeof(NLMISC::CRGBA), stride, 4);
00080                         }
00081                         break;
00082                         default: break;
00083                 }
00084         }
00085 
00086         
00087         void MakeNPrivate(uint8 * dest, const NLMISC::CRGBA *src1, const NLMISC::CRGBA *src2, uint32 stride, uint32 numAttrib, CPSBinOp::BinOp op, uint nbReplicate)
00088         {
00089                 switch (op)
00090                 {
00091                         case CPSBinOp::modulate:
00092                         {
00093                                 // CRGBA OPTIMISATION
00094                                 NLMISC::CRGBA::modulateColors((NLMISC::CRGBA *) dest, src1, src2, numAttrib, sizeof(NLMISC::CRGBA), stride, nbReplicate);                               
00095                         }
00096                         break;
00097                         case CPSBinOp::add:
00098                         {
00099                                 // CRGBA OPTIMISATION
00100                                 NLMISC::CRGBA::addColors((NLMISC::CRGBA *) dest, src1, src2, numAttrib, sizeof(NLMISC::CRGBA), stride, nbReplicate);                            
00101                         }
00102                         break;
00103                         case CPSBinOp::subtract:
00104                         {
00105                                 // CRGBA OPTIMISATION
00106                                 NLMISC::CRGBA::subtractColors((NLMISC::CRGBA *) dest, src1, src2, numAttrib, sizeof(NLMISC::CRGBA), stride, nbReplicate);
00107                         }
00108                         break;
00109                         default: break;
00110                 }               
00111         }
00112 
00113 
00114 
00115 
00116 
00117 } // NL3D