Render glow in separate pass

This commit is contained in:
Smok1e 2023-04-18 14:53:59 +03:00
parent 9541e6dbfe
commit b644f759ed
7 changed files with 181 additions and 165 deletions

@ -1 +1 @@
Subproject commit 7505d6f5f2190c9da41c693e43d22b096037180f
Subproject commit d296c13de217c8bc5214fb2e1ce50fee642f5e48

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 72 KiB

After

Width:  |  Height:  |  Size: 83 KiB

View File

@ -1,158 +1,158 @@
BackgroundPattern 0 0 304 304
BarSegment 29 355 16 4
ComputerMotherboard 305 0 79 70
Empty 12 414 1 1
EmptySlot 458 155 18 18
Knob 385 0 50 50
KnobCenter 436 0 50 50
KnobLimits 305 71 50 50
ShadowBorder 0 394 1 24
ShadowCorner 474 122 24 24
TabArrow 0 340 8 14
buttons/BottomDrawerClose 477 155 18 18
buttons/BottomDrawerOpen 441 188 18 18
buttons/PowerOff 460 188 18 18
buttons/PowerOn 479 188 18 18
icons/ButtonCheck 305 251 17 17
icons/ButtonClipboard 323 251 17 17
icons/ButtonRandomize 341 251 17 17
icons/CPU 305 269 16 16
icons/Card 322 269 16 16
icons/ComponentBus 339 269 16 16
icons/DragLMB 373 219 21 14
icons/DragRMB 395 219 21 14
icons/EEPROM 356 269 16 16
icons/Floppy 373 269 16 16
icons/HDD 390 269 16 16
icons/LMB 26 322 11 14
icons/Memory 407 269 16 16
icons/NA 424 269 16 16
icons/NotificationError 50 322 11 11
icons/NotificationInfo 62 322 11 11
icons/NotificationWarning 74 322 11 11
icons/RMB 38 322 11 14
icons/RackMountable 441 269 16 16
icons/SettingsSound 0 322 12 17
icons/SettingsUI 13 322 12 17
icons/Tier0 458 269 16 16
icons/Tier1 475 269 16 16
icons/Tier2 492 269 16 16
icons/WaveLFSR 155 305 24 10
icons/WaveNoise 180 305 24 10
icons/WaveSawtooth 205 305 24 10
icons/WaveSine 230 305 24 10
icons/WaveSquare 255 305 24 10
icons/WaveTriangle 280 305 24 10
icons/WireArrowLeft 2 394 4 8
icons/WireArrowRight 7 394 4 8
items/APU0 373 122 16 96
items/APU1 390 122 16 96
items/APU2 407 122 16 96
items/CPU0 305 286 16 16
items/CPU1 322 286 16 16
items/CPU2 339 286 16 16
items/CardBase 356 286 16 16
items/CircuitBoard 373 286 16 16
items/ComponentBus0 390 286 16 16
items/ComponentBus1 407 286 16 16
items/ComponentBus2 424 286 16 16
items/ComponentBus3 441 286 16 16
items/DataCard0 305 122 16 128
items/DataCard1 322 122 16 128
items/DataCard2 339 122 16 128
items/DebugCard 458 286 16 16
items/DiskDriveMountable 475 286 16 16
items/EEPROM 492 286 16 16
items/FloppyDisk_dyeBlack 373 234 16 16
items/FloppyDisk_dyeBlue 390 234 16 16
items/FloppyDisk_dyeBrown 407 234 16 16
items/FloppyDisk_dyeCyan 424 234 16 16
items/FloppyDisk_dyeGray 441 234 16 16
items/FloppyDisk_dyeGreen 458 234 16 16
items/FloppyDisk_dyeLightBlue 475 234 16 16
items/FloppyDisk_dyeLightGray 492 234 16 16
items/FloppyDisk_dyeLime 356 71 16 16
items/FloppyDisk_dyeMagenta 373 71 16 16
items/FloppyDisk_dyeOrange 390 71 16 16
items/FloppyDisk_dyePink 407 71 16 16
items/FloppyDisk_dyePurple 424 71 16 16
items/FloppyDisk_dyeRed 441 71 16 16
items/FloppyDisk_dyeWhite 458 71 16 16
items/FloppyDisk_dyeYellow 475 71 16 16
items/GraphicsCard0 492 71 16 16
items/GraphicsCard1 356 88 16 16
items/GraphicsCard2 373 88 16 16
items/HardDiskDrive0 390 88 16 16
items/HardDiskDrive1 407 88 16 16
items/HardDiskDrive2 424 88 16 16
items/InternetCard 441 155 16 32
items/LinkedCard 424 122 16 96
items/Memory0 441 88 16 16
items/Memory1 458 88 16 16
items/Memory2 475 88 16 16
items/Memory3 492 88 16 16
items/Memory4 356 105 16 16
items/Memory5 373 105 16 16
items/NetworkCard 390 105 16 16
items/RedstoneCard0 407 105 16 16
items/RedstoneCard1 424 105 16 16
items/Server0 441 105 16 16
items/Server1 458 105 16 16
items/Server2 475 105 16 16
items/Server3 492 105 16 16
items/SoundCard 356 122 16 128
items/WirelessNetworkCard0 487 0 16 16
items/WirelessNetworkCard1 487 17 16 16
light-panel/BookmarkLeft 136 305 18 14
light-panel/BookmarkRight 359 251 20 14
light-panel/BorderB 8 403 4 4
light-panel/BorderL 98 403 4 2
light-panel/BorderR 13 403 4 4
light-panel/BorderT 18 403 4 4
light-panel/CornerBL 23 403 4 4
light-panel/CornerBR 28 403 4 4
light-panel/CornerTL 33 403 4 4
light-panel/CornerTR 38 403 4 4
light-panel/Fill 6 414 2 2
light-panel/Vent 0 355 2 38
nodes/Cable 3 366 8 8
nodes/Camera 487 34 16 16
nodes/Computer 385 51 16 16
nodes/ComputerActivityOverlay 402 51 16 16
nodes/ComputerErrorOverlay 419 51 16 16
nodes/ComputerOnOverlay 436 51 16 16
nodes/DiskDrive 453 51 16 16
nodes/DiskDriveActivity 470 51 16 16
nodes/DiskDriveFloppy 487 51 16 16
nodes/IronNoteBlock 0 305 16 16
nodes/Lamp 17 305 16 16
nodes/LampFrame 34 305 16 16
nodes/LampGlow 441 122 32 32
nodes/NewNode 51 305 16 16
nodes/NoteBlock 68 305 16 16
nodes/Relay 85 305 16 16
nodes/Screen 102 305 16 16
nodes/ScreenOnOverlay 119 305 16 16
panel/BorderB 43 403 4 4
panel/BorderL 103 403 4 2
panel/BorderR 48 403 4 4
panel/BorderT 53 403 4 4
panel/CornerBL 58 403 4 4
panel/CornerBR 63 403 4 4
panel/CornerTL 68 403 4 4
panel/CornerTR 73 403 4 4
panel/Fill 9 414 2 2
particles/Note 21 355 7 10
screen/BorderB 5 403 2 8
screen/BorderT 2 403 2 10
screen/CornerBL 12 366 8 8
screen/CornerBR 21 366 8 8
screen/CornerTL 3 355 8 10
screen/CornerTR 12 355 8 10
window/BorderDark 2 414 1 4
window/BorderLight 4 414 1 4
window/CloseButton 30 366 7 6
window/CornerBL 78 403 4 4
window/CornerBR 83 403 4 4
window/CornerTL 88 403 4 4
window/CornerTR 93 403 4 4
BarSegment 29 463 16 4
ComputerMotherboard 305 129 79 70
Empty 506 87 1 1
EmptySlot 85 330 18 18
Knob 385 129 50 50
KnobCenter 436 129 50 50
KnobLimits 305 200 50 50
ShadowBorder 502 0 1 24
ShadowCorner 68 305 24 24
TabArrow 0 448 8 14
buttons/BottomDrawerClose 104 330 18 18
buttons/BottomDrawerOpen 123 330 18 18
buttons/PowerOff 142 330 18 18
buttons/PowerOn 161 330 18 18
icons/ButtonCheck 68 363 17 17
icons/ButtonClipboard 86 363 17 17
icons/ButtonRandomize 104 363 17 17
icons/CPU 68 381 16 16
icons/Card 85 381 16 16
icons/ComponentBus 102 381 16 16
icons/DragLMB 180 330 21 14
icons/DragRMB 202 330 21 14
icons/EEPROM 119 381 16 16
icons/Floppy 136 381 16 16
icons/HDD 153 381 16 16
icons/LMB 26 430 11 14
icons/Memory 170 381 16 16
icons/NA 187 381 16 16
icons/NotificationError 50 430 11 11
icons/NotificationInfo 62 430 11 11
icons/NotificationWarning 74 430 11 11
icons/RMB 38 430 11 14
icons/RackMountable 204 381 16 16
icons/SettingsSound 0 430 12 17
icons/SettingsUI 13 430 12 17
icons/Tier0 221 381 16 16
icons/Tier1 238 381 16 16
icons/Tier2 255 381 16 16
icons/WaveLFSR 478 402 24 10
icons/WaveNoise 0 419 24 10
icons/WaveSawtooth 25 419 24 10
icons/WaveSine 50 419 24 10
icons/WaveSquare 75 419 24 10
icons/WaveTriangle 100 419 24 10
icons/WireArrowLeft 504 0 4 8
icons/WireArrowRight 504 9 4 8
items/APU0 0 305 16 96
items/APU1 17 305 16 96
items/APU2 34 305 16 96
items/CPU0 272 381 16 16
items/CPU1 289 381 16 16
items/CPU2 306 381 16 16
items/CardBase 323 381 16 16
items/CircuitBoard 340 381 16 16
items/ComponentBus0 357 381 16 16
items/ComponentBus1 374 381 16 16
items/ComponentBus2 391 381 16 16
items/ComponentBus3 408 381 16 16
items/DataCard0 434 0 16 128
items/DataCard1 451 0 16 128
items/DataCard2 468 0 16 128
items/DebugCard 425 381 16 16
items/DiskDriveMountable 442 381 16 16
items/EEPROM 459 381 16 16
items/FloppyDisk_dyeBlack 476 381 16 16
items/FloppyDisk_dyeBlue 493 381 16 16
items/FloppyDisk_dyeBrown 93 305 16 16
items/FloppyDisk_dyeCyan 110 305 16 16
items/FloppyDisk_dyeGray 127 305 16 16
items/FloppyDisk_dyeGreen 144 305 16 16
items/FloppyDisk_dyeLightBlue 161 305 16 16
items/FloppyDisk_dyeLightGray 178 305 16 16
items/FloppyDisk_dyeLime 195 305 16 16
items/FloppyDisk_dyeMagenta 212 305 16 16
items/FloppyDisk_dyeOrange 229 305 16 16
items/FloppyDisk_dyePink 246 305 16 16
items/FloppyDisk_dyePurple 263 305 16 16
items/FloppyDisk_dyeRed 280 305 16 16
items/FloppyDisk_dyeWhite 297 305 16 16
items/FloppyDisk_dyeYellow 314 305 16 16
items/GraphicsCard0 331 305 16 16
items/GraphicsCard1 348 305 16 16
items/GraphicsCard2 365 305 16 16
items/HardDiskDrive0 382 305 16 16
items/HardDiskDrive1 399 305 16 16
items/HardDiskDrive2 416 305 16 16
items/InternetCard 68 330 16 32
items/LinkedCard 51 305 16 96
items/Memory0 433 305 16 16
items/Memory1 450 305 16 16
items/Memory2 467 305 16 16
items/Memory3 484 305 16 16
items/Memory4 0 402 16 16
items/Memory5 17 402 16 16
items/NetworkCard 34 402 16 16
items/RedstoneCard0 51 402 16 16
items/RedstoneCard1 68 402 16 16
items/Server0 85 402 16 16
items/Server1 102 402 16 16
items/Server2 119 402 16 16
items/Server3 136 402 16 16
items/SoundCard 485 0 16 128
items/WirelessNetworkCard0 153 402 16 16
items/WirelessNetworkCard1 170 402 16 16
light-panel/BookmarkLeft 459 402 18 14
light-panel/BookmarkRight 122 363 20 14
light-panel/BorderB 502 36 4 4
light-panel/BorderL 502 81 4 2
light-panel/BorderR 507 36 4 4
light-panel/BorderT 502 41 4 4
light-panel/CornerBL 507 41 4 4
light-panel/CornerBR 502 46 4 4
light-panel/CornerTL 507 46 4 4
light-panel/CornerTR 502 51 4 4
light-panel/Fill 506 84 2 2
light-panel/Vent 0 463 2 38
nodes/Cable 3 474 8 8
nodes/Camera 187 402 16 16
nodes/Computer 204 402 16 16
nodes/ComputerActivityOverlay 221 402 16 16
nodes/ComputerErrorOverlay 238 402 16 16
nodes/ComputerOnOverlay 255 402 16 16
nodes/DiskDrive 272 402 16 16
nodes/DiskDriveActivity 289 402 16 16
nodes/DiskDriveFloppy 306 402 16 16
nodes/IronNoteBlock 323 402 16 16
nodes/Lamp 340 402 16 16
nodes/LampFrame 357 402 16 16
nodes/LampGlow 305 0 128 128
nodes/NewNode 374 402 16 16
nodes/NoteBlock 391 402 16 16
nodes/Relay 408 402 16 16
nodes/Screen 425 402 16 16
nodes/ScreenOnOverlay 442 402 16 16
panel/BorderB 507 51 4 4
panel/BorderL 507 81 4 2
panel/BorderR 502 56 4 4
panel/BorderT 507 56 4 4
panel/CornerBL 502 61 4 4
panel/CornerBR 507 61 4 4
panel/CornerTL 502 66 4 4
panel/CornerTR 507 66 4 4
panel/Fill 509 84 2 2
particles/Note 21 463 7 10
screen/BorderB 505 25 2 8
screen/BorderT 502 25 2 10
screen/CornerBL 12 474 8 8
screen/CornerBR 21 474 8 8
screen/CornerTL 3 463 8 10
screen/CornerTR 12 463 8 10
window/BorderDark 502 84 1 4
window/BorderLight 504 84 1 4
window/CloseButton 30 474 7 6
window/CornerBL 502 71 4 4
window/CornerBR 507 71 4 4
window/CornerTL 502 76 4 4
window/CornerTR 507 76 4 4

