// 当前渲染相机的参数
QGlobalCamera* curRenderCamera = _getWorld()->getMainCam();
const Matrix4& matView = curRenderCamera->_getCamMatView();
float zNear = curRenderCamera->getNearClipDistance();
float fovYHalf = curRenderCamera->getFOVy().valueRadians() * 0.5f;
float tanFov = Math::Tan(fovYHalf);
float asp = curRenderCamera->getAspectRatio();
float heightNear = tanFov * zNear * 2;
float widthNear = asp * heightNear;
float screenMaxSize = std::max( widthNear, heightNear );
// 自己的参数
Vector3 rsPos = _getRSPosWorld();
Vector3 posInViewSpace = matView * rsPos;
float zView = -posInViewSpace.z;
// 调节
const float projRef = 0.1f * screenMaxSize; // 要求占屏幕大小比例
float zViewMin = zNear + 0.01f;
if ( zView < zViewMin )
zView = zViewMin;
float projRefLong = Math::Sqrt( zNear * zNear + projRef * projRef );
// ref / ref_l = r / z_view
float r = projRef / projRefLong * zView;
float s_adj = r / AXIS_LEN;
Vector3 v_adj(s_adj);
相关文章
- 12-10axis2+struts拦截地址冲突问题
- 12-10Unreal Engine 4 渲染目标(Render Target)教程 之动态网格绘制(Dynamic Mesh Painting)(上)
- 12-10完美地诠释了matplotlib画图的figure→axes→axis结构
- 12-10react render
- 12-10Codeforces 1295D Same GCDs (欧拉定理)
- 12-10cf 1141/problem/F2 Same Sum Blocks (Hard)
- 12-10Continuous Same Game (1) 简单的模拟dfs() 很好过
- 12-10CodeForces 1141 F Same Sum Blocks(Easy) 贪心
- 12-10直接请求URL调用 axis webservices
- 12-10H - Traveling on the Axis ZOJ - 4054 (简单DP)