January 24, 2021, 11:50:49 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] tex face cam by Nate the Great [ 1+ years ago ]
« previous
next »
Print
Pages: [
1
]
Go Down
Author
Topic: [bb] tex face cam by Nate the Great [ 1+ years ago ] (Read 554 times)
BlitzBot
Jr. Member
Posts: 1
[bb] tex face cam by Nate the Great [ 1+ years ago ]
«
on:
June 29, 2017, 12:28:39 AM »
Title :
tex face cam
Author :
Nate the Great
Posted :
1+ years ago
Description :
Im not really sure what to call this but I thought it was pretty cool and admitedly useless. It is pretty cool though. It basically flattens the texture to look the same no matter where or what rotation the object is at. Sorry there are some welding bugs with the cube.
Code :
Code: BlitzBasic
Graphics3D
1024
,
768
,
0
,
2
SetBuffer
BackBuffer
(
)
Global
cam1 =
CreateCamera
(
)
MoveEntity
cam1,
0
,
0
,-
8
lit =
CreateLight
(
)
TurnEntity
lit,
90
,
0
,
0
cub =
CreateCube
(
)
sph =
CreateSphere
(
32
,cub
)
con =
CreateCone
(
32
,
True
,cub
)
Tex =
CreateTexture
(
256
,
256
)
SetBuffer
TextureBuffer
(
tex
)
ClsColor
255
,
0
,
255
Cls
Color
0
,
255
,
0
For
i =
1
To
100
Line
Rnd
(
256
)
,
Rnd
(
256
)
,
Rnd
(
256
)
,
Rnd
(
256
)
Next
EntityTexture
(
cub,tex
)
EntityTexture
(
con,tex
)
EntityTexture
(
sph,tex
)
MoveEntity
con,-
3
,
0
,
0
MoveEntity
sph,
3
,
0
,
0
SetBuffer
BackBuffer
(
)
ClsColor
0
,
0
,
0
tim =
CreateTimer
(
60
)
While
Not
KeyDown
(
1
)
Cls
updateflattex
(
cub,
256
)
updateflattex
(
sph,
256
)
updateflattex
(
con,
256
)
RotateMesh
cub,
1
,
1
,
0
If
KeyDown
(
203
)
MoveEntity
cub,-.02,
0
,
0
ElseIf
KeyDown
(
205
)
MoveEntity
cub,.02,
0
,
0
EndIf
If
KeyDown
(
208
)
MoveEntity
cub,
0
,-.02,
0
ElseIf
KeyDown
(
200
)
MoveEntity
cub,
0
,.02,
0
EndIf
UpdateWorld
(
)
RenderWorld
(
)
WaitTimer
(
tim
)
Flip
Wend
End
Function
updateflattex
(
ent,num
)
For
s =
1
To
CountSurfaces
(
ent
)
surf =
GetSurface
(
ent,s
)
For
v =
0
To
CountVertices
(
surf
)
-
1
TFormPoint
VertexX
(
surf,v
)
,
VertexY
(
surf, v
)
,
VertexZ
(
surf, v
)
, ent,
0
CameraProject
cam1,
TFormedX
(
)
,
TFormedY
(
)
,
TFormedZ
(
)
x# =
ProjectedX
(
)
y# =
ProjectedY
(
)
VertexTexCoords
surf,v,x#/num,y#/num
Next
Next
End Function
Comments :
Nate the Great(Posted 1+ years ago)
perhaps this should be moved to the 3d graphics mesh section of the code archives.. sorry i misplaeced it
Nate the Great(Posted 1+ years ago)
perhaps this should be moved to the 3d graphics mesh section of the code archives.. sorry i misplaced it
Logged
Print
Pages: [
1
]
Go Up
« previous
next »
SyntaxBomb - Indie Coders
»
Languages & Coding
»
Blitz Code Archives
»
3D Graphics - Effects
»
[bb] tex face cam by Nate the Great [ 1+ years ago ]
SimplePortal 2.3.6 © 2008-2014, SimplePortal