Advertisement
Guest User

Untitled

a guest
Jun 28th, 2017
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.89 KB | None | 0 0
  1. // temp.cpp : Defines the entry point for the console application.
  2. //
  3.  
  4. #include "stdafx.h"
  5.  
  6.  
  7. int main(int argc, _TCHAR* argv[])
  8. {
  9.     // D +/- {(1-C)* A + C * B}
  10.     float textureColor[] = {1.0,0.5,0};
  11.     float rasterColor[] = {1.0,0,0};
  12.  
  13.     float SetZero[] = {0.0,0.0,0.0};
  14.     float SetOne[] = {1.0,1.0,1.0};
  15.  
  16.  
  17.     float* A = SetZero;
  18.     float* B = SetOne;
  19.     float* C = textureColor;
  20.     float* D = rasterColor;
  21.  
  22.     bool add = true;
  23.  
  24.  
  25.     float EndColour[3];
  26.  
  27.  
  28.     for(int i=0;i<3;i++)
  29.     {
  30.  
  31.         float tA = (A != NULL ? A[i] : 0);
  32.         float tB = (B != NULL ? B[i] : 0);
  33.         float tC = (C != NULL ? C[i] : 0);
  34.         float tD = (D != NULL ? D[i] : 0);
  35.  
  36.         if(add)
  37.             EndColour[i] = (tD) + ((255 - tC) * tA + tC * tB );
  38.         else
  39.             EndColour[i] = (tD) - ((255 - tC) * tA + tC * tB );
  40.     }
  41.  
  42.  
  43.     printf("end colour: %f %f %f\n",EndColour[0],EndColour[1],EndColour[2]);
  44.    
  45.     char pause[2];
  46.     scanf("%d",pause);
  47.     return 0;
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement