/* ** Command & Conquer Renegade(tm) ** Copyright 2025 Electronic Arts Inc. ** ** 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 . */ /*********************************************************************************************** *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S *** *********************************************************************************************** * * * Project Name : ww3d2 * * * * $Archive:: /Commando/Code/ww3d2/bwrender.cpp $* * * * Original Author:: Jani Penttinen * * * * $Author:: Greg_h $* * * * $Modtime:: 4/04/01 10:14a $* * * * $Revision:: 2 $* * * *---------------------------------------------------------------------------------------------* * Functions: * * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #include "bwrender.h" #include "vp.h" #include BWRenderClass::Buffer::Buffer(unsigned char* buffer_, int scale_) : buffer(buffer_), scale(scale_), minv(3), maxv(scale_-3) { } BWRenderClass::Buffer::~Buffer() { } void BWRenderClass::Buffer::Set_H_Line(int start_x, int end_x, int y) { if (y=maxv || end_x=maxv) return; if (start_x=maxv) end_x=maxv-1; unsigned char* ptr=buffer+scale*y+start_x; int w=end_x-start_x; if (w) { ::memset(ptr,0x00,w); /* // Blurring (test) *(ptr-1)&=0x80; *(ptr-2)&=0xc0; *(ptr+w)&=0x80; *(ptr+w+1)&=0xc0; for (int a=0;a(vertices), half_scale, half_scale, count*2); } // -------------------------------------------------------------------- static inline bool Cull( const Vector2& c1, const Vector2& c2, const Vector2& c3) { float x1=c2[0]-c1[0]; float y1=c2[1]-c1[1]; float x2=c3[0]-c1[0]; float y2=c3[1]-c1[1]; float r=x1*y2-x2*y1; if (r<0) return false; return true; } void BWRenderClass::Render_Triangle_Strip(const unsigned long* indices,int index_count) { index_count-=2; bool b=false; for (int n=0;nx_step_2) { float t=x_step_1; x_step_1=x_step_2; x_step_2=t; } while (ycnt>0) { pixel_buffer.Set_H_Line(WWMath::Float_To_Long(x_left),WWMath::Float_To_Long(x_right),y); x_left+=x_step_1; x_right+=x_step_2; ycnt--; y++; } } else { if (xcf[0]0) { pixel_buffer.Set_H_Line(WWMath::Float_To_Long(x_left),WWMath::Float_To_Long(x_right),y); x_left+=x_step_1; x_right+=x_step_2; ycnt--; y++; } } }