nettoyage des assets

This commit is contained in:
2026-08-30 17:17:11 +02:00
parent 82314d7d85
commit d25ece88b8
44 changed files with 445 additions and 7261 deletions
BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 237 KiB

Binary file not shown.
-199
View File
@@ -1,199 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>EditorWindow</class>
<widget class="QMainWindow" name="m_editorWindow">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>800</width>
<height>600</height>
</rect>
</property>
<property name="windowTitle">
<string>CosmicEngine Editor</string>
</property>
<widget class="QWidget" name="centralwidget">
<widget class="QToolBox" name="m_leftToolBox">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>211</width>
<height>431</height>
</rect>
</property>
<property name="currentIndex">
<number>1</number>
</property>
<widget class="QWidget" name="m_scenePage">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>211</width>
<height>377</height>
</rect>
</property>
<attribute name="label">
<string>Scene</string>
</attribute>
</widget>
<widget class="QWidget" name="m_entitiesPage">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>211</width>
<height>377</height>
</rect>
</property>
<attribute name="label">
<string>Entities</string>
</attribute>
</widget>
</widget>
<widget class="QOpenGLWidget" name="m_openGLPreview">
<property name="geometry">
<rect>
<x>220</x>
<y>0</y>
<width>361</width>
<height>351</height>
</rect>
</property>
</widget>
<widget class="QToolBox" name="m_rightToolBox">
<property name="geometry">
<rect>
<x>590</x>
<y>0</y>
<width>211</width>
<height>431</height>
</rect>
</property>
<property name="currentIndex">
<number>1</number>
</property>
<widget class="QWidget" name="m_modelsPage">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>211</width>
<height>377</height>
</rect>
</property>
<attribute name="label">
<string>Models</string>
</attribute>
</widget>
<widget class="QWidget" name="m_shadersPage">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>211</width>
<height>377</height>
</rect>
</property>
<attribute name="label">
<string>Shaders</string>
</attribute>
</widget>
</widget>
<widget class="QTextBrowser" name="m_logTextBrowser">
<property name="geometry">
<rect>
<x>10</x>
<y>450</y>
<width>781</width>
<height>101</height>
</rect>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAsNeeded</enum>
</property>
<property name="cursorWidth">
<number>1</number>
</property>
</widget>
<widget class="QPushButton" name="m_buttonPlay">
<property name="geometry">
<rect>
<x>220</x>
<y>380</y>
<width>75</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>Play</string>
</property>
</widget>
<widget class="QPushButton" name="m_buttonStop">
<property name="geometry">
<rect>
<x>360</x>
<y>380</y>
<width>75</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>Stop</string>
</property>
</widget>
<widget class="QPushButton" name="m_buttonReset">
<property name="geometry">
<rect>
<x>500</x>
<y>380</y>
<width>75</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>Reset</string>
</property>
</widget>
</widget>
<widget class="QMenuBar" name="m_menubar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>800</width>
<height>21</height>
</rect>
</property>
<widget class="QMenu" name="m_menuFile">
<property name="title">
<string>File</string>
</property>
</widget>
<widget class="QMenu" name="m_menuEdit">
<property name="title">
<string>Edit</string>
</property>
</widget>
<widget class="QMenu" name="m_menuTools">
<property name="title">
<string>Tools</string>
</property>
</widget>
<widget class="QMenu" name="m_menuHelp">
<property name="title">
<string>Help</string>
</property>
</widget>
<addaction name="m_menuFile"/>
<addaction name="m_menuEdit"/>
<addaction name="m_menuTools"/>
<addaction name="m_menuHelp"/>
</widget>
<widget class="QStatusBar" name="m_statusbar"/>
</widget>
<resources/>
<connections/>
</ui>
-199
View File
@@ -1,199 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>m_editorWindow</class>
<widget class="QMainWindow" name="m_editorWindow">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>800</width>
<height>600</height>
</rect>
</property>
<property name="windowTitle">
<string>CosmicEngine Editor</string>
</property>
<widget class="QWidget" name="centralwidget">
<widget class="QToolBox" name="m_leftToolBox">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>211</width>
<height>431</height>
</rect>
</property>
<property name="currentIndex">
<number>1</number>
</property>
<widget class="QWidget" name="m_scenePage">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>100</width>
<height>30</height>
</rect>
</property>
<attribute name="label">
<string>Scene</string>
</attribute>
</widget>
<widget class="QWidget" name="m_entitiesPage">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>211</width>
<height>377</height>
</rect>
</property>
<attribute name="label">
<string>Entities</string>
</attribute>
</widget>
</widget>
<widget class="QToolBox" name="m_rightToolBox">
<property name="geometry">
<rect>
<x>590</x>
<y>0</y>
<width>211</width>
<height>431</height>
</rect>
</property>
<property name="currentIndex">
<number>1</number>
</property>
<widget class="QWidget" name="m_modelsPage">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>100</width>
<height>30</height>
</rect>
</property>
<attribute name="label">
<string>Models</string>
</attribute>
</widget>
<widget class="QWidget" name="m_shadersPage">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>211</width>
<height>377</height>
</rect>
</property>
<attribute name="label">
<string>Shaders</string>
</attribute>
</widget>
</widget>
<widget class="QTextBrowser" name="m_logTextBrowser">
<property name="geometry">
<rect>
<x>10</x>
<y>450</y>
<width>781</width>
<height>101</height>
</rect>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAsNeeded</enum>
</property>
<property name="cursorWidth">
<number>1</number>
</property>
</widget>
<widget class="QPushButton" name="m_buttonPlay">
<property name="geometry">
<rect>
<x>220</x>
<y>380</y>
<width>75</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>Play</string>
</property>
</widget>
<widget class="QPushButton" name="m_buttonStop">
<property name="geometry">
<rect>
<x>360</x>
<y>380</y>
<width>75</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>Stop</string>
</property>
</widget>
<widget class="QPushButton" name="m_buttonReset">
<property name="geometry">
<rect>
<x>500</x>
<y>380</y>
<width>75</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>Reset</string>
</property>
</widget>
<widget class="QWidget" name="m_openGLPreview" native="true">
<property name="geometry">
<rect>
<x>210</x>
<y>0</y>
<width>381</width>
<height>351</height>
</rect>
</property>
</widget>
</widget>
<widget class="QMenuBar" name="m_menubar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>800</width>
<height>21</height>
</rect>
</property>
<widget class="QMenu" name="m_menuFile">
<property name="title">
<string>File</string>
</property>
</widget>
<widget class="QMenu" name="m_menuEdit">
<property name="title">
<string>Edit</string>
</property>
</widget>
<widget class="QMenu" name="m_menuTools">
<property name="title">
<string>Tools</string>
</property>
</widget>
<widget class="QMenu" name="m_menuHelp">
<property name="title">
<string>Help</string>
</property>
</widget>
<addaction name="m_menuFile"/>
<addaction name="m_menuEdit"/>
<addaction name="m_menuTools"/>
<addaction name="m_menuHelp"/>
</widget>
<widget class="QStatusBar" name="m_statusbar"/>
</widget>
<resources/>
<connections/>
</ui>
BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

