本文整理汇总了C++中Light::GetWorldTransform方法的典型用法代码示例。如果您正苦于以下问题:C++ Light::GetWorldTransform方法的具体用法?C++ Light::GetWorldTransform怎么用?C++ Light::GetWorldTransform使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Light
的用法示例。
在下文中一共展示了Light::GetWorldTransform方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetParams
void Raytracer::SetParams(Camera* camera, const char* path, int w, int h, AntiAlias aa)
{
//Timer timer;
raycount = 0;
mode = aa;
width = w;
height = h;
visualnodes.Clear();
visualtransforms.Clear();
visualboxes.Clear();
lightnodes.Clear();
lighttransforms.Clear();
// go through the scene graph and cache stuff
Node* root = camera->GetRoot();
for(Node* node = root; node; node=node->GetNext())
{
if(node->HasFlag(Node::VISUAL))
{
Visual* visual = static_cast<Visual*>(node);
visualnodes.PushBack(visual);
visualtransforms.PushBack(visual->GetWorldTransform());
visualboxes.PushBack(visual->GetWorldBox());
}
else if(node->HasFlag(Node::LIGHT))
{
Light* light = static_cast<Light*>(node);
lightnodes.PushBack(light);
lighttransforms.PushBack(light->GetWorldTransform());
}
}
if(mode == ADAPTIVE)
{
width++;
height++;
}
else if(mode == SUPERSAMPLE2X)
{
width *= 2;
height *= 2;
}
// calculate image plane stuff
float d = 10; // distance from camera to plane (n'importe quoi...)
float sj = 2 * d * math::Tan(math::ToRadians(camera->GetHorizontalFov() / 2)); // width of plane
float sk = sj * ((float)height/(float)width); // height
origin = camera->GetWorldTransform().GetTranslation();
vector3f dirz = camera->GetWorldTransform().GetDirection(); // forward vector
vector3f diry = vector3f(0,1,0); // up vector
vector3f dirx = Normalize(CrossProduct(dirz,diry)); // side vector
p = origin + (d * dirz) - ((sj/2) * dirx) + ((sk/2) * diry); // upper-left pixel of image plane
incrementx = (sj*(1.f/(width-1))*dirx); // one-pixel increment in x direction
incrementy = (sk*(1.f/(height-1))*diry); // one-pixel increment in y direction
delete[] buffer;
buffer = new vector3f[width * height];
setparams = true;
}