From 7522f86d010e600e17e82f98364235e96df21c1e Mon Sep 17 00:00:00 2001 From: Matt Ebb Date: Mon, 22 Sep 2008 01:51:24 +0000 Subject: * Volume rendering This is an initial commit to get it in SVN and make it easier to work on. Don't expect it to work perfectly, it's still in development and there's plenty of work still needing to be done. And so no I'm not very interested in hearing bug reports or feature requests at this stage :) There's some info on this, and a todo list at: http://mke3.net/weblog/volume-rendering/ Right now I'm trying to focus on getting shading working correctly (there's currently a problem in which 'surfaces' of the volume facing towards or away from light sources are getting shaded differently to how they should be), then I'll work on integration issues, like taking materials behind the volume into account, blending with alpha, etc. You can do simple testing though, mapping textures to density or emission on a cube with volume material. --- source/blender/blenlib/intern/arithb.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'source/blender/blenlib/intern/arithb.c') diff --git a/source/blender/blenlib/intern/arithb.c b/source/blender/blenlib/intern/arithb.c index f89f90f7045..f311c30e0c7 100644 --- a/source/blender/blenlib/intern/arithb.c +++ b/source/blender/blenlib/intern/arithb.c @@ -2126,6 +2126,13 @@ void VecSubf(float *v, float *v1, float *v2) v[2]= v1[2]- v2[2]; } +void VecMulVecf(float *v, float *v1, float *v2) +{ + v[0] = v1[0] * v2[0]; + v[1] = v1[1] * v2[1]; + v[2] = v1[2] * v2[2]; +} + void VecLerpf(float *target, float *a, float *b, float t) { float s = 1.0f-t; @@ -3269,6 +3276,12 @@ float Normalize2(float *n) return d; } +float rgb_to_luminance(float r, float g, float b) +{ + /* Rec. 709 HDTV */ + return (0.2126*r + 0.7152*g + 0.0722*b); +} + void hsv_to_rgb(float h, float s, float v, float *r, float *g, float *b) { int i; -- cgit v1.2.3