本文整理汇总了C++中vec3::GetPolarCoordAngleY方法的典型用法代码示例。如果您正苦于以下问题:C++ vec3::GetPolarCoordAngleY方法的具体用法?C++ vec3::GetPolarCoordAngleY怎么用?C++ vec3::GetPolarCoordAngleY使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vec3
的用法示例。
在下文中一共展示了vec3::GetPolarCoordAngleY方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Render
void ParticleRenderer::Render() {
if (!billboard_gas_) {
return;
}
ScopeLock lock(lock_);
const float q = 1;
BillboardArray::iterator x;
BillboardRenderInfoArray _billboards;
x = smokes_.begin();
for (; x != smokes_.end(); ++x) {
const float s = (q + x->opacity_time_) * x->size_factor_;
const float r = Math::Lerp(x->start_color_.x, x->color_.x, x->opacity_time_/PARTICLE_TIME);
const float g = Math::Lerp(x->start_color_.y, x->color_.y, x->opacity_time_/PARTICLE_TIME);
const float b = Math::Lerp(x->start_color_.z, x->color_.z, x->opacity_time_/PARTICLE_TIME);
_billboards.push_back(BillboardRenderInfo(x->angle_, x->position_, s, vec3(r, g, b), x->opacity_, x->texture_index_));
}
renderer_->RenderBillboards(billboard_gas_, true, false, _billboards);
_billboards.clear();
x = shrapnels_.begin();
for (; x != shrapnels_.end(); ++x) {
const float s = x->size_factor_;
_billboards.push_back(BillboardRenderInfo(x->angle_, x->position_, s, x->color_, x->opacity_, x->texture_index_));
}
renderer_->RenderBillboards(billboard_shrapnel_, false, false, _billboards);
_billboards.clear();
const quat& cam_orientation_inverse = renderer_->GetCameraOrientationInverse();
const vec3 camera_xz_plane(0,1,0); // In cam space, that is.
x = sparks_.begin();
for (; x != sparks_.end(); ++x) {
const vec3 angle_vector = (cam_orientation_inverse * x->velocity_).ProjectOntoPlane(camera_xz_plane);
const float _angle = PIF/2 - angle_vector.GetPolarCoordAngleY();
const float s = x->size_factor_;
const float r = Math::Lerp(1.0f, 0.6f, x->opacity_time_/PARTICLE_TIME);
const float gb = Math::Lerp(1.0f, 0.3f, x->opacity_time_/PARTICLE_TIME);
_billboards.push_back(BillboardRenderInfo(_angle, x->position_, s, vec3(r, gb, gb), x->opacity_, x->texture_index_));
}
renderer_->RenderBillboards(billboard_spark_, false, true, _billboards);
_billboards.clear();
x = fires_.begin();
for (; x != fires_.end(); ++x) {
const float s = (q + x->opacity_time_) * x->size_factor_;
const float r = Math::Lerp(x->start_color_.x, x->color_.x, x->opacity_time_/PARTICLE_TIME);
const float g = Math::Lerp(x->start_color_.y, x->color_.y, x->opacity_time_/PARTICLE_TIME);
const float b = Math::Lerp(x->start_color_.z, x->color_.z, x->opacity_time_/PARTICLE_TIME);
_billboards.push_back(BillboardRenderInfo(x->angle_, x->position_, s, vec3(r, g, b), x->opacity_, x->texture_index_));
}
renderer_->RenderBillboards(billboard_gas_, true, true, _billboards);
_billboards.clear();
x = temp_fires_.begin();
for (; x != temp_fires_.end(); ++x) {
_billboards.push_back(BillboardRenderInfo(x->angle_, x->position_, x->size_factor_, x->color_, x->opacity_, x->texture_index_));
}
renderer_->RenderBillboards(billboard_glow_, true, true, _billboards);
// Update lights.
LightArray::iterator y = lights_.begin();
for (; y < lights_.end(); ++y) {
if (y->render_light_id_ != Renderer::INVALID_LIGHT) {
renderer_->SetLightPosition(y->render_light_id_, y->position_);
renderer_->SetLightColor(y->render_light_id_, vec3(0.6f, 0.4f, 0.2f) * y->strength_ * 30.0f);
deb_assert(y->strength_ >= 0 && y->strength_ < 1000);
}
}
}