projector.cpp

来自「java实现的简单的分形树。简单易学!是学习分形知识的很好的例子。其java语法」· C++ 代码 · 共 25 行

CPP
25
字号
#include "stdafx.h"

#include "Projector.h"


void CProjector::computeTextureProjection( const SMatrix4x4& projectorMatrix, SMatrix4x4& dest )
{
	const CRenderCamera& camera = G_RENDERCTX->getCamera();

    // | -0.5     0        0        0 |
    // | 0        0.5      0        0 |
    // | 0        0        0        0 |
    // | 0.5      0.5      1        1 |
	SMatrix4x4 matTexScale;
	matTexScale.identify();
	matTexScale._11 = 0.5f;
	matTexScale._22 = -0.5f;
	matTexScale._33 = 0.0f;
	matTexScale.getOrigin().set( 0.5f, 0.5f, 1.0f );

	SMatrix4x4 matTmp = camera.getProjectionMatrix() * matTexScale;
	matTmp = projectorMatrix * matTmp;
	dest = camera.getViewMatrix() * matTmp;
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?