@@ -0,0 +1,6 @@
{
"actions": [
"MoveForward",
"MoveBackward"
]
}
@@ -0,0 +1,14 @@
{
"bindings": [
{
"action": "MoveForward",
"device": "keyboard",
"key": "z"
},
{
"action": "MoveBackward",
"device": "keyboard",
"key": "s"
}
]
}
+27
View File
@@ -0,0 +1,27 @@
{
"window": {
"width": 1280,
"height": 720,
"fullscreen": false,
"vsync": false,
"title": "CosmicEngine"
},
"graphics": {
"validationLayers": false,
"maxFramesInFlight": 2,
"msaa": false
},
"audio": {
"masterGain": 1.0,
"musicGain": 1.0,
"ambianceGain": 1.0,
"uiGain": 1.0
},
"input": {
"mouseSensitivity": 0.1,
"invertMouseX": false,
"invertMouseY": false,
"bindingsPath": "assets/configs/engine/bindings_default.json",
"actionsPath": "assets/configs/engine/actions_default.json"
}
}
+6
View File
@@ -0,0 +1,6 @@
{
"actions": [
"MoveForward",
"MoveBackward"
]
}
+14
View File
@@ -0,0 +1,14 @@
{
"bindings": [
{
"action": "MoveForward",
"device": "keyboard",
"key": "z"
},
{
"action": "MoveBackward",
"device": "keyboard",
"key": "s"
}
]
}
+27
View File
@@ -0,0 +1,27 @@
{
"window": {
"width": 1280,
"height": 720,
"fullscreen": false,
"vsync": false,
"title": "My game"
},
"graphics": {
"validationLayers": false,
"maxFramesInFlight": 2,
"msaa": false
},
"audio": {
"masterGain": 1.0,
"musicGain": 1.0,
"ambianceGain": 1.0,
"uiGain": 1.0
},
"input": {
"mouseSensitivity": 0.1,
"invertMouseX": false,
"invertMouseY": false,
"bindingsPath": "assets/configs/game/bindings_default.json",
"actionsPath": "assets/configs/game/actions_default.json"
}
}
@@ -66,7 +66,9 @@
"transform": { "ID": 2069, "$ref": "#/definitions/Transform2D" },
"renderer": { "ID": 2070, "$ref": "#/definitions/Renderer2D" },
"camera": { "ID": 2071, "$ref": "#/definitions/Camera2D" },
"collider": { "ID": 2072, "$ref": "#/definitions/Collider2D" }
"collider": { "ID": 2072, "$ref": "#/definitions/Collider2D" },
"text": { "ID": 2073, "$ref": "#/definitions/TextRenderer2D"},
"script": { "ID": 2074, "$ref": "#/definitions/Script" }
}
},
@@ -108,7 +110,7 @@
"rotation": { "ID": 4012, "type": "number" },
"scale": { "ID": 4013, "$ref": "#/definitions/Vec2" },
"size": { "ID": 4014, "$ref": "#/definitions/Vec2" },
"pivot": { "ID": 4015, "$ref": "#/definitions/Vec3" },
"pivot": { "ID": 4015, "$ref": "#/definitions/Vec2" },
"zorder": { "ID": 4016, "type": "integer", "minimum": 0 },
"visible": { "ID": 4017, "type": "boolean" }
},
@@ -134,6 +136,17 @@
"required": ["model", "shader"]
},
"TextRenderer2D": {
"type": ["object", "null"],
"properties": {
"text": { "type": "string", "ID": 4051 },
"shader": { "type": "string", "ID": 4052 },
"color": { "$ref": "#/definitions/Vec4", "ID": 4053},
"font": { "type": "string", "ID": 4054}
},
"required": ["text", "shader", "color", "font"]
},
"Camera": {
"type": ["object", "null"],
"properties": {
@@ -249,13 +262,8 @@
},
"Script": {
"type": ["object", "null"],
"properties": {
"scriptNames": {
"type": "array",
"items": {"type" : "string", "ID": 3079}}
},
"required": ["scriptNames"]
"type": "array",
"items": {"type" : "string", "ID": 3079}
}
}
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 135 KiB

