February 25, 2021, 03:00:02 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] Geometric based per-entity glow by Rob [ 1+ years ago ]
« previous
next »
Print
Pages: [
1
]
Go Down
Author
Topic: [bb] Geometric based per-entity glow by Rob [ 1+ years ago ] (Read 575 times)
BlitzBot
Jr. Member
Posts: 1
[bb] Geometric based per-entity glow by Rob [ 1+ years ago ]
«
on:
June 29, 2017, 12:28:40 AM »
Title :
Geometric based per-entity glow
Author :
Rob
Posted :
1+ years ago
Description :
This routine can be optimised quite a bit. It was designed this way for immediate ease-of-use.
It creates many copies of a mesh to achieve the desired effect. You can pre-copy to obtain a speedup, you can expand/contract the vertices for a more accurate scaling (neccesary - see rob.p's toon code and robins mesh code). You can also use it as the basis for more recipe ideas.
Code :
Code: BlitzBasic
;GEOMETRIC GLOW TEST - Rob Cummings
;inspired by madjack!
;KEEPS TRACK OF ENTITIES
Type
entlist
Field
ent
End Type
Graphics3D
1024
,
768
,
32
,
2
AmbientLight
(
10
,
10
,
20
)
light=
CreateLight
(
)
PositionEntity
light,-
500
,
5000
,
2000
LightColor
light,
200
,
200
,
200
RotateEntity
light,
45
,
45
,
0
camera =
CreateCamera
(
)
ob1 =
CreateCylinder
(
)
PositionEntity
ob1,
0
,
1
,
7
EntityColor
ob1,
0
,
0
,
255
EntityFX
ob1,
1
addent
(
ob1
)
ob2 =
CreateCone
(
)
PositionEntity
ob2,-
4
,
1
,
7
EntityColor
ob2,
0
,
255
,
0
EntityFX
ob2,
1
addent
(
ob2
)
ob3 =
CreateSphere
(
)
PositionEntity
ob3,
4
,
1
,
7
EntityColor
ob3,
255
,
255
,
255
addent
(
ob3
)
column =
CreateCylinder
(
)
ScaleEntity
column,
2
,
100
,
2
PositionEntity
column,
50
,
0
,
100
EntityColor
column,
255
,
0
,
0
EntityFX
column,
1
addent
(
column
)
While
Not
KeyHit
(
1
)
TurnEntity
ob1,
1
,
1
,
1
TurnEntity
ob2,
1
,
1
,
1
TurnEntity
ob3,
1
,
1
,
1
TurnEntity
column,
1
,
1
,
1
UpdateWorld
RenderWorld
EntityGlow
(
camera,ob1,
4
,.2,
50
,
50
,
255
)
EntityGlow
(
camera,ob2,
3
,.05,
50
,
255
,
50
)
EntityGlow
(
camera,ob3,
2
,.05,
255
,
255
,
0
)
Flip
Wend
End
Function
EntityGlow
(
eg_cam,eg_ent,eg_glowsteps=
1
,eg_glowsize#=.1,eg_r=-
1
,eg_g=-
1
,eg_b=-
1
)
hideworld
(
)
eg_pivot=
CreatePivot
(
)
For
eg_i=eg_glowsteps
To
1
Step
-
1
eg_glowent=
CopyMesh
(
eg_ent
)
ShowEntity
eg_glowent
PositionEntity
eg_glowent,
EntityX
(
eg_ent
)
,
EntityY
(
eg_ent
)
,
EntityZ
(
eg_ent
)
RotateEntity
eg_glowent,
EntityPitch
(
eg_ent
)
,
EntityYaw
(
eg_ent
)
,
EntityRoll
(
eg_ent
)
EntityFX
eg_glowent,
1
EntityBlend
eg_glowent,
3
;optional
ScaleMesh
eg_glowent,
1
+eg_glowsize*eg_i,
1
+eg_glowsize*eg_i,
1
+eg_glowsize*eg_i
EntityAlpha
eg_glowent,
0.1
EntityParent
eg_glowent,eg_pivot
If
(
eg_r+eg_g+eg_b
)
>
0
EntityColor
eg_glowent,eg_r,eg_g,eg_b
Next
CameraClsMode
eg_cam,
0
,
0
:
RenderWorld
:
CameraClsMode
eg_cam,
1
,
1
For
i=
1
To
CountChildren
(
eg_pivot
)
:
FreeEntity
GetChild
(
eg_pivot,i
)
:
Next
FreeEntity
eg_pivot
showworld
(
)
End Function
;HOUSEKEEPING FUNCTIONS
Function
AddEnt
(
ent
)
e.entlist=
New
entlist
eent=ent
End Function
Function
HideWorld
(
)
For
e.entlist=
Each
entlist
HideEntity
eent
Next
End Function
Function
ShowWorld
(
)
For
e.entlist=
Each
entlist
ShowEntity
eent
Next
End Function
Function
DeleteEnt
(
ent
)
For
e.entlist=
Each
entlist
If
eent=ent
Delete
e
Exit
EndIf
Next
End Function
Function
ClearEntList
(
)
Delete
Each
entlist
End Function
Comments :
none...
Logged
Print
Pages: [
1
]
Go Up
« previous
next »
SyntaxBomb - Indie Coders
»
Languages & Coding
»
Blitz Code Archives
»
3D Graphics - Effects
»
[bb] Geometric based per-entity glow by Rob [ 1+ years ago ]
SimplePortal 2.3.6 © 2008-2014, SimplePortal