View File

@ -31,7 +31,7 @@ abstract class Node(val entity: Entity with Environment) extends Widget with Dra
protected val NoHighlight: RGBAColor = RGBAColor(160, 160, 160, 0)
protected val highlight = new ColorAnimation(RGBAColor(0, 0, 0, 0))
protected val canOpen = false
protected val exposeAddress = true
protected def exposeAddress = true
protected var isMoving = false
private var grabPoint: Vector2D = Vector2D(0, 0)
@ -282,6 +282,8 @@ abstract class Node(val entity: Entity with Environment) extends Widget with Dra
g.sprite(icon, position.x + 2, position.y + 2, size.width - 4, size.height - 4, color = iconColor)
}
def drawLight(g: Graphics): Unit = {}
def drawLabel(g: Graphics): Unit = {
if (!exposeAddress) return

View File

@ -1,23 +1,36 @@
package ocelot.desktop.node.nodes
import ocelot.desktop.color.{IntColor, RGBAColor}
import ocelot.desktop.geometry.{Rect2D, Size2D, Vector2D}
import ocelot.desktop.color.RGBAColor
import ocelot.desktop.graphics.Graphics
import ocelot.desktop.node.Node
import ocelot.desktop.ui.event.HoverEvent
import totoro.ocelot.brain.entity.ColorfulLamp
class ColorfulLampNode(val lamp: ColorfulLamp) extends Node(lamp) {
private var lastColor: RGBAColor = RGBAColor(0, 0, 0)
private var mouseHover: Boolean = false
override def exposeAddress = mouseHover
override def draw(g: Graphics): Unit = {
super.draw(g)
val color: RGBAColor = RGBAColor(
lastColor = RGBAColor(
(((lamp.color >>> 10) & 0x1F) << 3).toShort,
(((lamp.color >>> 5) & 0x1F) << 3).toShort,
(((lamp.color >>> 0) & 0x1F) << 3).toShort
)
g.rect(position.x, position.y, size.width, size.height, color)
g.sprite("nodes/LampFrame", position.x, position.y, size.width, size.height)
g.sprite("nodes/LampGlow", position - size / 2, size * 2, color)
g.rect(position.x + 2, position.y + 2, size.width - 4, size.height - 4, lastColor)
g.sprite("nodes/LampFrame", position.x + 2, position.y + 2, size.width - 4, size.height - 4)
}
override def drawLight(g: Graphics): Unit = {
super.drawLight(g)
g.sprite("nodes/LampGlow", position - size / 2, size * 2, lastColor)
}
eventHandlers += {
case event: HoverEvent =>
mouseHover = event.state == HoverEvent.State.Enter
}
}

View File

@ -487,6 +487,7 @@ class WorkspaceView extends Widget with DragHandler with ClickHandler with Hover
}
nodes.foreach(_.draw(g))
nodes.foreach(_.drawLight(g))
nodes.foreach(_.drawLabel(g))
nodes.foreach(_.drawParticles(g))