当前位置: 首页>>代码示例>>C++>>正文


C++ Spectrum::isValid方法代码示例

本文整理汇总了C++中Spectrum::isValid方法的典型用法代码示例。如果您正苦于以下问题:C++ Spectrum::isValid方法的具体用法?C++ Spectrum::isValid怎么用?C++ Spectrum::isValid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Spectrum的用法示例。


在下文中一共展示了Spectrum::isValid方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: defined

Photon::Photon(const Point &p, const Normal &normal,
			   const Vector &dir, const Spectrum &P,
			   uint16_t _depth) {
	if (!P.isValid())
		SLog(EWarn, "Creating an invalid photon with power: %s", P.toString().c_str());
	/* Possibly convert to single precision floating point
	   (if Mitsuba is configured to use double precision) */
	position = p;
	data.depth = _depth;
	flags = 0;

	/* Convert the direction into an approximate spherical
	   coordinate format to reduce storage requirements */
	data.theta = (uint8_t) std::min(255,
		(int) (math::safe_acos(dir.z) * (256.0 / M_PI)));

	int tmp = std::min(255,
		(int) (std::atan2(dir.y, dir.x) * (256.0 / (2.0 * M_PI))));
	if (tmp < 0)
		data.phi = (uint8_t) (tmp + 256);
	else
		data.phi = (uint8_t) tmp;

	if (normal.isZero()) {
		data.thetaN = data.phiN = 0;
	} else {
		data.thetaN = (uint8_t) std::min(255,
			(int) (math::safe_acos(normal.z) * (256.0 / M_PI)));
		tmp = std::min(255,
			(int) (std::atan2(normal.y, normal.x) * (256.0 / (2.0 * M_PI))));
		if (tmp < 0)
			data.phiN = (uint8_t) (tmp + 256);
		else
			data.phiN = (uint8_t) tmp;
	}

#if defined(SINGLE_PRECISION) && SPECTRUM_SAMPLES == 3
	/* Pack the photon power into Greg Ward's RGBE format */
	P.toRGBE(data.power);
#else
	data.power = P;
#endif
}
开发者ID:blckshrk,项目名称:IFT6042,代码行数:43,代码来源:photon.cpp


注:本文中的Spectrum::isValid方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。