POV-Ray : Newsgroups : povray.programming : Lighting.cpp - Assign_Vector used to copy a COLOUR into an RGB : Lighting.cpp - Assign_Vector used to copy a COLOUR into an RGB Server Time: 26 Sep 2017 21:39:29 GMT
  Lighting.cpp - Assign_Vector used to copy a COLOUR into an RGB  
From: Massimo Valentini
Date: 13 Sep 2002 11:26:45
Looking into the sources of Linux povray (from povuni_s.tgz - version
3.50a)(but the same is in the Win source) I saw two calls to
Assign_Vector that appear to me wrong. On my platform a VECTOR (the size)
occupies 24 bytes, an RGB (the destination) 12, and a COLOUR (the source)
20. Details follow the signature.

If I'm wrong and the code is correct, I think a comment, in the source, 
explaining the thing would be useful.

HTH
Massimo

-> File: lighting.cpp - Line: 5767-5774
      if(fabs(Reflection_Frac)<EPSILON)
      {
        Assign_Vector(reflectivity, Reflection_Min);
      }
      else if (fabs(Reflection_Frac-1.0)<EPSILON)
      {
        Assign_Vector(reflectivity, Reflection_Max);
      }

-> File: lighting.cpp - Line: 5700-5701
void determine_reflectivity(DBL *weight, RGB reflectivity, COLOUR
Reflection_Max,
        COLOUR Reflection_Min, int Reflection_Type, DBL Reflection_Falloff,

(I see this function is called for instance in compute_lighted_texture and
there 'reflectivity' is a COLOUR, but still only 20 bytes)

-> File: lighting.cpp - Line: 35
#include "frame.h"

-> File: frame.h - Line: 902
#define Assign_Vector(d,s)  memcpy((d),(s),sizeof(VECTOR))

-> File: frame.h - Line:812
typedef DBL VECTOR [3];

-> File: frame.h - Line:243
#define DBL double

-> File: frame.h - Line: 816-817
typedef COLC COLOUR [5];
typedef COLC RGB [3];

-> File: frame.h - Line:251
#define COLC float


Post a reply to this message

Copyright 2003-2008 Persistence of Vision Raytracer Pty. Ltd.