+24
View File
@@ -0,0 +1,24 @@
{
"meshes": [
{
"vertices": [
{ "x": -0.5, "y": -0.5, "u": 0.0, "v": 0.0, "r": 1.0, "g": 1.0, "b": 1.0, "a": 0.0 },
{ "x": 0.5, "y": -0.5, "u": 1.0, "v": 0.0, "r": 1.0, "g": 1.0, "b": 1.0, "a": 0.0 },
{ "x": 0.5, "y": 0.5, "u": 1.0, "v": 1.0, "r": 1.0, "g": 1.0, "b": 1.0, "a": 0.0 },
{ "x": -0.5, "y": 0.5, "u": 0.0, "v": 1.0, "r": 1.0, "g": 1.0, "b": 1.0, "a": 0.0 }
],
"indices": [0, 1, 2, 2, 3, 0],
"material": {
"material": {
"color": {
"r": 0.0,
"g": 0.0,
"b": 1.0,
"a": 0.0
},
"alpha_blend": false
}
}
}
]
}
Binary file not shown.
-12
View File
@@ -1,12 +0,0 @@
# Blender MTL File: 'None'
# Material Count: 1
newmtl Material.003
Ns 323.999994
Ka 1.000000 1.000000 1.000000
Kd 0.800000 0.000000 0.587194
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.000000
d 1.000000
illum 2
-170
View File
@@ -1,170 +0,0 @@
# Blender v2.90.1 OBJ File: ''
# www.blender.org
mtllib cone.mtl
o Cone
v 0.000000 -1.000000 -1.000000
v 0.195090 -1.000000 -0.980785
v 0.382683 -1.000000 -0.923880
v 0.555570 -1.000000 -0.831470
v 0.707107 -1.000000 -0.707107
v 0.831470 -1.000000 -0.555570
v 0.923880 -1.000000 -0.382683
v 0.980785 -1.000000 -0.195090
v 1.000000 -1.000000 -0.000000
v 0.980785 -1.000000 0.195090
v 0.923880 -1.000000 0.382683
v 0.831470 -1.000000 0.555570
v 0.707107 -1.000000 0.707107
v 0.555570 -1.000000 0.831470
v 0.382683 -1.000000 0.923880
v 0.195090 -1.000000 0.980785
v -0.000000 -1.000000 1.000000
v -0.195091 -1.000000 0.980785
v -0.382684 -1.000000 0.923879
v -0.555571 -1.000000 0.831469
v -0.707107 -1.000000 0.707106
v -0.831470 -1.000000 0.555570
v -0.923880 -1.000000 0.382683
v -0.980785 -1.000000 0.195089
v -1.000000 -1.000000 -0.000001
v -0.980785 -1.000000 -0.195091
v -0.923879 -1.000000 -0.382684
v -0.831469 -1.000000 -0.555571
v -0.707106 -1.000000 -0.707108
v -0.555569 -1.000000 -0.831470
v -0.382682 -1.000000 -0.923880
v -0.195089 -1.000000 -0.980786
v 0.000000 1.000000 0.000000
vt 0.250000 0.490000
vt 0.250000 0.250000
vt 0.296822 0.485388
vt 0.341844 0.471731
vt 0.383337 0.449553
vt 0.419706 0.419706
vt 0.449553 0.383337
vt 0.471731 0.341844
vt 0.485388 0.296822
vt 0.490000 0.250000
vt 0.485388 0.203178
vt 0.471731 0.158156
vt 0.449553 0.116663
vt 0.419706 0.080294
vt 0.383337 0.050447
vt 0.341844 0.028269
vt 0.296822 0.014612
vt 0.250000 0.010000
vt 0.203178 0.014612
vt 0.158156 0.028269
vt 0.116663 0.050447
vt 0.080294 0.080294
vt 0.050447 0.116663
vt 0.028269 0.158156
vt 0.014611 0.203179
vt 0.010000 0.250000
vt 0.014612 0.296822
vt 0.028269 0.341844
vt 0.050447 0.383337
vt 0.080295 0.419706
vt 0.116663 0.449553
vt 0.158156 0.471731
vt 0.750000 0.490000
vt 0.796822 0.485388
vt 0.841844 0.471731
vt 0.883337 0.449553
vt 0.919706 0.419706
vt 0.949553 0.383337
vt 0.971731 0.341844
vt 0.985388 0.296822
vt 0.990000 0.250000
vt 0.985388 0.203178
vt 0.971731 0.158156
vt 0.949553 0.116663
vt 0.919706 0.080294
vt 0.883337 0.050447
vt 0.841844 0.028269
vt 0.796822 0.014612
vt 0.750000 0.010000
vt 0.703178 0.014612
vt 0.658156 0.028269
vt 0.616663 0.050447
vt 0.580294 0.080294
vt 0.550447 0.116663
vt 0.528269 0.158156
vt 0.514611 0.203179
vt 0.510000 0.250000
vt 0.514612 0.296822
vt 0.528269 0.341844
vt 0.550447 0.383337
vt 0.580295 0.419706
vt 0.616663 0.449553
vt 0.658156 0.471731
vt 0.703179 0.485389
vt 0.203179 0.485389
vn 0.0878 0.4455 -0.8910
vn 0.2599 0.4455 -0.8567
vn 0.4220 0.4455 -0.7896
vn 0.5680 0.4455 -0.6921
vn 0.6921 0.4455 -0.5680
vn 0.7896 0.4455 -0.4220
vn 0.8567 0.4455 -0.2599
vn 0.8910 0.4455 -0.0878
vn 0.8910 0.4455 0.0878
vn 0.8567 0.4455 0.2599
vn 0.7896 0.4455 0.4220
vn 0.6921 0.4455 0.5680
vn 0.5680 0.4455 0.6921
vn 0.4220 0.4455 0.7896
vn 0.2599 0.4455 0.8567
vn 0.0878 0.4455 0.8910
vn -0.0878 0.4455 0.8910
vn -0.2599 0.4455 0.8567
vn -0.4220 0.4455 0.7896
vn -0.5680 0.4455 0.6921
vn -0.6921 0.4455 0.5680
vn -0.7896 0.4455 0.4220
vn -0.8567 0.4455 0.2599
vn -0.8910 0.4455 0.0878
vn -0.8910 0.4455 -0.0878
vn -0.8567 0.4455 -0.2599
vn -0.7896 0.4455 -0.4220
vn -0.6921 0.4455 -0.5680
vn -0.5680 0.4455 -0.6921
vn -0.4220 0.4455 -0.7896
vn 0.0000 -1.0000 -0.0000
vn -0.2599 0.4455 -0.8567
vn -0.0878 0.4455 -0.8910
usemtl Material.003
s off
f 1/1/1 33/2/1 2/3/1
f 2/3/2 33/2/2 3/4/2
f 3/4/3 33/2/3 4/5/3
f 4/5/4 33/2/4 5/6/4
f 5/6/5 33/2/5 6/7/5
f 6/7/6 33/2/6 7/8/6
f 7/8/7 33/2/7 8/9/7
f 8/9/8 33/2/8 9/10/8
f 9/10/9 33/2/9 10/11/9
f 10/11/10 33/2/10 11/12/10
f 11/12/11 33/2/11 12/13/11
f 12/13/12 33/2/12 13/14/12
f 13/14/13 33/2/13 14/15/13
f 14/15/14 33/2/14 15/16/14
f 15/16/15 33/2/15 16/17/15
f 16/17/16 33/2/16 17/18/16
f 17/18/17 33/2/17 18/19/17
f 18/19/18 33/2/18 19/20/18
f 19/20/19 33/2/19 20/21/19
f 20/21/20 33/2/20 21/22/20
f 21/22/21 33/2/21 22/23/21
f 22/23/22 33/2/22 23/24/22
f 23/24/23 33/2/23 24/25/23
f 24/25/24 33/2/24 25/26/24
f 25/26/25 33/2/25 26/27/25
f 26/27/26 33/2/26 27/28/26
f 27/28/27 33/2/27 28/29/27
f 28/29/28 33/2/28 29/30/28
f 29/30/29 33/2/29 30/31/29
f 30/31/30 33/2/30 31/32/30
f 1/33/31 2/34/31 3/35/31 4/36/31 5/37/31 6/38/31 7/39/31 8/40/31 9/41/31 10/42/31 11/43/31 12/44/31 13/45/31 14/46/31 15/47/31 16/48/31 17/49/31 18/50/31 19/51/31 20/52/31 21/53/31 22/54/31 23/55/31 24/56/31 25/57/31 26/58/31 27/59/31 28/60/31 29/61/31 30/62/31 31/63/31 32/64/31
f 31/32/32 33/2/32 32/65/32
f 32/65/33 33/2/33 1/1/33
-12
View File
@@ -1,12 +0,0 @@
# Blender MTL File: 'None'
# Material Count: 1
newmtl Material
Ns 323.999994
Ka 1.000000 1.000000 1.000000
Kd 0.017824 0.005779 0.800000
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.000000
d 1.000000
illum 2
-40
View File
@@ -1,40 +0,0 @@
# Blender v2.90.1 OBJ File: ''
# www.blender.org
mtllib cube.mtl
o Cube
v 1.000000 1.000000 -1.000000
v 1.000000 -1.000000 -1.000000
v 1.000000 1.000000 1.000000
v 1.000000 -1.000000 1.000000
v -1.000000 1.000000 -1.000000
v -1.000000 -1.000000 -1.000000
v -1.000000 1.000000 1.000000
v -1.000000 -1.000000 1.000000
vt 0.625000 0.500000
vt 0.875000 0.500000
vt 0.875000 0.750000
vt 0.625000 0.750000
vt 0.375000 0.750000
vt 0.625000 1.000000
vt 0.375000 1.000000
vt 0.375000 0.000000
vt 0.625000 0.000000
vt 0.625000 0.250000
vt 0.375000 0.250000
vt 0.125000 0.500000
vt 0.375000 0.500000
vt 0.125000 0.750000
vn 0.0000 1.0000 0.0000
vn 0.0000 0.0000 1.0000
vn -1.0000 0.0000 0.0000
vn 0.0000 -1.0000 0.0000
vn 1.0000 0.0000 0.0000
vn 0.0000 0.0000 -1.0000
usemtl Material
s off
f 1/1/1 5/2/1 7/3/1 3/4/1
f 4/5/2 3/4/2 7/6/2 8/7/2
f 8/8/3 7/9/3 5/10/3 6/11/3
f 6/12/4 2/13/4 4/5/4 8/14/4
f 2/13/5 1/1/5 3/4/5 4/5/5
f 6/11/6 5/10/6 1/1/6 2/13/6
-12
View File
@@ -1,12 +0,0 @@
# Blender MTL File: 'None'
# Material Count: 1
newmtl Material.002
Ns 323.999994
Ka 1.000000 1.000000 1.000000
Kd 0.800000 0.000000 0.002363
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.000000
d 1.000000
illum 2
-268
View File
@@ -1,268 +0,0 @@
# Blender v2.90.1 OBJ File: ''
# www.blender.org
mtllib cylindre.mtl
o Cylinder
v 0.000000 -1.000000 -1.000000
v 0.000000 1.000000 -1.000000
v 0.195090 -1.000000 -0.980785
v 0.195090 1.000000 -0.980785
v 0.382683 -1.000000 -0.923880
v 0.382683 1.000000 -0.923880
v 0.555570 -1.000000 -0.831470
v 0.555570 1.000000 -0.831470
v 0.707107 -1.000000 -0.707107
v 0.707107 1.000000 -0.707107
v 0.831470 -1.000000 -0.555570
v 0.831470 1.000000 -0.555570
v 0.923880 -1.000000 -0.382683
v 0.923880 1.000000 -0.382683
v 0.980785 -1.000000 -0.195090
v 0.980785 1.000000 -0.195090
v 1.000000 -1.000000 -0.000000
v 1.000000 1.000000 -0.000000
v 0.980785 -1.000000 0.195090
v 0.980785 1.000000 0.195090
v 0.923880 -1.000000 0.382683
v 0.923880 1.000000 0.382683
v 0.831470 -1.000000 0.555570
v 0.831470 1.000000 0.555570
v 0.707107 -1.000000 0.707107
v 0.707107 1.000000 0.707107
v 0.555570 -1.000000 0.831470
v 0.555570 1.000000 0.831470
v 0.382683 -1.000000 0.923880
v 0.382683 1.000000 0.923880
v 0.195090 -1.000000 0.980785
v 0.195090 1.000000 0.980785
v -0.000000 -1.000000 1.000000
v -0.000000 1.000000 1.000000
v -0.195091 -1.000000 0.980785
v -0.195091 1.000000 0.980785
v -0.382684 -1.000000 0.923879
v -0.382684 1.000000 0.923879
v -0.555571 -1.000000 0.831469
v -0.555571 1.000000 0.831469
v -0.707107 -1.000000 0.707106
v -0.707107 1.000000 0.707106
v -0.831470 -1.000000 0.555570
v -0.831470 1.000000 0.555570
v -0.923880 -1.000000 0.382683
v -0.923880 1.000000 0.382683
v -0.980785 -1.000000 0.195089
v -0.980785 1.000000 0.195089
v -1.000000 -1.000000 -0.000001
v -1.000000 1.000000 -0.000001
v -0.980785 -1.000000 -0.195091
v -0.980785 1.000000 -0.195091
v -0.923879 -1.000000 -0.382684
v -0.923879 1.000000 -0.382684
v -0.831469 -1.000000 -0.555571
v -0.831469 1.000000 -0.555571
v -0.707106 -1.000000 -0.707108
v -0.707106 1.000000 -0.707108
v -0.555569 -1.000000 -0.831470
v -0.555569 1.000000 -0.831470
v -0.382682 -1.000000 -0.923880
v -0.382682 1.000000 -0.923880
v -0.195089 -1.000000 -0.980786
v -0.195089 1.000000 -0.980786
vt 1.000000 0.500000
vt 1.000000 1.000000
vt 0.968750 1.000000
vt 0.968750 0.500000
vt 0.937500 1.000000
vt 0.937500 0.500000
vt 0.906250 1.000000
vt 0.906250 0.500000
vt 0.875000 1.000000
vt 0.875000 0.500000
vt 0.843750 1.000000
vt 0.843750 0.500000
vt 0.812500 1.000000
vt 0.812500 0.500000
vt 0.781250 1.000000
vt 0.781250 0.500000
vt 0.750000 1.000000
vt 0.750000 0.500000
vt 0.718750 1.000000
vt 0.718750 0.500000
vt 0.687500 1.000000
vt 0.687500 0.500000
vt 0.656250 1.000000
vt 0.656250 0.500000
vt 0.625000 1.000000
vt 0.625000 0.500000
vt 0.593750 1.000000
vt 0.593750 0.500000
vt 0.562500 1.000000
vt 0.562500 0.500000
vt 0.531250 1.000000
vt 0.531250 0.500000
vt 0.500000 1.000000
vt 0.500000 0.500000
vt 0.468750 1.000000
vt 0.468750 0.500000
vt 0.437500 1.000000
vt 0.437500 0.500000
vt 0.406250 1.000000
vt 0.406250 0.500000
vt 0.375000 1.000000
vt 0.375000 0.500000
vt 0.343750 1.000000
vt 0.343750 0.500000
vt 0.312500 1.000000
vt 0.312500 0.500000
vt 0.281250 1.000000
vt 0.281250 0.500000
vt 0.250000 1.000000
vt 0.250000 0.500000
vt 0.218750 1.000000
vt 0.218750 0.500000
vt 0.187500 1.000000
vt 0.187500 0.500000
vt 0.156250 1.000000
vt 0.156250 0.500000
vt 0.125000 1.000000
vt 0.125000 0.500000
vt 0.093750 1.000000
vt 0.093750 0.500000
vt 0.062500 1.000000
vt 0.062500 0.500000
vt 0.296822 0.485388
vt 0.250000 0.490000
vt 0.203179 0.485389
vt 0.158156 0.471731
vt 0.116663 0.449553
vt 0.080295 0.419706
vt 0.050447 0.383337
vt 0.028269 0.341844
vt 0.014612 0.296822
vt 0.010000 0.250000
vt 0.014611 0.203179
vt 0.028269 0.158156
vt 0.050447 0.116663
vt 0.080294 0.080294
vt 0.116663 0.050447
vt 0.158156 0.028269
vt 0.203178 0.014612
vt 0.250000 0.010000
vt 0.296822 0.014612
vt 0.341844 0.028269
vt 0.383337 0.050447
vt 0.419706 0.080294
vt 0.449553 0.116663
vt 0.471731 0.158156
vt 0.485388 0.203178
vt 0.490000 0.250000
vt 0.485388 0.296822
vt 0.471731 0.341844
vt 0.449553 0.383337
vt 0.419706 0.419706
vt 0.383337 0.449553
vt 0.341844 0.471731
vt 0.031250 1.000000
vt 0.031250 0.500000
vt 0.000000 1.000000
vt 0.000000 0.500000
vt 0.750000 0.490000
vt 0.796822 0.485388
vt 0.841844 0.471731
vt 0.883337 0.449553
vt 0.919706 0.419706
vt 0.949553 0.383337
vt 0.971731 0.341844
vt 0.985388 0.296822
vt 0.990000 0.250000
vt 0.985388 0.203178
vt 0.971731 0.158156
vt 0.949553 0.116663
vt 0.919706 0.080294
vt 0.883337 0.050447
vt 0.841844 0.028269
vt 0.796822 0.014612
vt 0.750000 0.010000
vt 0.703178 0.014612
vt 0.658156 0.028269
vt 0.616663 0.050447
vt 0.580294 0.080294
vt 0.550447 0.116663
vt 0.528269 0.158156
vt 0.514611 0.203179
vt 0.510000 0.250000
vt 0.514612 0.296822
vt 0.528269 0.341844
vt 0.550447 0.383337
vt 0.580295 0.419706
vt 0.616663 0.449553
vt 0.658156 0.471731
vt 0.703179 0.485389
vn 0.0980 0.0000 -0.9952
vn 0.2903 0.0000 -0.9569
vn 0.4714 0.0000 -0.8819
vn 0.6344 0.0000 -0.7730
vn 0.7730 0.0000 -0.6344
vn 0.8819 0.0000 -0.4714
vn 0.9569 0.0000 -0.2903
vn 0.9952 0.0000 -0.0980
vn 0.9952 0.0000 0.0980
vn 0.9569 0.0000 0.2903
vn 0.8819 0.0000 0.4714
vn 0.7730 0.0000 0.6344
vn 0.6344 0.0000 0.7730
vn 0.4714 0.0000 0.8819
vn 0.2903 0.0000 0.9569
vn 0.0980 0.0000 0.9952
vn -0.0980 0.0000 0.9952
vn -0.2903 0.0000 0.9569
vn -0.4714 0.0000 0.8819
vn -0.6344 0.0000 0.7730
vn -0.7730 0.0000 0.6344
vn -0.8819 0.0000 0.4714
vn -0.9569 0.0000 0.2903
vn -0.9952 0.0000 0.0980
vn -0.9952 0.0000 -0.0980
vn -0.9569 0.0000 -0.2903
vn -0.8819 0.0000 -0.4714
vn -0.7730 0.0000 -0.6344
vn -0.6344 0.0000 -0.7730
vn -0.4714 0.0000 -0.8819
vn 0.0000 1.0000 0.0000
vn -0.2903 0.0000 -0.9569
vn -0.0980 0.0000 -0.9952
vn 0.0000 -1.0000 -0.0000
usemtl Material.002
s off
f 1/1/1 2/2/1 4/3/1 3/4/1
f 3/4/2 4/3/2 6/5/2 5/6/2
f 5/6/3 6/5/3 8/7/3 7/8/3
f 7/8/4 8/7/4 10/9/4 9/10/4
f 9/10/5 10/9/5 12/11/5 11/12/5
f 11/12/6 12/11/6 14/13/6 13/14/6
f 13/14/7 14/13/7 16/15/7 15/16/7
f 15/16/8 16/15/8 18/17/8 17/18/8
f 17/18/9 18/17/9 20/19/9 19/20/9
f 19/20/10 20/19/10 22/21/10 21/22/10
f 21/22/11 22/21/11 24/23/11 23/24/11
f 23/24/12 24/23/12 26/25/12 25/26/12
f 25/26/13 26/25/13 28/27/13 27/28/13
f 27/28/14 28/27/14 30/29/14 29/30/14
f 29/30/15 30/29/15 32/31/15 31/32/15
f 31/32/16 32/31/16 34/33/16 33/34/16
f 33/34/17 34/33/17 36/35/17 35/36/17
f 35/36/18 36/35/18 38/37/18 37/38/18
f 37/38/19 38/37/19 40/39/19 39/40/19
f 39/40/20 40/39/20 42/41/20 41/42/20
f 41/42/21 42/41/21 44/43/21 43/44/21
f 43/44/22 44/43/22 46/45/22 45/46/22
f 45/46/23 46/45/23 48/47/23 47/48/23
f 47/48/24 48/47/24 50/49/24 49/50/24
f 49/50/25 50/49/25 52/51/25 51/52/25
f 51/52/26 52/51/26 54/53/26 53/54/26
f 53/54/27 54/53/27 56/55/27 55/56/27
f 55/56/28 56/55/28 58/57/28 57/58/28
f 57/58/29 58/57/29 60/59/29 59/60/29
f 59/60/30 60/59/30 62/61/30 61/62/30
f 4/63/31 2/64/31 64/65/31 62/66/31 60/67/31 58/68/31 56/69/31 54/70/31 52/71/31 50/72/31 48/73/31 46/74/31 44/75/31 42/76/31 40/77/31 38/78/31 36/79/31 34/80/31 32/81/31 30/82/31 28/83/31 26/84/31 24/85/31 22/86/31 20/87/31 18/88/31 16/89/31 14/90/31 12/91/31 10/92/31 8/93/31 6/94/31
f 61/62/32 62/61/32 64/95/32 63/96/32
f 63/96/33 64/95/33 2/97/33 1/98/33
f 1/99/34 3/100/34 5/101/34 7/102/34 9/103/34 11/104/34 13/105/34 15/106/34 17/107/34 19/108/34 21/109/34 23/110/34 25/111/34 27/112/34 29/113/34 31/114/34 33/115/34 35/116/34 37/117/34 39/118/34 41/119/34 43/120/34 45/121/34 47/122/34 49/123/34 51/124/34 53/125/34 55/126/34 57/127/34 59/128/34 61/129/34 63/130/34
-10
View File
@@ -1,10 +0,0 @@
# Blender MTL File: 'None'
# Material Count: 1
newmtl None
Ns 500
Ka 0.8 0.8 0.8
Kd 0.8 0.8 0.8
Ks 0.8 0.8 0.8
d 1
illum 2
File diff suppressed because it is too large Load Diff
-12
View File
@@ -1,12 +0,0 @@
# Blender MTL File: 'None'
# Material Count: 1
newmtl Material.001
Ns 323.999994
Ka 1.000000 1.000000 1.000000
Kd 0.066773 0.057077 0.064266
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.000000
d 1.000000
illum 2
-16
View File
@@ -1,16 +0,0 @@
# Blender v2.90.1 OBJ File: ''
# www.blender.org
mtllib plane.mtl
o Plane
v -10.000000 0.000000 10.000000
v 10.000000 0.000000 10.000000
v -10.000000 0.000000 -10.000000
v 10.000000 0.000000 -10.000000
vt 0.000000 0.000000
vt 1.000000 0.000000
vt 1.000000 1.000000
vt 0.000000 1.000000
vn 0.0000 1.0000 0.0000
usemtl Material.001
s off
f 1/1/1 2/2/1 4/3/1 3/4/1
-12
View File
@@ -1,12 +0,0 @@
# Blender MTL File: 'None'
# Material Count: 1
newmtl Material.001
Ns 323.999994
Ka 1.000000 1.000000 1.000000
Kd 0.015470 0.800000 0.000000
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.000000
d 1.000000
illum 2
File diff suppressed because it is too large Load Diff
-12
View File
@@ -1,12 +0,0 @@
# Blender MTL File: 'None'
# Material Count: 1
newmtl Material.004
Ns 323.999994
Ka 1.000000 1.000000 1.000000
Kd 0.800000 0.693157 0.000000
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.000000
d 1.000000
illum 2
File diff suppressed because it is too large Load Diff
-5
View File
@@ -1,5 +0,0 @@
{
"name":"basicColor",
"vert":"basicColor/basicColor.vert",
"frag":"basicColor/basicColor.frag"
}
-16
View File
@@ -1,16 +0,0 @@
#version 330 core
// The result : color of the fragment.
out vec4 FragColor;
// The input variable from the vertex shader (same name and same type).
in vec3 color;
uniform float intensity;
uniform vec4 colorDiffuse0; // Input Color.
void main() {
vec3 ambient = vec3(0.7333, 0.7333, 0.7333);
vec3 diffuse = color;
FragColor = intensity * vec4(ambient + diffuse, 1.0)*colorDiffuse0;
}
-30
View File
@@ -1,30 +0,0 @@
#version 330 core
// Input : vertex attributes.
layout (location = 0) in vec3 aPos; // Position of the vertex.
layout (location = 1) in vec3 aNormal; // Normal of the vertex.
layout (location = 2) in vec2 aTexCoords; // Texture coordonate of the vertex.
layout (location = 3) in vec3 aTangent; // Texture coordonate of the vertex.
layout (location = 4) in vec3 aBitangent; // Texture coordonate of the vertex.
// The result : color of the fragment.
out vec3 color;
// Uniform input variable.
uniform mat4 projection; // Projection of the camera.
uniform mat4 model; // Transforms transformation.
uniform mat4 view; // View transformation of the camera.
uniform vec3 lightPos;
void main() {
gl_Position = projection * view * model * vec4(aPos, 1.0);
vec4 newPos = model * vec4(aPos, 1.0);
// vec4 newNormal = model * vec4(aNormal, 1.0);
vec3 newPos3 = newPos.xyz;
// vec3 newNormal3 = newNormal.xyz;
vec3 newNormal3 = mat3(transpose(inverse(model))) * aNormal;
vec3 lightVec = vec3(normalize((lightPos - newPos3)));
float diffuse = dot(lightVec, newNormal3);
//color = vec3(1,1,1);
color = vec3(diffuse);
}
-5
View File
@@ -1,5 +0,0 @@
{
"name":"basicColor2",
"vert":"basicColor2/basicColor2.vert",
"frag":"basicColor2/basicColor2.frag"
}
@@ -1,17 +0,0 @@
#version 330 core
// The result : color of the fragment.
out vec4 FragColor;
// The input variable from the vertex shader (same name and same type).
in vec3 color;
in vec2 TexCoords;
uniform float intensity;
uniform vec4 colorDiffuse0; // Input Color.
uniform sampler2D textureDiffuse0;
void main() {
vec3 ambient = vec3(0.7333, 0.7333, 0.7333);
vec3 diffuse = color;
FragColor = intensity * vec4(ambient + diffuse, 1.0)*colorDiffuse0 * texture(textureDiffuse0, TexCoords);
}
@@ -1,32 +0,0 @@
#version 330 core
// Input : vertex attributes.
layout (location = 0) in vec3 aPos; // Position of the vertex.
layout (location = 1) in vec3 aNormal; // Normal of the vertex.
layout (location = 2) in vec2 aTexCoords; // Texture coordonate of the vertex.
layout (location = 3) in vec3 aTangent; // Texture coordonate of the vertex.
layout (location = 4) in vec3 aBitangent; // Texture coordonate of the vertex.
// The result : color of the fragment.
out vec3 color;
out vec2 TexCoords;
// Uniform input variable.
uniform mat4 projection; // Projection of the camera.
uniform mat4 model; // Transforms transformation.
uniform mat4 view; // View transformation of the camera.
uniform vec3 lightPos;
void main() {
gl_Position = projection * view * model * vec4(aPos, 1.0);
vec4 newPos = model * vec4(aPos, 1.0);
// vec4 newNormal = model * vec4(aNormal, 1.0);
vec3 newPos3 = newPos.xyz;
// vec3 newNormal3 = newNormal.xyz;
vec3 newNormal3 = mat3(transpose(inverse(model))) * aNormal;
vec3 lightVec = vec3(normalize((lightPos - newPos3)));
float diffuse = dot(lightVec, newNormal3);
//color = vec3(1,1,1);
color = vec3(diffuse);
TexCoords = aTexCoords;
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
+180 -23
View File
@@ -1,31 +1,188 @@
static float2 positions[3] = float2[](
float2(0.0, -0.5),
float2(0.5, 0.5),
float2(-0.5, 0.5)
);
static float3 colors[3] = float3[](
float3(1.0, 0.0, 0.0),
float3(0.0, 1.0, 0.0),
float3(0.0, 0.0, 1.0)
);
struct VertexOutput {
float3 color;
float4 sv_position : SV_Position;
struct VSInput {
[[vk::location(0)]] float3 inPosition;
[[vk::location(1)]] float4 inColor;
[[vk::location(2)]] float3 inNormal;
[[vk::location(3)]] float2 inUV;
[[vk::location(4)]] float3 inTangent;
[[vk::location(5)]] float3 inBitangent;
};
struct VSOutput
{
float4 pos : SV_Position;
float4 color : COLOR;
float2 uv : TEXCOORD0;
float3 normal : NORMAL;
float3 fragPos : TEXCOORD1; // position monde
float3 viewPos : TEXCOORD2; // position caméra
};
// set 0 - Camera
struct CameraUBO {
float4x4 view;
float4x4 projection;
};
[[vk::binding(0, 0)]] ConstantBuffer<CameraUBO> camera;
// set 1 - Transform
struct TransformUBO {
float4x4 model;
};
[[vk::binding(0, 1)]] ConstantBuffer<TransformUBO> transform;
// set 2 - Material
[[vk::binding(1, 2)]] Sampler2D albedoTexture; // texture + sampler combinés, pas de warning
[[vk::binding(2, 2)]] Sampler2D normalTexture; // deuxième texture si besoin
struct LightData {
float4 position; // w = type
float4 direction; // w = range
float4 color; // w = intensity
float innerCosAngle;
float outerCosAngle;
float attenuation;
float padding;
};
struct LightsBuffer {
LightData lights[32];
int lightCount;
};
[[vk::binding(0, 3)]] StructuredBuffer<LightsBuffer> lightsBuffer;
[shader("vertex")]
VertexOutput vertMain(uint vid : SV_VertexID) {
VertexOutput output;
output.sv_position = float4(positions[vid], 0.0, 1.0);
output.color = colors[vid];
VSOutput vertMain(VSInput input) {
VSOutput output;
float4x4 modelMatrix = transform.model;
float4 worldPos = mul(modelMatrix, float4(input.inPosition, 1.0));
output.pos = mul(camera.projection, mul(camera.view, worldPos));
output.color = input.inColor;
output.uv = input.inUV;
// Pour une mise à l'échelle uniforme, on peut utiliser directement la matrice 3x3
float3x3 normalMatrix = (float3x3)modelMatrix;
// Si mises à l'échelle non-uniforme :
// float3x3 normalMatrix = transpose(inverse((float3x3)modelMatrix));
output.normal = normalize(mul(normalMatrix, input.inNormal));
output.fragPos = worldPos.xyz;
// Position de la caméra dans le monde
float3x3 R = (float3x3)camera.view;
output.viewPos = -mul(transpose(R), camera.view[3].xyz);
return output;
}
[shader("fragment")]
float4 fragMain(VertexOutput inVert) : SV_Target
float3 computeDirectional(LightData light, VSOutput vertIn)
{
float3 color = inVert.color;
return float4(color, 1.0);
// Normaliser la normale (l'interpolation peut la dénormaliser)
float3 normal = normalize(vertIn.normal);
// Direction de la lumière (utiliser les données de la lumière)
float3 lightDir = normalize(-light.direction.xyz);
// Direction de la vue
float3 viewDir = normalize(vertIn.viewPos - vertIn.fragPos);
// Diffuse (Lambertian)
float diff = max(dot(normal, lightDir), 0.0);
float3 diffuse = diff * light.color.xyz * light.color.w;
// Specular (Blinn-Phong)
float3 halfVec = normalize(lightDir + viewDir);
float spec = pow(max(dot(normal, halfVec), 0.0), 32.0);
float3 specular = spec * light.color.xyz * light.color.w * 0.5;
// Retourner la somme
return (diffuse + specular) * light.attenuation;
}
float3 computePoint(LightData light, VSOutput vertIn)
{
float3 normal = normalize(vertIn.normal);
float3 viewDir = normalize(vertIn.viewPos - vertIn.fragPos);
// Direction de la lumière (du point lumineux vers le fragment)
float3 lightDir = normalize(light.position.xyz - vertIn.fragPos);
// Distance pour l'atténuation
float distance = length(light.position.xyz - vertIn.fragPos);
float attenuation = 1.0 / (1.0 + light.attenuation * distance * distance);
// Diffuse
float diff = max(dot(normal, lightDir), 0.0);
float3 diffuse = diff * light.color.xyz * light.color.w;
// Specular
float3 halfVec = normalize(lightDir + viewDir);
float spec = pow(max(dot(normal, halfVec), 0.0), 32.0);
float3 specular = spec * light.color.xyz * light.color.w * 0.5;
return (diffuse + specular) * attenuation;
}
float3 computeSpot(LightData light, VSOutput vertIn)
{
float3 normal = normalize(vertIn.normal);
float3 viewDir = normalize(vertIn.viewPos - vertIn.fragPos);
// Direction du fragment vers la lumière
float3 lightDir = normalize(light.position.xyz - vertIn.fragPos);
// Distance et atténuation
float distance = length(light.position.xyz - vertIn.fragPos);
float attenuation = 1.0 / (1.0 + light.attenuation * distance * distance);
// Spot light (cosinus de l'angle entre la direction du spot et la direction vers le fragment)
float cosAngle = dot(-light.direction.xyz, lightDir);
float spotFactor = smoothstep(light.outerCosAngle, light.innerCosAngle, cosAngle);
// Diffuse
float diff = max(dot(normal, lightDir), 0.0);
float3 diffuse = diff * light.color.xyz * light.color.w;
// Specular
float3 halfVec = normalize(lightDir + viewDir);
float spec = pow(max(dot(normal, halfVec), 0.0), 32.0);
float3 specular = spec * light.color.xyz * light.color.w * 0.5;
return (diffuse + specular) * attenuation * spotFactor;
}
[shader("fragment")]
float4 fragMain(VSOutput vertIn) : SV_Target {
// Sample textures
float3 albedo = albedoTexture.Sample(vertIn.uv).rgb;
// Ambient
float3 ambient = 0.03 * albedo;
// Lighting accumulé
float3 lighting = float3(0.0, 0.0, 0.0);
// Récupérer les lumières
LightsBuffer lb = lightsBuffer[0];
for (int i = 0; i < lb.lightCount; i++) {
LightData light = lb.lights[i];
int lightType = (int)light.position.w;
if (lightType == 0)
lighting += computeDirectional(light, vertIn);
else if (lightType == 1)
lighting += computePoint(light, vertIn);
else if (lightType == 2)
lighting += computeSpot(light, vertIn);
}
// Résultat final
float3 finalColor = (ambient + lighting) * albedo;
// Tone mapping simple (optionnel)
// finalColor = finalColor / (finalColor + 1.0);
return float4(finalColor, 1.0);
}
+59
View File
@@ -0,0 +1,59 @@
// =====================================================
// UI Shader pour CosmicCore
// Set 0 : Transform (UBO - par objet)
// Set 1 : Material (UBO + Texture)
// Set 2 : Projection (UBO - global)
// =====================================================
// ─── Inputs ────────────────────────────────────────────
struct VSInput {
[[vk::location(0)]] float2 inPosition;
[[vk::location(1)]] float2 inUV;
[[vk::location(2)]] float4 inColor;
};
// ─── Outputs ───────────────────────────────────────────
struct VSOutput {
float4 pos : SV_Position;
float2 uv : TEXCOORD0;
float4 color : COLOR;
};
// ─── Set 0 : Transform (UBO par objet) ─────────────────
struct TransformUBO {
float4x4 model;
float2 size;
float zOrder;
float padding;
};
[[vk::binding(0, 0)]] ConstantBuffer<TransformUBO> transform;
[[vk::binding(1, 1)]] Sampler2D uiTexture;
// ─── Set 2 : Projection (UBO global) ──────────────────
[[vk::binding(0, 2)]] ConstantBuffer<float4x4> projection;
// ─── Vertex Shader ──────────────────────────────────────
[shader("vertex")]
VSOutput vertMain(VSInput input) {
VSOutput output;
// Transforme local vers monde
float4 worldPos = mul(transform.model, float4(input.inPosition, 0.0, 1.0));
// Applique la projection
output.pos = mul(projection, worldPos);
output.uv = input.inUV;
output.color = input.inColor;
return output;
}
// ─── Fragment Shader ────────────────────────────────────
[shader("fragment")]
float4 fragMain(VSOutput vertIn) : SV_Target {
float4 texColor = uiTexture.Sample(vertIn.uv);
return vertIn.color * texColor;
}
+71
View File
@@ -0,0 +1,71 @@
// =====================================================
// UI Shader pour CosmicCore
// Set 0 : Transform (UBO - par objet)
// Set 1 : Material (UBO + Texture)
// Set 2 : Projection (UBO - global)
// =====================================================
// ─── Inputs ────────────────────────────────────────────
struct VSInput {
[[vk::location(0)]] float2 inPosition;
[[vk::location(1)]] float2 inUV;
[[vk::location(2)]] float4 inColor;
};
// ─── Outputs ───────────────────────────────────────────
struct VSOutput {
float4 pos : SV_Position;
float2 uv : TEXCOORD0;
float4 color : COLOR;
};
// ─── Set 0 : Transform (UBO par objet) ─────────────────
struct TransformUBO {
float4x4 model;
float2 size;
float zOrder;
float padding;
};
[[vk::binding(0, 0)]] ConstantBuffer<TransformUBO> transform;
[[vk::binding(1, 1)]] Sampler2D uiTexture;
// ─── Set 2 : Projection (UBO global) ──────────────────
[[vk::binding(0, 2)]] ConstantBuffer<float4x4> projection;
// ─── Vertex Shader ──────────────────────────────────────
[shader("vertex")]
VSOutput vertMain(VSInput input) {
VSOutput output;
// Transforme local vers monde
float4 worldPos = mul(transform.model, float4(input.inPosition, 0.0, 1.0));
// Applique la projection
output.pos = mul(projection, worldPos);
output.uv = input.inUV;
output.color = input.inColor;
return output;
}
float median(float r, float g, float b) {
return max(min(r, g), min(max(r, g), b));
}
[shader("fragment")]
float4 fragMain(VSOutput vertIn) : SV_Target {
float3 msd = uiTexture.Sample(vertIn.uv).rgb;
float sigDist = median(msd.r, msd.g, msd.b) - 0.5;
// largeur du dégradé en pixels écran (anti-aliasing correct)
float2 unitRange = float2(1.0, 1.0) / float2(212.0, 212.0);
float2 screenTexSize = 1.0 / fwidth(vertIn.uv);
float screenPxRange = max(0.5 * dot(unitRange, screenTexSize), 1.0);
float opacity = clamp(screenPxRange * sigDist + 0.5, 0.0, 1.0);
return float4(vertIn.color.rgb, vertIn.color.a * opacity);
}
BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 242 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.5 KiB