January 19, 2021, 06:00:07 AM
Welcome,
Guest
. Please
login
or
register
.
Did you miss your
activation email
?
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
Home
Forum
Help
Search
Gallery
Login
Register
SyntaxBomb - Indie Coders
»
Languages & Coding
»
Blitz Code Archives
»
3D Graphics - Effects
»
[bb] RenderWireFrame by * [ 1+ years ago ]
« previous
next »
Print
Pages: [
1
]
Go Down
Author
Topic: [bb] RenderWireFrame by * [ 1+ years ago ] (Read 552 times)
BlitzBot
Jr. Member
Posts: 1
[bb] RenderWireFrame by * [ 1+ years ago ]
«
on:
June 29, 2017, 12:28:40 AM »
Title :
RenderWireFrame
Author :
*
Posted :
1+ years ago
Description :
Render a wireframe representation of any 3d mesh, useful for hud effects etc.
Code :
Code: BlitzBasic
;RenderWireFrame by EdzUp
;Safe wireframe rendering of a mesh, useful for hud effects.
;NOTE: this rendering isnt depth specific so you will be able to see the render through ALL
;3d objects (basically it draws the representation to the screen.
;If you find this useful please give credit where its due ;)
Graphics3D
640
,
480
,
16
SetBuffer
BackBuffer
(
)
Global
Camera =
CreateCamera
(
)
AmbientLight
255
,
255
,
255
Global
Mesh =
CreateSphere
(
8
)
AmbientLight
255
,
255
,
255
MoveEntity
camera,
0
,
0
, -
5
While
Not
KeyDown
(
1
)
TurnEntity
Mesh,
0
,
1
,
0
UpdateWorld
RenderWorld
Color
255
,
255
,
255
Color
255
,
0
,
0
RenderWireFrame
(
Mesh
)
Flip
Wend
End
Function
RenderWireFrame
(
MeshEntity
)
Local
SC =
CountSurfaces
(
MeshEntity
)
Local
Vert1=
0
, C1X#, C1Y#, C1Z#
Local
Vert2=
0
, C2X#, C2Y#, C2Z#
Local
Vert3=
0
, C3X#, C3Y#, C3Z#
For
CS =
1
To
SC
GS =
GetSurface
(
MeshEntity, CS
)
For
CT =
0
To
CountTriangles
(
GS
)
-
1
Vert1 =
TriangleVertex
(
GS, CT,
0
)
Vert2 =
TriangleVertex
(
GS, CT,
1
)
Vert3 =
TriangleVertex
(
GS, CT,
2
)
TFormPoint
VertexX
#
(
GS, Vert1
)
,
VertexY
#
(
GS, Vert1
)
,
VertexZ
#
(
GS, Vert1
)
, MeshEntity,
0
CameraProject
Camera,
TFormedX
#
(
)
,
TFormedY
#
(
)
,
TFormedZ
#
(
)
C1X# =
ProjectedX
#
(
)
C1Y# =
ProjectedY
#
(
)
C1Z# =
ProjectedZ
#
(
)
TFormPoint
VertexX
#
(
GS, Vert2
)
,
VertexY
#
(
GS, Vert2
)
,
VertexZ
#
(
GS, Vert2
)
, MeshEntity,
0
CameraProject
Camera,
TFormedX
#
(
)
,
TFormedY
#
(
)
,
TFormedZ
#
(
)
C2X# =
ProjectedX
#
(
)
C2Y# =
ProjectedY
#
(
)
C2Z# =
ProjectedZ
#
(
)
TFormPoint
VertexX
#
(
GS, Vert3
)
,
VertexY
#
(
GS, Vert3
)
,
VertexZ
#
(
GS, Vert3
)
, MeshEntity,
0
CameraProject
Camera,
TFormedX
#
(
)
,
TFormedY
#
(
)
,
TFormedZ
#
(
)
C3X# =
ProjectedX
#
(
)
C3Y# =
ProjectedY
#
(
)
C3Z# =
ProjectedZ
#
(
)
Line
C1X#, C1Y#, C2X#, C2Y#
Line
C2X#, C2Y#, C3X#, C3Y#
Line
C3X#, C3Y#, C1X#, C1Y#
Next
Next
End Function
Comments :
none...
Logged
Print
Pages: [
1
]
Go Up
« previous
next »
SyntaxBomb - Indie Coders
»
Languages & Coding
»
Blitz Code Archives
»
3D Graphics - Effects
»
[bb] RenderWireFrame by * [ 1+ years ago ]
SimplePortal 2.3.6 © 2008-2014, SimplePortal