<commit_before>#include "TwoPassCanvas.h"
#include "EditPanel.h"

#include "render/ShaderMgr.h"
#include "render/ScreenFBO.h"
#include "render/SpriteRenderer.h"

namespace d2d
{

TwoPassCanvas::TwoPassCanvas(EditPanel* stage)
	: OnePassCanvas(stage)
{
}

void TwoPassCanvas::OnSize(int w, int h)
{
	ScreenFBO::Instance()->GetFBO().ChangeSize(w, h);
}

void TwoPassCanvas::OnDrawWhole() const
{
	const FBO& fbo = ScreenFBO::Instance()->GetFBO();
	ShaderMgr* mgr = ShaderMgr::Instance();

	SpriteRenderer::Instance()->SetCamera(GetCamera());

	//////////////////////////////////////////////////////////////////////////
	// Draw to FBO
	//////////////////////////////////////////////////////////////////////////
	if (IsDirty()) {
 		mgr->SetFBO(fbo.GetFboID());
		OnePassCanvas::OnDrawWhole();
		wxLogDebug("pass 22222222222222222");
	} else {
		wxLogDebug("pass 1");
	}

	//////////////////////////////////////////////////////////////////////////
	// Draw to Screen
	//////////////////////////////////////////////////////////////////////////

	mgr->SetFBO(0);
	mgr->SetTexture(0);

	mgr->Screen();
	mgr->DrawScreen(fbo.GetTexID());
}

}<commit_msg>[FIXED] canvas pass two 画第二遍时没清空<commit_after>#include "TwoPassCanvas.h"
#include "EditPanel.h"

#include "render/ShaderMgr.h"
#include "render/ScreenFBO.h"
#include "render/SpriteRenderer.h"

namespace d2d
{

TwoPassCanvas::TwoPassCanvas(EditPanel* stage)
	: OnePassCanvas(stage)
{
}

void TwoPassCanvas::OnSize(int w, int h)
{
	ScreenFBO::Instance()->GetFBO().ChangeSize(w, h);
}

void TwoPassCanvas::OnDrawWhole() const
{
	const FBO& fbo = ScreenFBO::Instance()->GetFBO();
	ShaderMgr* mgr = ShaderMgr::Instance();

	SpriteRenderer::Instance()->SetCamera(GetCamera());

	//////////////////////////////////////////////////////////////////////////
	// Draw to FBO
	//////////////////////////////////////////////////////////////////////////
	if (IsDirty()) {
 		mgr->SetFBO(fbo.GetFboID());
		OnePassCanvas::OnDrawWhole();
		wxLogDebug("pass 22222222222222222");
	} else {
		wxLogDebug("pass 1");
	}

	//////////////////////////////////////////////////////////////////////////
	// Draw to Screen
	//////////////////////////////////////////////////////////////////////////

	mgr->SetFBO(0);
	mgr->SetTexture(0);

	glClearColor(m_bg_color.r, m_bg_color.g, m_bg_color.b, m_bg_color.a);
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

	mgr->Screen();
	mgr->DrawScreen(fbo.GetTexID());
}

}
{'fraction_non_alphanumeric': 0.3735632183908046, 'fraction_numerical': 0.017241379310344827, 'mean_word_length': 1.7787913340935007, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 2, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6331827', 'n_tokens_mistral': 790, 'n_tokens_neox': 757, 'n_words': 114}