MCPcopy Create free account
hub / github.com/DaedalusX64/daedalus / RenderUsingRenderSettings

Method RenderUsingRenderSettings

Source/SysPSP/HLEGraphics/RendererPSP.cpp:562–687  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

560}
561
562void RendererPSP::RenderUsingRenderSettings( const CBlendStates * states, DaedalusVtx * p_vertices, u32 num_vertices, u32 triangle_mode, u32 render_flags)
563{
564 DAEDALUS_PROFILE( "RendererPSP::RenderUsingRenderSettings" );
565
566 const CAlphaRenderSettings * alpha_settings( states->GetAlphaSettings() );
567
568 SRenderState state;
569
570 state.Vertices = p_vertices;
571 state.NumVertices = num_vertices;
572 state.PrimitiveColour = mPrimitiveColour;
573 state.EnvironmentColour = mEnvColour;
574
575 //Avoid copying vertices twice if we already save a copy to render fog //Corn
576 DaedalusVtx * p_FogVtx( mVtx_Save );
577 if( mTnL.Flags.Fog )
578 {
579 p_FogVtx = static_cast<DaedalusVtx *>(sceGuGetMemory(num_vertices * sizeof(DaedalusVtx)));
580 memcpy( p_FogVtx, p_vertices, num_vertices * sizeof( DaedalusVtx ) );
581 }
582 else if( states->GetNumStates() > 1 )
583 {
584 memcpy( mVtx_Save, p_vertices, num_vertices * sizeof( DaedalusVtx ) );
585 }
586
587 for( u32 i {}; i < states->GetNumStates(); ++i )
588 {
589 const CRenderSettings * settings( states->GetColourSettings( i ) );
590
591 bool install_texture0( settings->UsesTexture0() || alpha_settings->UsesTexture0() );
592 bool install_texture1( settings->UsesTexture1() || alpha_settings->UsesTexture1() );
593
594 SRenderStateOut out;
595
596 memset( &out, 0, sizeof( out ) );
597
598 settings->Apply( install_texture0 || install_texture1, state, out );
599 alpha_settings->Apply( install_texture0 || install_texture1, state, out );
600
601 // TODO: this nobbles the existing diffuse colour on each pass. Need to use a second buffer...
602 if( i > 0 )
603 {
604 memcpy( p_vertices, p_FogVtx, num_vertices * sizeof( DaedalusVtx ) );
605 }
606
607 if(out.VertexExpressionRGB != nullptr)
608 {
609 out.VertexExpressionRGB->ApplyExpressionRGB( state );
610 }
611 if(out.VertexExpressionA != nullptr)
612 {
613 out.VertexExpressionA->ApplyExpressionAlpha( state );
614 }
615
616 bool installed_texture {false};
617
618 u32 texture_idx {};
619

Callers

nothing calls this directly

Calls 12

GetNumStatesMethod · 0.80
ApplyExpressionRGBMethod · 0.80
ApplyExpressionAlphaMethod · 0.80
GetColourMethod · 0.80
GetScaleXMethod · 0.80
GetScaleYMethod · 0.80
SetWhiteMethod · 0.80
GetOrCreateTextureMethod · 0.80
UsesTexture0Method · 0.45
UsesTexture1Method · 0.45
ApplyMethod · 0.45
InstallTextureMethod · 0.45

Tested by

no test coverage detected