2024-04-24 05:56 CEST

View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0000605Spring engineGeneralpublic2007-09-20 18:53
ReporterKDR_11k 
Assigned ToKloot 
PrioritynormalSeverityfeatureReproducibilityN/A
StatusresolvedResolutionfixed 
Product Version 
Target VersionFixed in Version 
Summary0000605: [patch] get/set ALPHA_THRESHOLD
DescriptionThis introduces the COB get/set variable 103, ALPHA_THRESHOLD. It ranges from 0-255 and changes the glAlphaFunc to use that alpha value as its minimum. In practice this allows disintegration-style effects or the reverse for build animations.
Additional InformationI'm using 103 because Lurker's patch will use the numbers up to and including 102. Feel free to change it.
TagsNo tags attached.
Checked infolog.txt for Errors
Attached Files
  • patch file icon alphaThresholdSet.patch (2,229 bytes) 2007-08-22 16:45 -
    Index: Sim/Units/COB/CobInstance.cpp
    ===================================================================
    --- Sim/Units/COB/CobInstance.cpp	(revision 4237)
    +++ Sim/Units/COB/CobInstance.cpp	(working copy)
    @@ -98,6 +98,7 @@
     #define CURRENT_FUEL             93 // set or get
     #define TRANSPORT_ID             94 // get
     #define SHIELD_POWER             95 // set or get
    +#define ALPHA_THRESHOLD			103 // set or get
     
     // * NOTE: [LUA0 - LUA9] are defined in CobThread.cpp as [110 - 119]
     
    @@ -1120,6 +1121,9 @@
     		const CPlasmaRepulser* shield = (CPlasmaRepulser*)unit->shieldWeapon;
     		return int(shield->curPower * float(COBSCALE));
     	}
    +	case ALPHA_THRESHOLD: {
    +		return unit->alphaThreshold * 255;
    +	}
     	default:
     		logOutput.Print("CobError: Unknown get constant %d  (params = %d %d %d %d)",
     		                val, p1, p2, p3, p4);
    @@ -1312,6 +1316,10 @@
     			}
     			break;
     		}
    +		case ALPHA_THRESHOLD: {
    +			unit->alphaThreshold=float(param) / 255.0f;
    +			break;
    +		}
     		default: {
     			logOutput.Print("CobError: Unknown set constant %d", val);
     		}
    Index: Sim/Units/Unit.cpp
    ===================================================================
    --- Sim/Units/Unit.cpp	(revision 4237)
    +++ Sim/Units/Unit.cpp	(working copy)
    @@ -205,7 +205,8 @@
     	prevMoveType(NULL),
     	usingScriptMoveType(false),
     	lodCount(0),
    -	currentLOD(0)
    +	currentLOD(0),
    +	alphaThreshold(.1)
     {
     #ifdef DIRECT_CONTROL_ALLOWED
     	directControl=0;
    @@ -847,6 +848,7 @@
     inline void CUnit::DrawModel()
     {
     	if (lodCount <= 0) {
    +		glAlphaFunc(GL_GEQUAL,alphaThreshold);
     		localmodel->Draw();
     	} else {
     		localmodel->DrawLOD(currentLOD);
    @@ -2268,6 +2270,8 @@
     
     				CR_MEMBER(lastTerrainType),
     				CR_MEMBER(curTerrainType),
    +				
    +				CR_MEMBER(alphaThreshold),
     
     				CR_MEMBER(selfDCountdown),
     				CR_RESERVED(16),
    Index: Sim/Units/Unit.h
    ===================================================================
    --- Sim/Units/Unit.h	(revision 4237)
    +++ Sim/Units/Unit.h	(working copy)
    @@ -345,6 +345,8 @@
     	vector<float> lodLengths; // length-per-pixel
     	LuaUnitMaterial luaMats[LUAMAT_TYPE_COUNT];
     
    +	float alphaThreshold; //minimum alpha value for a texel to be drawn
    +
     protected:
     	void ChangeTeamReset();
     	void UpdateResources();
    
    patch file icon alphaThresholdSet.patch (2,229 bytes) 2007-08-22 16:45 +

-Relationships
+Relationships

-Notes

~0001159

Argh (reporter)

Will it operate, per Piece, in the drawing code?

~0001160

KDR_11k (reporter)

No, it applies to the whole unit. I'm not sure that can be done without breaking the encapsulation.

~0001279

KDR_11k (reporter)

So, was this rejected?

~0001280

Kloot (developer)

More likely it just went unnoticed
(until now).

~0001281

Kloot (developer)

commited in r4412.
+Notes

-Issue History
Date Modified Username Field Change
2007-08-22 16:45 KDR_11k New Issue
2007-08-22 16:45 KDR_11k File Added: alphaThresholdSet.patch
2007-08-25 14:38 Argh Note Added: 0001159
2007-08-25 18:03 KDR_11k Note Added: 0001160
2007-09-20 12:34 KDR_11k Note Added: 0001279
2007-09-20 13:24 Kloot Note Added: 0001280
2007-09-20 18:52 Kloot Note Added: 0001281
2007-09-20 18:53 Kloot Status new => resolved
2007-09-20 18:53 Kloot Resolution open => fixed
2007-09-20 18:53 Kloot Assigned To => Kloot
+Issue History