minor tweaks

This commit is contained in:
Garux
2025-04-26 16:42:06 +05:00
parent 496ded1b9a
commit 4cf97f5651
11 changed files with 27 additions and 29 deletions
+1
View File
@@ -93,6 +93,7 @@ public:
int FindPointsForPlane( DPlane* plane, DPoint** pnts, int maxpnts );
DBrush();
DBrush( DBrush&& ) noexcept = delete;
virtual ~DBrush();
bool operator==( const DBrush* other ) const;
+1 -1
View File
@@ -142,7 +142,7 @@ bool DPlane::operator !=( DPlane& other ){
return true;
}
DWinding DPlane::BaseWindingForPlane(){
DWinding DPlane::BaseWindingForPlane() const {
int i, x;
vec_t max, v;
vec3_t org, vright, vup;
+1 -1
View File
@@ -36,7 +36,7 @@ class DPlane
public:
DPlane( const vec3_t va, const vec3_t vb, const vec3_t vc, const char* textureName, bool bDetail );
void ScaleTexture();
DWinding BaseWindingForPlane();
DWinding BaseWindingForPlane() const ;
void Rebuild();
+1 -1
View File
@@ -262,7 +262,7 @@ DWinding* DWinding::ReverseWinding(){
return c;
}
bool DWinding::ChopWindingInPlace( DPlane* chopPlane, vec_t epsilon ){
bool DWinding::ChopWindingInPlace( const DPlane* chopPlane, vec_t epsilon ){
vec_t dists[MAX_POINTS_ON_WINDING + 4];
int sides[MAX_POINTS_ON_WINDING + 4];
int counts[3] = {0};
+1 -1
View File
@@ -38,7 +38,7 @@ public:
void AllocWinding( int points );
bool ChopWinding( DPlane* chopPlane );
bool ChopWindingInPlace( DPlane* chopPlane, vec_t ON_EPSILON );
bool ChopWindingInPlace( const DPlane* chopPlane, vec_t ON_EPSILON );
void ClipWindingEpsilon( DPlane* chopPlane, vec_t epsilon, DWinding** front, DWinding** back );
void CheckWinding();
+1 -1
View File
@@ -305,7 +305,7 @@ bool DoDoorsBox( DoorRS* rs ){
rs->nOrientation = radioNS->isChecked()
? DIRECTION_NS
: DIRECTION_EW;
: DIRECTION_EW;
return true;
}
return false;
+3 -3
View File
@@ -348,7 +348,6 @@ void DoBuildStairs(){
}
void DoBuildDoors(){
UndoableCommand undo( "bobToolz.buildDoors" );
// ensure we have something selected
if ( GlobalSelectionSystem().countSelected() != 1 ) {
//DoMessageBox( "Invalid number of brushes selected, choose 1 only", "Error", EMessageBoxType::Error );
@@ -360,11 +359,12 @@ void DoBuildDoors(){
{
const char *tex = GetCurrentTexture();
strcpy( rs.mainTexture, tex + ( string_equal_prefix_nocase( tex, "textures/" )
? strlen( "textures/" )
: 0 ) );
? strlen( "textures/" )
: 0 ) );
}
if ( DoDoorsBox( &rs ) ) {
UndoableCommand undo( "bobToolz.buildDoors" );
vec3_t vMin, vMax;
{
@@ -207,7 +207,7 @@ td.formatted_questions ol { margin-top: 0px; margin-bottom: 0px; }
<li><strong><code>-bouncescale</code> F:</strong> Scaling factor for radiosity</li>
<li><strong><code>-bounce</code> N:</strong> Maximal number of bounces for radiosity</li>
<li><strong><code>-brightness</code> F:</strong> Scaling factor for resulting lightmaps brightness</li>
<li><strong><code>-cheapgrid</code>:</strong> Use <code>-cheap</code> style lighting for radiosity</li>
<li><strong><code>-cheapgrid</code>:</strong> Use <code>-cheap</code> style lighting for light grid</li>
<li><strong><code>-cheap</code>:</strong> Abort vertex light calculations when white is reached</li>
<li><strong><code>-compensate</code> F:</strong> Lightmap compensate (darkening factor applied after everything else)</li>
<li><strong><code>-contrast</code> F:</strong> -255 .. 255 lighting contrast, default = 0</li>
+15 -18
View File
@@ -317,10 +317,9 @@ std::pair<winding_t, winding_t> ClipWindingEpsilonStrict( const winding_t& in
float dists[MAX_POINTS_ON_WINDING + 4];
EPlaneSide sides[MAX_POINTS_ON_WINDING + 4];
int counts[3] = { 0 };
size_t i, j;
// determine sides for each point
for ( i = 0; i < in.size(); i++ )
for ( size_t i = 0; i < in.size(); i++ )
{
dists[i] = plane3_distance_to_point( plane, in[i] );
@@ -336,8 +335,8 @@ std::pair<winding_t, winding_t> ClipWindingEpsilonStrict( const winding_t& in
}
counts[sides[i]]++;
}
sides[i] = sides[0];
dists[i] = dists[0];
sides[in.size()] = sides[0];
dists[in.size()] = dists[0];
if ( !counts[eSideFront] && !counts[eSideBack] ) {
return {};
@@ -355,7 +354,7 @@ std::pair<winding_t, winding_t> ClipWindingEpsilonStrict( const winding_t& in
winding_t front = AllocWinding( maxpts );
winding_t back = AllocWinding( maxpts );
for ( i = 0; i < in.size(); i++ )
for ( size_t i = 0; i < in.size(); i++ )
{
const Vector3& p1 = in[i];
@@ -380,7 +379,7 @@ std::pair<winding_t, winding_t> ClipWindingEpsilonStrict( const winding_t& in
const Vector3& p2 = in[winding_next( in, i )];
const double dot = dists[i] / ( dists[i] - dists[i + 1] );
Vector3 mid;
for ( j = 0; j < 3; j++ )
for ( size_t j = 0; j < 3; j++ )
{ // avoid round off error when possible
if ( plane.normal()[j] == 1 ) {
mid[j] = plane.dist();
@@ -427,7 +426,6 @@ std::pair<winding_t, winding_t> ClipWindingEpsilon( const winding_t& in, cons
*/
void ChopWindingInPlaceAccu( winding_accu_t& inout, const Plane3& plane, float crudeEpsilon ){
size_t counts[3] = { 0 };
size_t i, j;
double dists[MAX_POINTS_ON_WINDING + 1];
EPlaneSide sides[MAX_POINTS_ON_WINDING + 1];
@@ -466,7 +464,7 @@ void ChopWindingInPlaceAccu( winding_accu_t& inout, const Plane3& plane, float c
static const double smallestEpsilonAllowed = ( (double) VEC_SMALLEST_EPSILON_AROUND_ONE ) * 0.5;
const double fineEpsilon = std::max( smallestEpsilonAllowed, (double) crudeEpsilon );
for ( i = 0; i < inout.size(); i++ )
for ( size_t i = 0; i < inout.size(); i++ )
{
dists[i] = plane3_distance_to_point( plane, inout[i] );
if ( dists[i] > fineEpsilon ) {
@@ -480,8 +478,8 @@ void ChopWindingInPlaceAccu( winding_accu_t& inout, const Plane3& plane, float c
}
counts[sides[i]]++;
}
sides[i] = sides[0];
dists[i] = dists[0];
sides[inout.size()] = sides[0];
dists[inout.size()] = dists[0];
// I'm wondering if whatever code that handles duplicate planes is robust enough
// that we never get a case where two nearly equal planes result in 2 NULL windings
@@ -500,7 +498,7 @@ void ChopWindingInPlaceAccu( winding_accu_t& inout, const Plane3& plane, float c
winding_accu_t f;
f.reserve( counts[eSideFront] + 2 );
for ( i = 0; i < inout.size(); i++ )
for ( size_t i = 0; i < inout.size(); i++ )
{
const DoubleVector3& p1 = inout[i];
@@ -524,7 +522,7 @@ void ChopWindingInPlaceAccu( winding_accu_t& inout, const Plane3& plane, float c
// w is in the range (0,1).
const double w = dists[i] / ( dists[i] - dists[i + 1] );
DoubleVector3 mid;
for ( j = 0; j < 3; j++ )
for ( size_t j = 0; j < 3; j++ )
{
// Avoid round-off error when possible. Check axis-aligned normal.
if ( plane.normal()[j] == 1 ) {
@@ -556,10 +554,9 @@ void ChopWindingInPlace( winding_t& inout, const Plane3f& plane, float epsilon )
float dists[MAX_POINTS_ON_WINDING + 4];
EPlaneSide sides[MAX_POINTS_ON_WINDING + 4];
int counts[3] = { 0 };
size_t i, j;
// determine sides for each point
for ( i = 0; i < in.size(); i++ )
for ( size_t i = 0; i < in.size(); i++ )
{
dists[i] = plane3_distance_to_point( plane, in[i] );
if ( dists[i] > epsilon ) {
@@ -574,8 +571,8 @@ void ChopWindingInPlace( winding_t& inout, const Plane3f& plane, float epsilon )
}
counts[sides[i]]++;
}
sides[i] = sides[0];
dists[i] = dists[0];
sides[in.size()] = sides[0];
dists[in.size()] = dists[0];
if ( !counts[eSideFront] ) {
inout.clear();
@@ -588,7 +585,7 @@ void ChopWindingInPlace( winding_t& inout, const Plane3f& plane, float epsilon )
winding_t f = AllocWinding( in.size() + 4 ); // cant use counts[0]+2 because of fp grouping errors
for ( i = 0; i < in.size(); i++ )
for ( size_t i = 0; i < in.size(); i++ )
{
const Vector3& p1 = in[i];
@@ -610,7 +607,7 @@ void ChopWindingInPlace( winding_t& inout, const Plane3f& plane, float epsilon )
const double dot = dists[i] / ( dists[i] - dists[i + 1] );
Vector3 mid;
for ( j = 0; j < 3; j++ )
for ( size_t j = 0; j < 3; j++ )
{ // avoid round off error when possible
if ( plane.normal()[j] == 1 ) {
mid[j] = plane.dist();
+1 -1
View File
@@ -172,7 +172,7 @@ static void HelpLight()
{ "-bouncescale <F>", "Scaling factor for radiosity" },
{ "-bounce <N>", "Maximal number of bounces for radiosity" },
{ "-brightness <F>", "Scaling factor for resulting lightmaps brightness" },
{ "-cheapgrid", "Use `-cheap` style lighting for radiosity" },
{ "-cheapgrid", "Use `-cheap` style lighting for light grid" },
{ "-cheap", "Abort vertex light calculations when white is reached" },
{ "-compensate <F>", "Lightmap compensate (darkening factor applied after everything else)" },
{ "-contrast <F>", "-255 .. 255 lighting contrast, default = 0" },
+1 -1
View File
@@ -509,7 +509,7 @@ struct shaderInfo_t
float subdivisions; /* from a "tesssize xxx" */
float backsplashFraction; /* floating point value, usually 0.05 */
float backsplashDistance; /* default 16 */
float backsplashDistance; /* default 23 */
float lightSubdivide; /* default 999 */
float lightFilterRadius; /* ydnar: lightmap filtering/blurring radius for lights created by this shader (default: 0) */