POV-Ray : Newsgroups : povray.binaries.images : Object Labels : Re: Object Labels Server Time
27 Apr 2024 01:04:38 EDT (-0400)
  Re: Object Labels  
From: Melody
Date: 18 Jan 2020 23:50:00
Message: <web.5e23df6528c763ef9da690110@news.povray.org>
oh right, now I remember. for bottom text, consider font height.

#macro label(Text,objv,r,col,top)
#local vl = vlength(objv-campos)/88;
#if (top)
#local pnt = camup*(r*1.05)+objv;
#else
#local pnt = -camup*(vl*FontSize+r)+objv;
#end
#local eye = vnormalize(pnt-campos);
object {
  text {
    ttf "Arial.ttf" Text 2 0
    texture {  pigment { rgb col }  finish { ambient 1 diffuse 0 } }
  }
  translate x*(strlen(Text)*-0.25)
  scale <vl*FontSize,vl*FontSize,vl*FontSize>

popmatrix(vnormalize(vcross(camup,eye)),vnormalize(vcross(eye,vcross(camup,eye))),eye,pnt)
  no_shadow
}
#end


Post a reply to this message


Attachments:
Download 'golfdimples10.png' (87 KB)

Preview of image 'golfdimples10.png'
golfdimples10.png


 

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