コード例 #1
0
ファイル: Matrix.c プロジェクト: awesome/gloss
Ray mrMul(const Matrix matrix, const Ray ray) {

	return makeRay(mvMul(matrix, ray.origin), vNormalized(mvMulDir(matrix, ray.direction)));
}
コード例 #2
0
ファイル: Lapidem_Math.cpp プロジェクト: FreeZe5K/lapidem
tVector2D Lapidem_Math::Vector2DNormalize( tVector2D _v )
{
	float fLength( Vector2DLength( _v ) );
	tVector2D vNormalized( _v / fLength );
	return vNormalized;
}
コード例 #3
0
ファイル: Scene.c プロジェクト: GlennSandoval/gloss
Color sceneTraceRayAtPixel(const Scene *scene, const int currentPixel, const int width, const int height, const int numCameraRayBounces) {
	
	const float cameraFov = 40;
	const float cameraAspectRatio = 1;

	float maxX = tanf(cameraFov/360.0*PI);
	float x =  ((((currentPixel % width) + randf()) / width ) * 2 - 1) * maxX;
	float y = -((((currentPixel / width) + randf()) / height) * 2 - 1) * maxX / cameraAspectRatio;

	return sceneTraceRay(scene, mrMul(mInversed(scene->cameraOrientation), makeRay(makeVectorOrigo(), vNormalized(makeVector(x, y, 1)))), numCameraRayBounces);
}