EntityAlpha.htm 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. <html>
  2. <head>
  3. <title>Blitz3D Docs</title>
  4. <link rel=stylesheet href=../css/commands.css type=text/css>
  5. </head>
  6. <body>
  7. <h1>EntityAlpha entity,alpha#</h1>
  8. <h1>Parameters</h1>
  9. <table>
  10. <tr>
  11. <td>
  12. Entity - entity handle <br />
  13. Alpha# - alpha level of entity
  14. </td>
  15. </tr>
  16. </table>
  17. <h1>Description</h1>
  18. <table>
  19. <tr>
  20. <td>
  21. Sets the entity alpha level of an entity. <br />
  22. <br />
  23. The alpha# value should be in a floating point value in the range 0-1. The default entity alpha setting is 1. <br />
  24. <br />
  25. The alpha level is how transparent an entity is. A value of 1 will mean the entity is opaque. A value of 0 will mean the entity is completely transparent, i.e. invisible. Values between 0 and 1 will cause varying amount of transparency. This is useful for imitating the look of objects such as glass and other translucent materials. <br />
  26. <br />
  27. An EntityAlpha value of 0 is especially useful as Blitz3D will not render entities with such a value, but will still involve the entities in collision tests. This is unlike HideEntity, which doesn't involve entities in collisions.
  28. </td>
  29. </tr>
  30. </table>
  31. <h1><a href=../3d_examples/EntityAlpha.bb>Example</a></h1>
  32. <table>
  33. <tr>
  34. <td>
  35. ; EntityAlpha Example <br />
  36. ; ------------------- <br />
  37. <br />
  38. Graphics3D 640,480 <br />
  39. SetBuffer BackBuffer() <br />
  40. <br />
  41. camera=CreateCamera() <br />
  42. <br />
  43. light=CreateLight() <br />
  44. RotateEntity light,90,0,0 <br />
  45. <br />
  46. cube=CreateCube() <br />
  47. Back=CreateCube() <br />
  48. <br />
  49. PositionEntity cube,0,0,5 <br />
  50. PositionEntity back,0,0,15 <br />
  51. ScaleEntity Back,10,2,1 <br />
  52. EntityColor back,255,0,0 <br />
  53. ; Set initial entity color values <br />
  54. Alpha#=1 <br />
  55. <br />
  56. While Not KeyDown( 1 ) <br />
  57. <br />
  58. ; Change alpha value depending on key pressed <br />
  59. If alpha#<0.01 Then alpha# = 0 <br />
  60. If alpha#>1 Then alpha# = 1 <br />
  61. If KeyDown( 2 )=True And Alpha#>0 Then Alpha#=Alpha#-0.01 <br />
  62. If KeyDown( 3 )=True And alpha#<1 Then Alpha#=Alpha#+0.01 <br />
  63. ; Set entity alpha value <br />
  64. EntityAlpha cube,Alpha# <br />
  65. <br />
  66. <br />
  67. TurnEntity cube,0.1,0.1,0.1 <br />
  68. TurnEntity back,1,0,0 <br />
  69. <br />
  70. RenderWorld <br />
  71. <br />
  72. Text 0,0,"Press keys 1-2 to change EntityAlpha" <br />
  73. Text 0,20,"Entity Alpha: "+Alpha <br />
  74. <br />
  75. Flip <br />
  76. <br />
  77. Wend <br />
  78. <br />
  79. End
  80. </td>
  81. </tr>
  82. </table>
  83. <br>
  84. <a target=_top href=../index.htm>Index</a><br>
  85. <br>
  86. Click <a href=http://www.blitzbasic.co.nz/b3ddocs/command.php?name=EntityAlpha&ref=comments target=_blank>here</a> to view the latest version of this page online</body>
  87. </html>