Exemple #1
0
/*===================================================================
		Execute Translucent Execute Buffers for specific group...
===================================================================*/
void ExecuteTransExe( u_int16_t group )
{
	int16_t	i;
	u_int16_t	Model;
	bool	Display;

	for( i = 0 ; i < NumOfTransExe ; i++ )
	{
		if ( TransExe[i].group == group )
		{
			Display = true;

#ifdef NEW_LIGHTING
	    render_lighting_enabled = TransExe[i].render_lighting_enabled;
	    render_lighting_use_only_light_color_and_blend = TransExe[i].render_lighting_use_only_light_color_and_blend;
 		  render_lighting_use_only_light_color = TransExe[i].render_lighting_use_only_light_color;
    	render_lighting_point_lights_only = TransExe[i].render_lighting_point_lights_only;
 		  render_light_ambience = TransExe[i].render_light_ambience;
   		render_light_ambience_alpha = TransExe[i].render_light_ambience_alpha;
	    render_color_blend_red = TransExe[i].render_color_blend_red;
 		  render_color_blend_green = TransExe[i].render_color_blend_green;
   		render_color_blend_blue = TransExe[i].render_color_blend_blue;
#endif

			if( TransExe[i].Model != (u_int16_t) -1 )
			{
				Model = TransExe[i].Model;
				if( !( Models[ Model ].Flags & MODFLAG_Clip ) )
					continue; // do not display fields clipped

				if( ( Models[ Model ].Flags & MODFLAG_Light ) )
				{
					if( !LightModel2( Models[ Model ].ModelNum, &Models[ Model ].Pos ) ) Display = false;
				}

				switch( Models[ Model ].Func )
				{
					case MODFUNC_Explode:
						ProcessModelExec( /*TransExe[i].lpExBuf*/&TransExe[i].renderObject, TransExe[i].NumVerts, Models[ Model ].Scale, Models[ Model ].MaxScale, 1, 0, 0 );
						break;
		
					case MODFUNC_Regen:
						ProcessModelExec( /*TransExe[i].lpExBuf*/&TransExe[i].renderObject, TransExe[i].NumVerts, Models[ Model ].Scale, Models[ Model ].MaxScale, 0, 1, 0 );
						break;
					case MODFUNC_Scale:
					case MODFUNC_Scale2:
						ProcessModelExec( /*TransExe[i].lpExBuf*/&TransExe[i].renderObject, TransExe[i].NumVerts, Models[ Model ].Scale, Models[ Model ].MaxScale, 0, 0, 1 );
						break;

					case MODFUNC_SphereZone:
						ProcessSphereZoneModelExec( /*TransExe[i].lpExBuf*/&TransExe[i].renderObject, TransExe[i].NumVerts, (u_int8_t) Models[ Model ].Red, (u_int8_t) Models[ Model ].Green, (u_int8_t) Models[ Model ].Blue );
						break;

					case MODFUNC_OrbitPulsar:
						if( ( Ships[ Models[ Model ].Ship ].Object.Flags & SHIP_Stealth ) )
						{
							if( !LightModel( Model, &Models[ Model ].Pos ) ) Display = false;
						}
						break;

					case MODFUNC_ScaleDonut:
//						ProcessModelExec( TransExe[i].lpExBuf, TransExe[i].NumVerts, Models[ Model ].Scale, Models[ Model ].MaxScale, 1, 1, 1 );
						break;
					
					case MODFUNC_Nothing:
					default:
						break;
				}
			}

			if( TransExe[i].UseIdentity	== 1 )
			{
				FSSetWorld(&identity);
			}
			else
			{
				FSSetWorld(&TransExe[i].Matrix);
			}

			if( Display )
					draw_object(&TransExe[i].renderObject);

#ifdef NEW_LIGHTING
			render_reset_lighting_variables();
#endif
		}
	}
#ifdef NEW_LIGHTING
	render_reset_lighting_variables();
#endif
	FSSetWorld(&identity);
}
Exemple #2
0
/*-------------------------------------------------------------------
        Execute Translucent Execute Buffers for specific group...
-------------------------------------------------------------------*/
void ExecuteTransExe( uint16 group )
{
    int16   i;
    uint16  Model;
    BOOL    Display;

    for( i = 0 ; i < NumOfTransExe ; i++ )
    {
        if ( TransExe[i].group == group )
        {
            Display = TRUE;

            if( TransExe[i].Model != (uint16) -1 )
            {
                Model = TransExe[i].Model;
                if( !( Models[ Model ].Flags & MODFLAG_Clip ) )
                    continue; // do not display fields clipped

                if( ( Models[ Model ].Flags & MODFLAG_Light ) )
                {
                    if( !LightModel2( Models[ Model ].ModelNum, &Models[ Model ].Pos ) ) Display = FALSE;
                }

                switch( Models[ Model ].Func )
                {
                    case MODFUNC_Explode:
                        ProcessModelExec( TransExe[i].lpExBuf, TransExe[i].NumVerts, Models[ Model ].Scale, Models[ Model ].MaxScale, 1, 0, 0 );
                        break;
        
                    case MODFUNC_Regen:
                        ProcessModelExec( TransExe[i].lpExBuf, TransExe[i].NumVerts, Models[ Model ].Scale, Models[ Model ].MaxScale, 0, 1, 0 );
                        break;
                    case MODFUNC_Scale:
                    case MODFUNC_Scale2:
                        ProcessModelExec( TransExe[i].lpExBuf, TransExe[i].NumVerts, Models[ Model ].Scale, Models[ Model ].MaxScale, 0, 0, 1 );
                        break;

                    case MODFUNC_SphereZone:
                        ProcessSphereZoneModelExec( TransExe[i].lpExBuf, TransExe[i].NumVerts, (uint8) Models[ Model ].Red, (uint8) Models[ Model ].Green, (uint8) Models[ Model ].Blue );
                        break;

                    case MODFUNC_OrbitPulsar:
                        if( ( Ships[ Models[ Model ].Ship ].Object.Flags & SHIP_Stealth ) )
                        {
                            if( !LightModel( Model, &Models[ Model ].Pos ) ) Display = FALSE;
                        }
                        break;

                    case MODFUNC_ScaleDonut:
//                      ProcessModelExec( TransExe[i].lpExBuf, TransExe[i].NumVerts, Models[ Model ].Scale, Models[ Model ].MaxScale, 1, 1, 1 );
                        break;
                    
                    case MODFUNC_Nothing:
                    default:
                        break;
                }
            }

            if( TransExe[i].UseIdentity == 1 )
            {
                d3dappi.lpD3DDevice->lpVtbl->SetMatrix(d3dappi.lpD3DDevice, hWorld, &identity);
            }else{
                d3dappi.lpD3DDevice->lpVtbl->SetMatrix(d3dappi.lpD3DDevice, hWorld, &TransExe[i].Matrix);
            }

            if( Display )
            {
#ifdef SOFTWARE_ENABLE
                if( SoftwareVersion )
                {
                    CWExecute2( d3dappi.lpD3DDevice, TransExe[i].lpExBuf , d3dappi.lpD3DViewport, D3DEXECUTE_CLIPPED);
                }
                else
#endif
                {
                    d3dappi.lpD3DDevice->lpVtbl->Execute(d3dappi.lpD3DDevice, TransExe[i].lpExBuf , d3dappi.lpD3DViewport, D3DEXECUTE_CLIPPED);
                }
            }
        }
    }
    d3dappi.lpD3DDevice->lpVtbl->SetMatrix(d3dappi.lpD3DDevice, hWorld, &identity);
    
}