Ooops
January 15, 2021, 06:02:50 PM
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] vertex normal effect by TomToad [ 1+ years ago ]
« previous
next »
Print
Pages: [
1
]
Go Down
Author
Topic: [bb] vertex normal effect by TomToad [ 1+ years ago ] (Read 611 times)
BlitzBot
Jr. Member
Posts: 1
[bb] vertex normal effect by TomToad [ 1+ years ago ]
«
on:
June 29, 2017, 12:28:39 AM »
Title :
vertex normal effect
Author :
TomToad
Posted :
1+ years ago
Description :
I was just mesing around with meshes and vertex normals and came up with some nice effects. Use the arrow keys to move the camera and use 1-5 to change which effect is being rendered.
Code :
Code: BlitzBasic
Graphics3D
800
,
600
,
32
,
0
SetBuffer
BackBuffer
(
)
Const
size =
128
grid =
CreateMesh
(
)
surface =
CreateSurface
(
grid
)
For
y = -size/
2
To
(
size/
2
-
1
)
For
x = -size/
2
To
(
size/
2
-
1
)
v =
AddVertex
(
surface,x,
0
,y
)
DebugLog
v
Next
Next
For
y =
0
To
(
size -
2
)
For
x =
0
To
(
size -
1
)
If
x <>
0
v3 =
(
x -
1
)
+ y * size
v2 = x + y * size
v1 = x +
(
y +
1
)
* size
AddTriangle
(
surface,v1,v2,v3
)
End If
If
x <>
(
size -
1
)
v3 = x + y * size
v2 = x +
1
+
(
y +
1
)
* size
v1 = x +
(
y +
1
)
* size
AddTriangle
(
surface,v1,v2,v3
)
End If
Next
Next
PositionEntity
grid,
0
,
0
,
0
EntityColor
grid,
127
,
127
,
255
camera =
CreateCamera
(
)
PositionEntity
camera,
0
,
5
,-
5
light =
CreateLight
(
)
RotateEntity
light,
45
,
0
,
0
angle =
0
mode =
0
timer =
CreateTimer
(
30
)
While
Not
KeyDown
(
1
)
WaitTimer
(
timer
)
For
x =
0
To
size -
1
For
y =
0
To
size -
1
Select
mode
Case
0
VertexNormal
(
surface,x + y * size,
Cos
(
(
angle + x*y
)
Mod
180
)
,
Sin
(
(
angle + x*y
)
Mod
180
)
,
0
)
Case
1
VertexNormal
(
surface,x + y * size,
Sin
(
(
angle + x*y
)
Mod
180
)
,
Cos
(
(
angle + x*y
)
Mod
180
)
,
0
)
Case
2
VertexNormal
(
surface,x + y * size,
0
,
Sin
(
(
angle + x*y
)
Mod
180
)
,
Cos
(
(
angle + x*y
)
Mod
180
)
)
Case
3
VertexNormal
(
surface,x + y * size,
0
,
Cos
(
(
angle + x*y
)
Mod
180
)
,
Sin
(
(
angle + x*y
)
Mod
180
)
)
Case
4
VertexNormal
(
surface,x + y * size,
Sin
(
(
angle + x*y
)
Mod
180
)
,
0
,
Cos
(
(
angle + x*y
)
Mod
180
)
)
End Select
Next
Next
If
KeyDown
(
200
)
Then
MoveEntity
camera,
0
,
0
,.1
If
KeyDown
(
208
)
Then
MoveEntity
camera,
0
,
0
,-.1
If
KeyDown
(
203
)
Then
TurnEntity
camera,
0
,.8,
0
If
KeyDown
(
205
)
Then
TurnEntity
camera,
0
,-.8,
0
If
KeyHit
(
2
)
Then
mode =
0
If
KeyHit
(
3
)
Then
mode =
1
If
KeyHit
(
4
)
Then
mode =
2
If
KeyHit
(
5
)
Then
mode =
3
If
KeyHit
(
6
)
Then
mode =
4
RenderWorld
Flip
False
angle = angle +
1
If
angle =
360
Then
angle =
0
Wend
Comments :
Clyde(Posted 1+ years ago)
Snazzy Stuff dude
Ross C(Posted 1+ years ago)
Cool
) Bet you can't do that in 512 characters
;P
Logged
Print
Pages: [
1
]
Go Up
« previous
next »
SyntaxBomb - Indie Coders
»
Languages & Coding
»
Blitz Code Archives
»
3D Graphics - Effects
»
[bb] vertex normal effect by TomToad [ 1+ years ago ]
SimplePortal 2.3.6 © 2008-2014, SimplePortal