BsBuiltinEditorResources.cpp 73 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663
  1. #include "BsBuiltinEditorResources.h"
  2. #include "BsGUIElementStyle.h"
  3. #include "BsGUILabel.h"
  4. #include "BsGUIButton.h"
  5. #include "BsGUIInputBox.h"
  6. #include "BsGUIToggle.h"
  7. #include "BsGUIColor.h"
  8. #include "BsTextSprite.h"
  9. #include "BsSpriteTexture.h"
  10. #include "BsGUITreeViewEditBox.h"
  11. #include "BsGUIIntField.h"
  12. #include "BsGUIFloatField.h"
  13. #include "BsGUIColorField.h"
  14. #include "BsGUITextField.h"
  15. #include "BsGUIToggleField.h"
  16. #include "BsGUIVector2Field.h"
  17. #include "BsGUIVector3Field.h"
  18. #include "BsGUIVector4Field.h"
  19. #include "BsGUIComponentFoldout.h"
  20. #include "BsGUIFoldout.h"
  21. #include "BsFont.h"
  22. #include "BsFontImportOptions.h"
  23. #include "BsImporter.h"
  24. #include "BsGpuProgram.h"
  25. #include "BsShader.h"
  26. #include "BsTechnique.h"
  27. #include "BsPass.h"
  28. #include "BsMaterial.h"
  29. #include "BsBlendState.h"
  30. #include "BsDepthStencilState.h"
  31. #include "BsRasterizerState.h"
  32. #include "BsGpuProgramImportOptions.h"
  33. #include "BsResources.h"
  34. #include "BsRTTIType.h"
  35. #include "BsFileSystem.h"
  36. namespace BansheeEngine
  37. {
  38. const String BuiltinEditorResources::ObjectFieldStyleName = "GUIObjectField";
  39. const String BuiltinEditorResources::ObjectFieldLabelStyleName = "EditorFieldLabel";
  40. const String BuiltinEditorResources::ObjectFieldDropBtnStyleName = "DropButton";
  41. const String BuiltinEditorResources::ObjectFieldClearBtnStyleName = "ObjectClearButton";
  42. const Path BuiltinEditorResources::DefaultSkinFolderRaw = L"..\\..\\..\\..\\Data\\Raw\\Editor\\Skin\\";
  43. const Path BuiltinEditorResources::DefaultShaderFolderRaw = L"..\\..\\..\\..\\Data\\Raw\\Editor\\Shaders\\";
  44. const Path BuiltinEditorResources::DefaultSkinFolder = L"..\\..\\..\\..\\Data\\Editor\\Skin\\";
  45. const Path BuiltinEditorResources::DefaultShaderFolder = L"..\\..\\..\\..\\Data\\Editor\\Shaders\\";
  46. const WString BuiltinEditorResources::HLSL11ShaderSubFolder = L"HLSL11/";
  47. const WString BuiltinEditorResources::HLSL9ShaderSubFolder = L"HLSL9/";
  48. const WString BuiltinEditorResources::GLSLShaderSubFolder = L"GLSL/";
  49. const WString BuiltinEditorResources::DefaultFontFilename = L"arial.ttf";
  50. const UINT32 BuiltinEditorResources::DefaultFontSize = 10;
  51. const WString BuiltinEditorResources::WindowBackgroundTexture = L"WindowBgTile.psd";
  52. const WString BuiltinEditorResources::ButtonNormalTex = L"ButtonNormal.psd";
  53. const WString BuiltinEditorResources::ButtonHoverTex = L"ButtonHover.psd";
  54. const WString BuiltinEditorResources::ButtonActiveTex = L"ButtonActive.psd";
  55. const WString BuiltinEditorResources::ToggleNormalTex = L"ToggleNormal.psd";
  56. const WString BuiltinEditorResources::ToggleHoverTex = L"ToggleHover.psd";
  57. const WString BuiltinEditorResources::ToggleActiveTex = L"ToggleActive.psd";
  58. const WString BuiltinEditorResources::ToggleNormalOnTex = L"ToggleOnNormal.psd";
  59. const WString BuiltinEditorResources::ToggleHoverOnTex = L"ToggleOnHover.psd";
  60. const WString BuiltinEditorResources::ToggleActiveOnTex = L"ToggleOnActive.psd";
  61. const WString BuiltinEditorResources::ObjectDropBtnNormalTex = L"ObjectFieldDropNormal.psd";
  62. const WString BuiltinEditorResources::ObjectDropBtnNormalOnTex = L"ObjectFieldDropOnNormal.psd";
  63. const WString BuiltinEditorResources::ObjectClearBtnNormalTex = L"ObjectFieldBtnNormal.psd";
  64. const WString BuiltinEditorResources::ObjectClearBtnHoverTex = L"ObjectFieldBtnHover.psd";
  65. const WString BuiltinEditorResources::ObjectClearBtnActiveTex = L"ObjectFieldBtnActive.psd";
  66. const WString BuiltinEditorResources::FoldoutOpenNormalTex = L"FoldoutOpenNormal.psd";
  67. const WString BuiltinEditorResources::FoldoutOpenHoverTex = L"FoldoutOpenHover.psd";
  68. const WString BuiltinEditorResources::FoldoutClosedNormalTex = L"FoldoutClosedNormal.psd";
  69. const WString BuiltinEditorResources::FoldoutClosedHoverTex = L"FoldoutClosedHover.psd";
  70. const WString BuiltinEditorResources::CmpFoldoutOpenNormalTex = L"CmpFoldoutOpenNormal.psd";
  71. const WString BuiltinEditorResources::CmpFoldoutOpenHoverTex = L"CmpFoldoutOpenHover.psd";
  72. const WString BuiltinEditorResources::CmpFoldoutOpenActiveTex = L"CmpFoldoutOpenActive.psd";
  73. const WString BuiltinEditorResources::CmpFoldoutClosedNormalTex = L"CmpFoldoutClosedNormal.psd";
  74. const WString BuiltinEditorResources::CmpFoldoutClosedHoverTex = L"CmpFoldoutClosedHover.psd";
  75. const WString BuiltinEditorResources::CmpFoldoutClosedActiveTex = L"CmpFoldoutClosedActive.psd";
  76. const WString BuiltinEditorResources::WindowFrameNormal = L"WindowFrameNormal.psd";
  77. const WString BuiltinEditorResources::WindowFrameFocused = L"WindowFrameFocused.psd";
  78. const WString BuiltinEditorResources::WindowTitleBarBg = L"WindowTitleBarBg.psd";
  79. const WString BuiltinEditorResources::WindowCloseButtonNormal = L"WindowCloseBtnNormal.psd";
  80. const WString BuiltinEditorResources::WindowCloseButtonHover = L"WindowCloseBtnHover.psd";
  81. const WString BuiltinEditorResources::WindowMinButtonNormal = L"WindowMinBtnNormal.psd";
  82. const WString BuiltinEditorResources::WindowMinButtonHover = L"WindowMinBtnHover.psd";
  83. const WString BuiltinEditorResources::WindowMaxButtonNormal = L"WindowMaxBtnNormal.psd";
  84. const WString BuiltinEditorResources::WindowMaxButtonHover = L"WindowMaxBtnHover.psd";
  85. const WString BuiltinEditorResources::TabbedBarBtnNormal = L"TabbedButtonNormal.psd";
  86. const WString BuiltinEditorResources::TabbedBarBtnActive = L"TabbedButtonActive.psd";
  87. const WString BuiltinEditorResources::InputBoxNormalTex = L"InputBoxNormal.psd";
  88. const WString BuiltinEditorResources::InputBoxHoverTex = L"InputBoxHover.psd";
  89. const WString BuiltinEditorResources::InputBoxFocusedTex = L"InputBoxFocused.psd";
  90. const WString BuiltinEditorResources::ScrollBarUpNormalTex = L"ScrollBarUpNormal.psd";
  91. const WString BuiltinEditorResources::ScrollBarUpHoverTex = L"ScrollBarUpHover.psd";
  92. const WString BuiltinEditorResources::ScrollBarUpActiveTex = L"ScrollBarUpActive.psd";
  93. const WString BuiltinEditorResources::ScrollBarDownNormalTex = L"ScrollBarDownNormal.psd";
  94. const WString BuiltinEditorResources::ScrollBarDownHoverTex = L"ScrollBarDownHover.psd";
  95. const WString BuiltinEditorResources::ScrollBarDownActiveTex = L"ScrollBarDownActive.psd";
  96. const WString BuiltinEditorResources::ScrollBarLeftNormalTex = L"ScrollBarLeftNormal.psd";
  97. const WString BuiltinEditorResources::ScrollBarLeftHoverTex = L"ScrollBarLeftHover.psd";
  98. const WString BuiltinEditorResources::ScrollBarLeftActiveTex = L"ScrollBarLeftActive.psd";
  99. const WString BuiltinEditorResources::ScrollBarRightNormalTex = L"ScrollBarRightNormal.psd";
  100. const WString BuiltinEditorResources::ScrollBarRightHoverTex = L"ScrollBarRightHover.psd";
  101. const WString BuiltinEditorResources::ScrollBarRightActiveTex = L"ScrollBarRightActive.psd";
  102. const WString BuiltinEditorResources::ScrollBarHandleHorzNormalTex = L"ScrollBarHorzHandleNormal.psd";
  103. const WString BuiltinEditorResources::ScrollBarHandleHorzHoverTex = L"ScrollBarHorzHandleHover.psd";
  104. const WString BuiltinEditorResources::ScrollBarHandleHorzActiveTex = L"ScrollBarHorzHandleActive.psd";
  105. const WString BuiltinEditorResources::ScrollBarHandleVertNormalTex = L"ScrollBarVertHandleNormal.psd";
  106. const WString BuiltinEditorResources::ScrollBarHandleVertHoverTex = L"ScrollBarVertHandleHover.psd";
  107. const WString BuiltinEditorResources::ScrollBarHandleVertActiveTex = L"ScrollBarVertHandleActive.psd";
  108. const WString BuiltinEditorResources::DropDownBtnNormalTex = L"DropDownNormal.psd";
  109. const WString BuiltinEditorResources::DropDownBtnHoverTex = L"DropDownHover.psd";
  110. const WString BuiltinEditorResources::DropDownBoxBgTex = L"DropDownBoxBg.psd";
  111. const WString BuiltinEditorResources::DropDownBoxEntryNormalTex = L"DropDownButtonNormal.psd";
  112. const WString BuiltinEditorResources::DropDownBoxEntryHoverTex = L"DropDownButtonHover.psd";
  113. const WString BuiltinEditorResources::DropDownBoxBtnUpNormalTex = L"DropDownBoxBtnUpNormal.psd";
  114. const WString BuiltinEditorResources::DropDownBoxBtnUpHoverTex = L"DropDownBoxBtnUpHover.psd";
  115. const WString BuiltinEditorResources::DropDownBoxBtnDownNormalTex = L"DropDownBoxBtnDownNormal.psd";
  116. const WString BuiltinEditorResources::DropDownBoxBtnDownHoverTex = L"DropDownBoxBtnDownHover.psd";
  117. const WString BuiltinEditorResources::DropDownBoxEntryExpNormalTex = L"DropDownExpNormal.psd";
  118. const WString BuiltinEditorResources::DropDownBoxEntryExpHoverTex = L"DropDownExpHover.psd";
  119. const WString BuiltinEditorResources::DropDownSeparatorTex = L"DropDownSeparator.psd";
  120. const WString BuiltinEditorResources::DropDownBoxBtnUpArrowTex = L"DropDownBoxBtnUpArrow.psd";
  121. const WString BuiltinEditorResources::DropDownBoxBtnDownArrowTex = L"DropDownBoxBtnDownArrow.psd";
  122. const WString BuiltinEditorResources::ScrollBarBgTex = L"ScrollBarBg.psd";
  123. const WString BuiltinEditorResources::MenuBarBgTex = L"MenuBarBg.psd";
  124. const WString BuiltinEditorResources::MenuBarBtnNormalTex = L"MenuBarButtonNormal.psd";
  125. const WString BuiltinEditorResources::MenuBarBtnHoverTex = L"MenuBarButtonHover.psd";
  126. const WString BuiltinEditorResources::MenuBarBansheeLogoTex = L"MenuBarBansheeLogo.psd";
  127. const WString BuiltinEditorResources::DockSliderNormalTex = L"DockSliderBtn.psd";
  128. const WString BuiltinEditorResources::TreeViewExpandButtonOffNormal = L"TreeViewExpandButtonOffNormal.psd";
  129. const WString BuiltinEditorResources::TreeViewExpandButtonOffHover = L"TreeViewExpandButtonOffHover.psd";
  130. const WString BuiltinEditorResources::TreeViewExpandButtonOnNormal = L"TreeViewExpandButtonOnNormal.psd";
  131. const WString BuiltinEditorResources::TreeViewExpandButtonOnHover = L"TreeViewExpandButtonOnHover.psd";
  132. const WString BuiltinEditorResources::TreeViewSelectionBackground = L"TreeViewSelectionBackground.psd";
  133. const WString BuiltinEditorResources::TreeViewEditBox = L"TreeViewEditBox.psd";
  134. const WString BuiltinEditorResources::TreeViewElementHighlight = L"TreeViewElementHighlight.psd";
  135. const WString BuiltinEditorResources::TreeViewElementSepHighlight = L"TreeViewElementSepHighlight.psd";
  136. /************************************************************************/
  137. /* SHADERS */
  138. /************************************************************************/
  139. struct GpuProgramImportData
  140. {
  141. WString filename;
  142. String entryPoint;
  143. GpuProgramType type;
  144. GpuProgramProfile profile;
  145. String language;
  146. WString folder;
  147. };
  148. const WString BuiltinEditorResources::ShaderDockOverlayVSFile = L"dockDropOverlayVS.gpuprog";
  149. const WString BuiltinEditorResources::ShaderDockOverlayPSFile = L"dockDropOverlayPS.gpuprog";
  150. const WString BuiltinEditorResources::SceneGridVSFile = L"sceneGridVS.gpuprog";
  151. const WString BuiltinEditorResources::SceneGridPSFile = L"sceneGridPS.gpuprog";
  152. const WString BuiltinEditorResources::PickingVSFile = L"pickingVS.gpuprog";
  153. const WString BuiltinEditorResources::PickingPSFile = L"pickingPS.gpuprog";
  154. const WString BuiltinEditorResources::PickingAlphaVSFile = L"pickingAlphaVS.gpuprog";
  155. const WString BuiltinEditorResources::PickingAlphaPSFile = L"pickingAlphaPS.gpuprog";
  156. const WString BuiltinEditorResources::ShaderWireGizmoVSFile = L"wireGizmoVS.gpuprog";
  157. const WString BuiltinEditorResources::ShaderWireGizmoPSFile = L"wireGizmoPS.gpuprog";
  158. const WString BuiltinEditorResources::ShaderSolidGizmoVSFile = L"solidGizmoVS.gpuprog";
  159. const WString BuiltinEditorResources::ShaderSolidGizmoPSFile = L"solidGizmoPS.gpuprog";
  160. const WString BuiltinEditorResources::ShaderIconGizmo0VSFile = L"iconGizmo0VS.gpuprog";
  161. const WString BuiltinEditorResources::ShaderIconGizmo0PSFile = L"iconGizmo0PS.gpuprog";
  162. const WString BuiltinEditorResources::ShaderIconGizmo1VSFile = L"iconGizmo1VS.gpuprog";
  163. const WString BuiltinEditorResources::ShaderIconGizmo1PSFile = L"iconGizmo1PS.gpuprog";
  164. const WString BuiltinEditorResources::GizmoPickingVSFile = L"pickingGizmoVS.gpuprog";
  165. const WString BuiltinEditorResources::GizmoPickingPSFile = L"pickingGizmoPS.gpuprog";
  166. const WString BuiltinEditorResources::GizmoPickingAlphaVSFile = L"pickingGizmoAlphaVS.gpuprog";
  167. const WString BuiltinEditorResources::GizmoPickingAlphaPSFile = L"pickingGizmoAlphaPS.gpuprog";
  168. BuiltinEditorResources::BuiltinEditorResources(RenderSystemPlugin activeRSPlugin)
  169. :mRenderSystemPlugin(activeRSPlugin)
  170. {
  171. switch (activeRSPlugin)
  172. {
  173. case RenderSystemPlugin::DX11:
  174. mActiveShaderSubFolder = HLSL11ShaderSubFolder;
  175. mActiveRenderSystem = RenderAPIDX11;
  176. break;
  177. case RenderSystemPlugin::DX9:
  178. mActiveShaderSubFolder = HLSL9ShaderSubFolder;
  179. mActiveRenderSystem = RenderAPIDX9;
  180. break;
  181. case RenderSystemPlugin::OpenGL:
  182. mActiveShaderSubFolder = GLSLShaderSubFolder;
  183. mActiveRenderSystem = RenderAPIOpenGL;
  184. break;
  185. }
  186. preprocess();
  187. initDockDropOverlayShader();
  188. initSceneGridShader();
  189. initPickingShader(CULL_NONE);
  190. initPickingShader(CULL_CLOCKWISE);
  191. initPickingShader(CULL_COUNTERCLOCKWISE);
  192. initPickingAlphaShader(CULL_NONE);
  193. initPickingAlphaShader(CULL_CLOCKWISE);
  194. initPickingAlphaShader(CULL_COUNTERCLOCKWISE);
  195. initWireGizmoShader();
  196. initSolidGizmoShader();
  197. initIconGizmoShader();
  198. initGizmoPickingShader();
  199. initGizmoPickingAlphaShader();
  200. initWireHandleShader();
  201. initSolidHandleShader();
  202. Path fontPath = FileSystem::getWorkingDirectoryPath();
  203. fontPath.append(DefaultSkinFolder);
  204. fontPath.append(DefaultFontFilename + L".asset");
  205. HFont font = Resources::instance().load<Font>(fontPath);
  206. // Label
  207. GUIElementStyle labelStyle;
  208. labelStyle.font = font;
  209. labelStyle.fontSize = DefaultFontSize;
  210. labelStyle.fixedWidth = false;
  211. labelStyle.fixedHeight = true;
  212. labelStyle.height = 11;
  213. labelStyle.minWidth = 10;
  214. mSkin.setStyle(GUILabel::getGUITypeName(), labelStyle);
  215. // Window frame
  216. GUIElementStyle windowFrameStyle;
  217. windowFrameStyle.normal.texture = getGUITexture(WindowFrameNormal);
  218. windowFrameStyle.focused.texture = getGUITexture(WindowFrameFocused);
  219. windowFrameStyle.border.left = 1;
  220. windowFrameStyle.border.right = 1;
  221. windowFrameStyle.border.top = 1;
  222. windowFrameStyle.border.bottom = 1;
  223. mSkin.setStyle("WindowFrame", windowFrameStyle);
  224. // Button
  225. GUIElementStyle buttonStyle;
  226. buttonStyle.normal.texture = getGUITexture(ButtonNormalTex);
  227. buttonStyle.hover.texture = getGUITexture(ButtonHoverTex);
  228. buttonStyle.active.texture = getGUITexture(ButtonActiveTex);
  229. buttonStyle.normalOn.texture = getGUITexture(ButtonActiveTex);
  230. buttonStyle.hoverOn.texture = getGUITexture(ButtonActiveTex);
  231. buttonStyle.activeOn.texture = getGUITexture(ButtonActiveTex);
  232. buttonStyle.border.left = 6;
  233. buttonStyle.border.right = 6;
  234. buttonStyle.border.top = 6;
  235. buttonStyle.border.bottom = 6;
  236. buttonStyle.contentOffset.left = 3;
  237. buttonStyle.contentOffset.right = 3;
  238. buttonStyle.fixedHeight = true;
  239. buttonStyle.height = 15;
  240. buttonStyle.minWidth = 50;
  241. buttonStyle.font = font;
  242. buttonStyle.fontSize = DefaultFontSize;
  243. buttonStyle.textHorzAlign = THA_Center;
  244. buttonStyle.textVertAlign = TVA_Center;
  245. mSkin.setStyle(GUIButton::getGUITypeName(), buttonStyle);
  246. // Toggle
  247. GUIElementStyle toggleStyle;
  248. toggleStyle.normal.texture = getGUITexture(ToggleNormalTex);
  249. toggleStyle.hover.texture = getGUITexture(ToggleHoverTex);
  250. toggleStyle.active.texture = getGUITexture(ToggleActiveTex);
  251. toggleStyle.normalOn.texture = getGUITexture(ToggleNormalOnTex);
  252. toggleStyle.hoverOn.texture = getGUITexture(ToggleHoverOnTex);
  253. toggleStyle.activeOn.texture = getGUITexture(ToggleActiveOnTex);
  254. toggleStyle.fixedHeight = true;
  255. toggleStyle.fixedWidth = true;
  256. toggleStyle.height = 15;
  257. toggleStyle.width = 15;
  258. mSkin.setStyle(GUIToggle::getGUITypeName(), toggleStyle);
  259. // Color
  260. GUIElementStyle colorStyle;
  261. colorStyle.margins.left = 2;
  262. colorStyle.margins.right = 2;
  263. colorStyle.margins.top = 2;
  264. colorStyle.margins.bottom = 2;
  265. colorStyle.fixedHeight = true;
  266. colorStyle.height = 10;
  267. colorStyle.minWidth = 10;
  268. mSkin.setStyle(GUIColor::getGUITypeName(), colorStyle);
  269. // Window background texture
  270. GUIElementStyle windowBgStyle;
  271. windowBgStyle.normal.texture = getGUITexture(WindowBackgroundTexture);
  272. mSkin.setStyle("WindowBackground", windowBgStyle);
  273. // Window title bar background
  274. GUIElementStyle titleBarBgStyle;
  275. titleBarBgStyle.normal.texture = getGUITexture(WindowTitleBarBg);
  276. titleBarBgStyle.fixedHeight = true;
  277. titleBarBgStyle.height = 13;
  278. mSkin.setStyle("TitleBarBackground", titleBarBgStyle);
  279. // Tabbed title bar tab button
  280. GUIElementStyle tabbedBarButton;
  281. tabbedBarButton.normal.texture = getGUITexture(TabbedBarBtnNormal);
  282. tabbedBarButton.hover.texture = getGUITexture(TabbedBarBtnActive);
  283. tabbedBarButton.active.texture = tabbedBarButton.hover.texture;
  284. tabbedBarButton.normalOn.texture = tabbedBarButton.hover.texture;
  285. tabbedBarButton.hoverOn.texture = tabbedBarButton.hover.texture;
  286. tabbedBarButton.activeOn.texture = tabbedBarButton.hover.texture;
  287. tabbedBarButton.fixedHeight = true;
  288. tabbedBarButton.height = 13;
  289. tabbedBarButton.minWidth = 10;
  290. tabbedBarButton.maxWidth = 110;
  291. tabbedBarButton.font = font;
  292. tabbedBarButton.fontSize = DefaultFontSize;
  293. tabbedBarButton.textHorzAlign = THA_Center;
  294. tabbedBarButton.textVertAlign = TVA_Center;
  295. mSkin.setStyle("TabbedBarBtn", tabbedBarButton);
  296. // Tabbed title bar drag/drop button
  297. GUIElementStyle tabbedBarDropButton;
  298. tabbedBarDropButton.fixedHeight = true;
  299. tabbedBarDropButton.fixedWidth = true;
  300. tabbedBarDropButton.height = 13;
  301. tabbedBarDropButton.width = 6;
  302. mSkin.setStyle("TabbedBarDropArea", tabbedBarDropButton);
  303. // Window minimize button
  304. GUIElementStyle winMinButtonStyle;
  305. winMinButtonStyle.normal.texture = getGUITexture(WindowMinButtonNormal);
  306. winMinButtonStyle.hover.texture = getGUITexture(WindowMinButtonHover);
  307. winMinButtonStyle.active.texture = winMinButtonStyle.hover.texture;
  308. winMinButtonStyle.fixedHeight = true;
  309. winMinButtonStyle.fixedWidth = true;
  310. winMinButtonStyle.height = 7;
  311. winMinButtonStyle.width = 8;
  312. mSkin.setStyle("WinMinimizeBtn", winMinButtonStyle);
  313. // Window maximize button
  314. GUIElementStyle winMaxButtonStyle;
  315. winMaxButtonStyle.normal.texture = getGUITexture(WindowMaxButtonNormal);
  316. winMaxButtonStyle.hover.texture = getGUITexture(WindowMaxButtonHover);
  317. winMaxButtonStyle.active.texture = winMaxButtonStyle.hover.texture;
  318. winMaxButtonStyle.fixedHeight = true;
  319. winMaxButtonStyle.fixedWidth = true;
  320. winMaxButtonStyle.height = 8;
  321. winMaxButtonStyle.width = 8;
  322. mSkin.setStyle("WinMaximizeBtn", winMaxButtonStyle);
  323. // Window close button
  324. GUIElementStyle winCloseButtonStyle;
  325. winCloseButtonStyle.normal.texture = getGUITexture(WindowCloseButtonNormal);
  326. winCloseButtonStyle.hover.texture = getGUITexture(WindowCloseButtonHover);
  327. winCloseButtonStyle.active.texture = winCloseButtonStyle.hover.texture;
  328. winCloseButtonStyle.fixedHeight = true;
  329. winCloseButtonStyle.fixedWidth = true;
  330. winCloseButtonStyle.height = 7;
  331. winCloseButtonStyle.width = 8;
  332. mSkin.setStyle("WinCloseBtn", winCloseButtonStyle);
  333. // Input box
  334. GUIElementStyle inputBoxStyle;
  335. inputBoxStyle.normal.texture = getGUITexture(InputBoxNormalTex);
  336. inputBoxStyle.hover.texture = getGUITexture(InputBoxHoverTex);
  337. inputBoxStyle.focused.texture = getGUITexture(InputBoxFocusedTex);
  338. inputBoxStyle.active.texture = inputBoxStyle.normal.texture;
  339. inputBoxStyle.border.left = 1;
  340. inputBoxStyle.border.right = 1;
  341. inputBoxStyle.border.top = 1;
  342. inputBoxStyle.border.bottom = 1;
  343. inputBoxStyle.contentOffset.left = 3;
  344. inputBoxStyle.contentOffset.right = 3;
  345. inputBoxStyle.contentOffset.top = 2;
  346. inputBoxStyle.contentOffset.bottom = 2;
  347. inputBoxStyle.fixedHeight = true;
  348. inputBoxStyle.height = 15;
  349. inputBoxStyle.minWidth = 10;
  350. inputBoxStyle.font = font;
  351. inputBoxStyle.fontSize = DefaultFontSize;
  352. inputBoxStyle.textHorzAlign = THA_Left;
  353. inputBoxStyle.textVertAlign = TVA_Top;
  354. mSkin.setStyle(GUIInputBox::getGUITypeName(), inputBoxStyle);
  355. /************************************************************************/
  356. /* SCROLL BAR */
  357. /************************************************************************/
  358. // Up button
  359. GUIElementStyle scrollUpBtnStyle;
  360. scrollUpBtnStyle.normal.texture = getGUITexture(ScrollBarUpNormalTex);
  361. scrollUpBtnStyle.hover.texture = getGUITexture(ScrollBarUpHoverTex);
  362. scrollUpBtnStyle.active.texture = getGUITexture(ScrollBarUpActiveTex);
  363. scrollUpBtnStyle.fixedHeight = true;
  364. scrollUpBtnStyle.fixedWidth = true;
  365. scrollUpBtnStyle.height = 4;
  366. scrollUpBtnStyle.width = 8;
  367. mSkin.setStyle("ScrollUpBtn", scrollUpBtnStyle);
  368. // Down button
  369. GUIElementStyle scrollDownBtnStyle;
  370. scrollDownBtnStyle.normal.texture = getGUITexture(ScrollBarDownNormalTex);
  371. scrollDownBtnStyle.hover.texture = getGUITexture(ScrollBarDownHoverTex);
  372. scrollDownBtnStyle.active.texture = getGUITexture(ScrollBarDownActiveTex);
  373. scrollDownBtnStyle.fixedHeight = true;
  374. scrollDownBtnStyle.fixedWidth = true;
  375. scrollDownBtnStyle.height = 4;
  376. scrollDownBtnStyle.width = 8;
  377. mSkin.setStyle("ScrollDownBtn", scrollDownBtnStyle);
  378. // Left button
  379. GUIElementStyle scrollLeftBtnStyle;
  380. scrollLeftBtnStyle.normal.texture = getGUITexture(ScrollBarLeftNormalTex);
  381. scrollLeftBtnStyle.hover.texture = getGUITexture(ScrollBarLeftHoverTex);
  382. scrollLeftBtnStyle.active.texture = getGUITexture(ScrollBarLeftActiveTex);
  383. scrollLeftBtnStyle.fixedHeight = true;
  384. scrollLeftBtnStyle.fixedWidth = true;
  385. scrollLeftBtnStyle.height = 8;
  386. scrollLeftBtnStyle.width = 4;
  387. mSkin.setStyle("ScrollLeftBtn", scrollLeftBtnStyle);
  388. // Right button
  389. GUIElementStyle scrollRightBtnStyle;
  390. scrollRightBtnStyle.normal.texture = getGUITexture(ScrollBarRightNormalTex);
  391. scrollRightBtnStyle.hover.texture = getGUITexture(ScrollBarRightHoverTex);
  392. scrollRightBtnStyle.active.texture = getGUITexture(ScrollBarRightActiveTex);
  393. scrollRightBtnStyle.fixedHeight = true;
  394. scrollRightBtnStyle.fixedWidth = true;
  395. scrollRightBtnStyle.height = 8;
  396. scrollRightBtnStyle.width = 4;
  397. mSkin.setStyle("ScrollRightBtn", scrollRightBtnStyle);
  398. // Horizontal handle
  399. GUIElementStyle scrollBarHorzBtnStyle;
  400. scrollBarHorzBtnStyle.normal.texture = getGUITexture(ScrollBarHandleHorzNormalTex);
  401. scrollBarHorzBtnStyle.hover.texture = getGUITexture(ScrollBarHandleHorzHoverTex);
  402. scrollBarHorzBtnStyle.active.texture = getGUITexture(ScrollBarHandleHorzActiveTex);
  403. scrollBarHorzBtnStyle.fixedHeight = true;
  404. scrollBarHorzBtnStyle.fixedWidth = true;
  405. scrollBarHorzBtnStyle.height = 6;
  406. scrollBarHorzBtnStyle.width = 4;
  407. mSkin.setStyle("ScrollBarHorzBtn", scrollBarHorzBtnStyle);
  408. // Vertical handle
  409. GUIElementStyle scrollBarVertBtnStyle;
  410. scrollBarVertBtnStyle.normal.texture = getGUITexture(ScrollBarHandleVertNormalTex);
  411. scrollBarVertBtnStyle.hover.texture = getGUITexture(ScrollBarHandleVertHoverTex);
  412. scrollBarVertBtnStyle.active.texture = getGUITexture(ScrollBarHandleVertActiveTex);
  413. scrollBarVertBtnStyle.fixedHeight = true;
  414. scrollBarVertBtnStyle.fixedWidth = true;
  415. scrollBarVertBtnStyle.height = 4;
  416. scrollBarVertBtnStyle.width = 6;
  417. mSkin.setStyle("ScrollBarVertBtn", scrollBarVertBtnStyle);
  418. HSpriteTexture scrollBarBgPtr = getGUITexture(ScrollBarBgTex);
  419. // Vertical scroll bar
  420. GUIElementStyle vertScrollBarStyle;
  421. vertScrollBarStyle.normal.texture = scrollBarBgPtr;
  422. vertScrollBarStyle.hover.texture = scrollBarBgPtr;
  423. vertScrollBarStyle.active.texture = scrollBarBgPtr;
  424. vertScrollBarStyle.fixedHeight = false;
  425. vertScrollBarStyle.fixedWidth = true;
  426. vertScrollBarStyle.minHeight = 16;
  427. vertScrollBarStyle.width = 8;
  428. mSkin.setStyle("ScrollBarVert", vertScrollBarStyle);
  429. // Horizontal scroll bar
  430. GUIElementStyle horzScrollBarStyle;
  431. horzScrollBarStyle.normal.texture = scrollBarBgPtr;
  432. horzScrollBarStyle.hover.texture = scrollBarBgPtr;
  433. horzScrollBarStyle.active.texture = scrollBarBgPtr;
  434. horzScrollBarStyle.fixedHeight = true;
  435. horzScrollBarStyle.fixedWidth = false;
  436. horzScrollBarStyle.minWidth = 16;
  437. horzScrollBarStyle.height = 8;
  438. mSkin.setStyle("ScrollBarHorz", horzScrollBarStyle);
  439. /************************************************************************/
  440. /* DROP DOWN BOX */
  441. /************************************************************************/
  442. // ListBox button
  443. GUIElementStyle dropDownListStyle;
  444. dropDownListStyle.normal.texture = getGUITexture(DropDownBtnNormalTex);
  445. dropDownListStyle.hover.texture = getGUITexture(DropDownBtnHoverTex);
  446. dropDownListStyle.active.texture = dropDownListStyle.hover.texture;
  447. dropDownListStyle.normalOn.texture = dropDownListStyle.hover.texture;
  448. dropDownListStyle.hoverOn.texture = dropDownListStyle.hover.texture;
  449. dropDownListStyle.activeOn.texture = dropDownListStyle.hover.texture;
  450. dropDownListStyle.fixedHeight = true;
  451. dropDownListStyle.fixedWidth = false;
  452. dropDownListStyle.height = 13;
  453. dropDownListStyle.width = 30;
  454. dropDownListStyle.contentOffset.left = 3;
  455. dropDownListStyle.contentOffset.right = 11;
  456. dropDownListStyle.contentOffset.top = 1;
  457. dropDownListStyle.contentOffset.bottom = 1;
  458. dropDownListStyle.border.left = 1;
  459. dropDownListStyle.border.right = 10;
  460. dropDownListStyle.border.top = 1;
  461. dropDownListStyle.border.bottom = 1;
  462. dropDownListStyle.font = font;
  463. dropDownListStyle.fontSize = DefaultFontSize;
  464. dropDownListStyle.textHorzAlign = THA_Left;
  465. dropDownListStyle.textVertAlign = TVA_Top;
  466. mSkin.setStyle("ListBox", dropDownListStyle);
  467. // DropDown scroll up button arrow
  468. HSpriteTexture dropDownBtnScrollUpArrow = getGUITexture(DropDownBoxBtnUpArrowTex);
  469. GUIElementStyle dropDownScrollUpBtnArrowStyle;
  470. dropDownScrollUpBtnArrowStyle.normal.texture = getGUITexture(DropDownBoxBtnUpArrowTex);
  471. dropDownScrollUpBtnArrowStyle.hover.texture = dropDownScrollUpBtnArrowStyle.normal.texture;
  472. dropDownScrollUpBtnArrowStyle.active.texture = dropDownScrollUpBtnArrowStyle.hover.texture;
  473. dropDownScrollUpBtnArrowStyle.fixedHeight = true;
  474. dropDownScrollUpBtnArrowStyle.fixedWidth = false;
  475. dropDownScrollUpBtnArrowStyle.height = 7;
  476. dropDownScrollUpBtnArrowStyle.width = 30;
  477. dropDownScrollUpBtnArrowStyle.border.left = 1;
  478. dropDownScrollUpBtnArrowStyle.border.right = 1;
  479. dropDownScrollUpBtnArrowStyle.border.top = 1;
  480. dropDownScrollUpBtnArrowStyle.border.bottom = 1;
  481. mSkin.setStyle("ListBoxScrollUpBtnArrow", dropDownScrollUpBtnArrowStyle);
  482. mSkin.setStyle("MenuBarScrollUpBtnArrow", dropDownScrollUpBtnArrowStyle);
  483. mSkin.setStyle("ContextMenuScrollUpBtnArrow", dropDownScrollUpBtnArrowStyle);
  484. // DropDown scroll up button
  485. GUIElementStyle dropDownScrollUpBtnStyle;
  486. dropDownScrollUpBtnStyle.normal.texture = getGUITexture(DropDownBoxBtnUpNormalTex);
  487. dropDownScrollUpBtnStyle.hover.texture = getGUITexture(DropDownBoxBtnUpHoverTex);
  488. dropDownScrollUpBtnStyle.active.texture = dropDownScrollUpBtnStyle.hover.texture;
  489. dropDownScrollUpBtnStyle.fixedHeight = true;
  490. dropDownScrollUpBtnStyle.fixedWidth = false;
  491. dropDownScrollUpBtnStyle.height = 7;
  492. dropDownScrollUpBtnStyle.width = 30;
  493. dropDownScrollUpBtnStyle.border.left = 1;
  494. dropDownScrollUpBtnStyle.border.right = 1;
  495. dropDownScrollUpBtnStyle.border.top = 1;
  496. dropDownScrollUpBtnStyle.border.bottom = 1;
  497. mSkin.setStyle("ListBoxScrollUpBtn", dropDownScrollUpBtnStyle);
  498. mSkin.setStyle("MenuBarScrollUpBtn", dropDownScrollUpBtnStyle);
  499. mSkin.setStyle("ContextMenuScrollUpBtn", dropDownScrollUpBtnStyle);
  500. // DropDown scroll down button arrow
  501. GUIElementStyle dropDownScrollDownBtnArrowStyle;
  502. dropDownScrollDownBtnArrowStyle.normal.texture = getGUITexture(DropDownBoxBtnDownArrowTex);
  503. dropDownScrollDownBtnArrowStyle.hover.texture = dropDownScrollDownBtnArrowStyle.normal.texture;
  504. dropDownScrollDownBtnArrowStyle.active.texture = dropDownScrollDownBtnArrowStyle.hover.texture;
  505. dropDownScrollDownBtnArrowStyle.fixedHeight = true;
  506. dropDownScrollDownBtnArrowStyle.fixedWidth = false;
  507. dropDownScrollDownBtnArrowStyle.height = 7;
  508. dropDownScrollDownBtnArrowStyle.width = 30;
  509. dropDownScrollDownBtnArrowStyle.border.left = 1;
  510. dropDownScrollDownBtnArrowStyle.border.right = 1;
  511. dropDownScrollDownBtnArrowStyle.border.top = 1;
  512. dropDownScrollDownBtnArrowStyle.border.bottom = 1;
  513. mSkin.setStyle("ListBoxScrollDownBtnArrow", dropDownScrollDownBtnArrowStyle);
  514. mSkin.setStyle("MenuBarScrollDownBtnArrow", dropDownScrollDownBtnArrowStyle);
  515. mSkin.setStyle("ContextMenuScrollDownBtnArrow", dropDownScrollDownBtnArrowStyle);
  516. // DropDown scroll down button
  517. GUIElementStyle dropDownScrollDownBtnStyle;
  518. dropDownScrollDownBtnStyle.normal.texture = getGUITexture(DropDownBoxBtnDownNormalTex);
  519. dropDownScrollDownBtnStyle.hover.texture = getGUITexture(DropDownBoxBtnDownHoverTex);
  520. dropDownScrollDownBtnStyle.active.texture = dropDownScrollDownBtnStyle.hover.texture;
  521. dropDownScrollDownBtnStyle.fixedHeight = true;
  522. dropDownScrollDownBtnStyle.fixedWidth = false;
  523. dropDownScrollDownBtnStyle.height = 7;
  524. dropDownScrollDownBtnStyle.width = 30;
  525. dropDownScrollDownBtnStyle.border.left = 1;
  526. dropDownScrollDownBtnStyle.border.right = 1;
  527. dropDownScrollDownBtnStyle.border.top = 1;
  528. dropDownScrollDownBtnStyle.border.bottom = 1;
  529. mSkin.setStyle("ListBoxScrollDownBtn", dropDownScrollDownBtnStyle);
  530. mSkin.setStyle("MenuBarScrollDownBtn", dropDownScrollDownBtnStyle);
  531. mSkin.setStyle("ContextMenuScrollDownBtn", dropDownScrollDownBtnStyle);
  532. // DropDown entry button
  533. GUIElementStyle dropDownEntryBtnStyle;
  534. dropDownEntryBtnStyle.normal.texture = getGUITexture(DropDownBoxEntryNormalTex);
  535. dropDownEntryBtnStyle.hover.texture = getGUITexture(DropDownBoxEntryHoverTex);
  536. dropDownEntryBtnStyle.active.texture = dropDownEntryBtnStyle.hover.texture;
  537. dropDownEntryBtnStyle.fixedHeight = true;
  538. dropDownEntryBtnStyle.fixedWidth = false;
  539. dropDownEntryBtnStyle.height = 14;
  540. dropDownEntryBtnStyle.width = 30;
  541. dropDownEntryBtnStyle.border.left = 1;
  542. dropDownEntryBtnStyle.border.right = 1;
  543. dropDownEntryBtnStyle.border.top = 1;
  544. dropDownEntryBtnStyle.border.bottom = 1;
  545. dropDownEntryBtnStyle.font = font;
  546. dropDownEntryBtnStyle.fontSize = DefaultFontSize;
  547. dropDownEntryBtnStyle.textHorzAlign = THA_Left;
  548. dropDownEntryBtnStyle.textVertAlign = TVA_Top;
  549. mSkin.setStyle("ListBoxEntryBtn", dropDownEntryBtnStyle);
  550. mSkin.setStyle("MenuBarEntryBtn", dropDownEntryBtnStyle);
  551. mSkin.setStyle("ContextMenuEntryBtn", dropDownEntryBtnStyle);
  552. // DropDown entry button with expand
  553. GUIElementStyle dropDownEntryExpBtnStyle;
  554. dropDownEntryExpBtnStyle.normal.texture = getGUITexture(DropDownBoxEntryExpNormalTex);
  555. dropDownEntryExpBtnStyle.hover.texture = getGUITexture(DropDownBoxEntryExpHoverTex);
  556. dropDownEntryExpBtnStyle.active.texture = dropDownEntryExpBtnStyle.hover.texture;
  557. dropDownEntryExpBtnStyle.fixedHeight = true;
  558. dropDownEntryExpBtnStyle.fixedWidth = false;
  559. dropDownEntryExpBtnStyle.height = 14;
  560. dropDownEntryExpBtnStyle.width = 30;
  561. dropDownEntryExpBtnStyle.border.left = 1;
  562. dropDownEntryExpBtnStyle.border.right = 6;
  563. dropDownEntryExpBtnStyle.border.top = 1;
  564. dropDownEntryExpBtnStyle.border.bottom = 1;
  565. dropDownEntryExpBtnStyle.font = font;
  566. dropDownEntryExpBtnStyle.fontSize = DefaultFontSize;
  567. dropDownEntryExpBtnStyle.textHorzAlign = THA_Left;
  568. dropDownEntryExpBtnStyle.textVertAlign = TVA_Top;
  569. mSkin.setStyle("ListBoxEntryExpBtn", dropDownEntryExpBtnStyle);
  570. mSkin.setStyle("MenuBarEntryExpBtn", dropDownEntryExpBtnStyle);
  571. mSkin.setStyle("ContextMenuEntryExpBtn", dropDownEntryExpBtnStyle);
  572. // DropDown box frame
  573. GUIElementStyle dropDownBoxStyle;
  574. dropDownBoxStyle.normal.texture = getGUITexture(DropDownBoxBgTex);
  575. dropDownBoxStyle.hover.texture = dropDownEntryBtnStyle.normal.texture;
  576. dropDownBoxStyle.active.texture = dropDownEntryBtnStyle.hover.texture;
  577. dropDownBoxStyle.fixedHeight = false;
  578. dropDownBoxStyle.fixedWidth = false;
  579. dropDownBoxStyle.border.left = 1;
  580. dropDownBoxStyle.border.right = 1;
  581. dropDownBoxStyle.border.top = 1;
  582. dropDownBoxStyle.border.bottom = 1;
  583. dropDownBoxStyle.margins.left = 1;
  584. dropDownBoxStyle.margins.right = 1;
  585. dropDownBoxStyle.margins.top = 1;
  586. dropDownBoxStyle.margins.bottom = 1;
  587. mSkin.setStyle("ListBoxFrame", dropDownBoxStyle);
  588. mSkin.setStyle("MenuBarFrame", dropDownBoxStyle);
  589. mSkin.setStyle("ContextMenuFrame", dropDownBoxStyle);
  590. // Drop down separator
  591. GUIElementStyle dropDownSeparatorStyle;
  592. dropDownSeparatorStyle.normal.texture = getGUITexture(DropDownSeparatorTex);
  593. dropDownSeparatorStyle.fixedHeight = true;
  594. dropDownSeparatorStyle.fixedWidth = false;
  595. dropDownSeparatorStyle.height = 3;
  596. dropDownSeparatorStyle.width = 30;
  597. dropDownSeparatorStyle.border.left = 1;
  598. dropDownSeparatorStyle.border.right = 1;
  599. dropDownSeparatorStyle.border.top = 1;
  600. dropDownSeparatorStyle.border.bottom = 1;
  601. mSkin.setStyle("ListBoxSeparator", dropDownSeparatorStyle);
  602. mSkin.setStyle("MenuBarSeparator", dropDownSeparatorStyle);
  603. mSkin.setStyle("ContextMenuSeparator", dropDownSeparatorStyle);
  604. /************************************************************************/
  605. /* MENU BAR */
  606. /************************************************************************/
  607. // MenuBar background
  608. GUIElementStyle menuBarBgStyle;
  609. menuBarBgStyle.normal.texture = getGUITexture(MenuBarBgTex);
  610. menuBarBgStyle.fixedHeight = false;
  611. menuBarBgStyle.fixedWidth = false;
  612. menuBarBgStyle.height = 4;
  613. menuBarBgStyle.width = 4;
  614. mSkin.setStyle("MenuBarBg", menuBarBgStyle);
  615. // MenuBar Banshee logo
  616. GUIElementStyle menuBarBansheeLogoStyle;
  617. menuBarBansheeLogoStyle.normal.texture = getGUITexture(MenuBarBansheeLogoTex);
  618. menuBarBansheeLogoStyle.fixedHeight = true;
  619. menuBarBansheeLogoStyle.fixedWidth = true;
  620. menuBarBansheeLogoStyle.height = 7;
  621. menuBarBansheeLogoStyle.width = 51;
  622. mSkin.setStyle("MenuBarBansheeLogo", menuBarBansheeLogoStyle);
  623. // MenuBar button
  624. GUIElementStyle menuBarBtnStyle;
  625. menuBarBtnStyle.normal.texture = getGUITexture(MenuBarBtnNormalTex);
  626. menuBarBtnStyle.hover.texture = getGUITexture(MenuBarBtnHoverTex);
  627. menuBarBtnStyle.active.texture = menuBarBtnStyle.hover.texture;
  628. menuBarBtnStyle.normalOn.texture = menuBarBtnStyle.hover.texture;
  629. menuBarBtnStyle.hoverOn.texture = menuBarBtnStyle.hover.texture;
  630. menuBarBtnStyle.activeOn.texture = menuBarBtnStyle.hover.texture;
  631. menuBarBtnStyle.fixedHeight = true;
  632. menuBarBtnStyle.fixedWidth = false;
  633. menuBarBtnStyle.height = 15;
  634. menuBarBtnStyle.width = 4;
  635. menuBarBtnStyle.margins.left = 2;
  636. menuBarBtnStyle.margins.right = 2;
  637. menuBarBtnStyle.margins.top = 2;
  638. menuBarBtnStyle.margins.bottom = 2;
  639. menuBarBtnStyle.font = font;
  640. menuBarBtnStyle.fontSize = DefaultFontSize;
  641. menuBarBtnStyle.textHorzAlign = THA_Left;
  642. menuBarBtnStyle.textVertAlign = TVA_Top;
  643. mSkin.setStyle("MenuBarBtn", menuBarBtnStyle);
  644. /************************************************************************/
  645. /* DOCK SLIDER */
  646. /************************************************************************/
  647. GUIElementStyle dockSliderBtnStyle;
  648. dockSliderBtnStyle.normal.texture = getGUITexture(DockSliderNormalTex);
  649. dockSliderBtnStyle.fixedHeight = false;
  650. dockSliderBtnStyle.fixedWidth = false;
  651. dockSliderBtnStyle.height = 2;
  652. dockSliderBtnStyle.width = 2;
  653. mSkin.setStyle("DockSliderBtn", dockSliderBtnStyle);
  654. /************************************************************************/
  655. /* TREE VIEW */
  656. /************************************************************************/
  657. // Expand button
  658. GUIElementStyle treeViewExpandButtonStyle;
  659. treeViewExpandButtonStyle.normal.texture = getGUITexture(TreeViewExpandButtonOffNormal);
  660. treeViewExpandButtonStyle.hover.texture = getGUITexture(TreeViewExpandButtonOffHover);
  661. treeViewExpandButtonStyle.active.texture = treeViewExpandButtonStyle.hover.texture;
  662. treeViewExpandButtonStyle.normalOn.texture = getGUITexture(TreeViewExpandButtonOnNormal);
  663. treeViewExpandButtonStyle.hoverOn.texture = getGUITexture(TreeViewExpandButtonOnHover);
  664. treeViewExpandButtonStyle.activeOn.texture = treeViewExpandButtonStyle.hoverOn.texture;
  665. treeViewExpandButtonStyle.margins.left = 4;
  666. treeViewExpandButtonStyle.margins.right = 4;
  667. treeViewExpandButtonStyle.margins.top = 5;
  668. treeViewExpandButtonStyle.margins.bottom = 4;
  669. treeViewExpandButtonStyle.fixedHeight = true;
  670. treeViewExpandButtonStyle.fixedWidth = true;
  671. treeViewExpandButtonStyle.height = 16;
  672. treeViewExpandButtonStyle.width = 16;
  673. mSkin.setStyle("TreeViewFoldoutBtn", treeViewExpandButtonStyle);
  674. // Entry
  675. GUIElementStyle treeViewEntryStyle;
  676. treeViewEntryStyle.font = font;
  677. treeViewEntryStyle.fontSize = DefaultFontSize;
  678. treeViewEntryStyle.fixedWidth = false;
  679. treeViewEntryStyle.fixedHeight = true;
  680. treeViewEntryStyle.height = 16;
  681. treeViewEntryStyle.minWidth = 10;
  682. mSkin.setStyle("TreeViewElementBtn", treeViewEntryStyle);
  683. // Selection background
  684. GUIElementStyle treeViewSelBackgroundStyle;
  685. treeViewSelBackgroundStyle.normal.texture = getGUITexture(TreeViewSelectionBackground);
  686. treeViewSelBackgroundStyle.fixedHeight = false;
  687. treeViewSelBackgroundStyle.fixedWidth = false;
  688. treeViewSelBackgroundStyle.height = 2;
  689. treeViewSelBackgroundStyle.width = 2;
  690. mSkin.setStyle("TreeViewSelectionBackground", treeViewSelBackgroundStyle);
  691. // Edit box
  692. GUIElementStyle treeViewEditBox;
  693. treeViewEditBox.normal.texture = getGUITexture(TreeViewEditBox);
  694. treeViewEditBox.hover.texture = treeViewEditBox.normal.texture;
  695. treeViewEditBox.focused.texture = treeViewEditBox.normal.texture;
  696. treeViewEditBox.active.texture = treeViewEditBox.normal.texture;
  697. treeViewEditBox.border.left = 1;
  698. treeViewEditBox.border.right = 1;
  699. treeViewEditBox.border.top = 1;
  700. treeViewEditBox.border.bottom = 1;
  701. treeViewEditBox.margins.left = 1;
  702. treeViewEditBox.margins.right = 1;
  703. treeViewEditBox.margins.top = 1;
  704. treeViewEditBox.margins.bottom = 1;
  705. treeViewEditBox.fixedHeight = true;
  706. treeViewEditBox.height = 13;
  707. treeViewEditBox.minWidth = 10;
  708. treeViewEditBox.font = font;
  709. treeViewEditBox.fontSize = DefaultFontSize;
  710. treeViewEditBox.textHorzAlign = THA_Left;
  711. treeViewEditBox.textVertAlign = TVA_Top;
  712. mSkin.setStyle(GUITreeViewEditBox::getGUITypeName(), treeViewEditBox);
  713. // Element highlight
  714. GUIElementStyle treeViewElementHighlight;
  715. treeViewElementHighlight.normal.texture = getGUITexture(TreeViewElementHighlight);
  716. treeViewElementHighlight.border.left = 1;
  717. treeViewElementHighlight.border.right = 1;
  718. treeViewElementHighlight.border.top = 1;
  719. treeViewElementHighlight.border.bottom = 1;
  720. mSkin.setStyle("TreeViewElementHighlight", treeViewElementHighlight);
  721. // Element separator highlight
  722. GUIElementStyle treeViewElementSepHighlight;
  723. treeViewElementSepHighlight.normal.texture = getGUITexture(TreeViewElementSepHighlight);
  724. treeViewElementSepHighlight.border.left = 1;
  725. treeViewElementSepHighlight.border.right = 1;
  726. treeViewElementSepHighlight.border.top = 1;
  727. treeViewElementSepHighlight.border.bottom = 1;
  728. mSkin.setStyle("TreeViewElementSepHighlight", treeViewElementSepHighlight);
  729. /************************************************************************/
  730. /* OBJECT DROP FIELD */
  731. /************************************************************************/
  732. GUIElementStyle objectDropStyle;
  733. objectDropStyle.normal.texture = getGUITexture(ObjectDropBtnNormalTex);
  734. objectDropStyle.normalOn.texture = getGUITexture(ObjectDropBtnNormalOnTex);
  735. objectDropStyle.fixedHeight = true;
  736. objectDropStyle.height = 15;
  737. objectDropStyle.minWidth = 50;
  738. objectDropStyle.font = font;
  739. objectDropStyle.fontSize = DefaultFontSize;
  740. objectDropStyle.textHorzAlign = THA_Center;
  741. objectDropStyle.textVertAlign = TVA_Center;
  742. mSkin.setStyle(ObjectFieldDropBtnStyleName, objectDropStyle);
  743. GUIElementStyle objectClearBtnStyle;
  744. objectClearBtnStyle.normal.texture = getGUITexture(ObjectClearBtnNormalTex);
  745. objectClearBtnStyle.hover.texture = getGUITexture(ObjectClearBtnHoverTex);
  746. objectClearBtnStyle.active.texture = getGUITexture(ObjectClearBtnActiveTex);
  747. objectClearBtnStyle.fixedHeight = true;
  748. objectClearBtnStyle.fixedWidth = true;
  749. objectClearBtnStyle.height = 15;
  750. objectClearBtnStyle.width = 13;
  751. mSkin.setStyle(ObjectFieldClearBtnStyleName, objectClearBtnStyle);
  752. GUIElementStyle editorObjectFieldStyle;
  753. editorObjectFieldStyle.fixedHeight = true;
  754. editorObjectFieldStyle.height = 15;
  755. editorObjectFieldStyle.minWidth = 30;
  756. editorObjectFieldStyle.subStyles[ObjectFieldLabelStyleName] = GUITextField::getLabelStyleType();
  757. editorObjectFieldStyle.subStyles[ObjectFieldDropBtnStyleName] = ObjectFieldDropBtnStyleName;
  758. editorObjectFieldStyle.subStyles[ObjectFieldClearBtnStyleName] = ObjectFieldClearBtnStyleName;
  759. mSkin.setStyle(ObjectFieldStyleName, editorObjectFieldStyle);
  760. /************************************************************************/
  761. /* EDITOR FIELDS */
  762. /************************************************************************/
  763. GUIElementStyle editorFieldLabelStyle;
  764. editorFieldLabelStyle.font = font;
  765. editorFieldLabelStyle.fontSize = DefaultFontSize;
  766. editorFieldLabelStyle.fixedWidth = false;
  767. editorFieldLabelStyle.fixedHeight = true;
  768. editorFieldLabelStyle.height = 11;
  769. editorFieldLabelStyle.minWidth = 10;
  770. editorFieldLabelStyle.textHorzAlign = THA_Left;
  771. mSkin.setStyle(GUITextField::getLabelStyleType(), editorFieldLabelStyle);
  772. GUIElementStyle editorIntFieldStyle;
  773. editorIntFieldStyle.fixedHeight = true;
  774. editorIntFieldStyle.height = 15;
  775. editorIntFieldStyle.minWidth = 30;
  776. editorIntFieldStyle.subStyles[GUIIntField::getLabelStyleType()] = GUITextField::getLabelStyleType();
  777. editorIntFieldStyle.subStyles[GUIIntField::getInputStyleType()] = GUIInputBox::getGUITypeName();
  778. mSkin.setStyle(GUIIntField::getGUITypeName(), editorIntFieldStyle);
  779. GUIElementStyle editorFloatFieldStyle;
  780. editorFloatFieldStyle.fixedHeight = true;
  781. editorFloatFieldStyle.height = 15;
  782. editorFloatFieldStyle.minWidth = 30;
  783. editorFloatFieldStyle.subStyles[GUIFloatField::getLabelStyleType()] = GUITextField::getLabelStyleType();
  784. editorFloatFieldStyle.subStyles[GUIFloatField::getInputStyleType()] = GUIInputBox::getGUITypeName();
  785. mSkin.setStyle(GUIFloatField::getGUITypeName(), editorFloatFieldStyle);
  786. GUIElementStyle editorTextFieldStyle;
  787. editorTextFieldStyle.fixedHeight = true;
  788. editorTextFieldStyle.height = 15;
  789. editorTextFieldStyle.minWidth = 30;
  790. editorTextFieldStyle.subStyles[GUITextField::getLabelStyleType()] = GUITextField::getLabelStyleType();
  791. editorTextFieldStyle.subStyles[GUITextField::getInputStyleType()] = GUIInputBox::getGUITypeName();
  792. mSkin.setStyle(GUITextField::getGUITypeName(), editorTextFieldStyle);
  793. GUIElementStyle editorColorFieldStyle;
  794. editorColorFieldStyle.fixedHeight = true;
  795. editorColorFieldStyle.height = 15;
  796. editorColorFieldStyle.minWidth = 30;
  797. editorColorFieldStyle.subStyles[GUIColorField::getLabelStyleType()] = GUITextField::getLabelStyleType();
  798. editorColorFieldStyle.subStyles[GUIColorField::getColorInputStyleType()] = GUIColor::getGUITypeName();
  799. mSkin.setStyle(GUIColorField::getGUITypeName(), editorColorFieldStyle);
  800. GUIElementStyle editorToggleFieldStyle;
  801. editorToggleFieldStyle.fixedHeight = true;
  802. editorToggleFieldStyle.height = 15;
  803. editorToggleFieldStyle.minWidth = 30;
  804. editorToggleFieldStyle.subStyles[GUIToggleField::getLabelStyleType()] = GUITextField::getLabelStyleType();
  805. editorToggleFieldStyle.subStyles[GUIToggleField::getToggleStyleType()] = GUIToggle::getGUITypeName();
  806. mSkin.setStyle(GUIToggleField::getGUITypeName(), editorToggleFieldStyle);
  807. GUIElementStyle editorVector2FieldStyle;
  808. editorVector2FieldStyle.fixedHeight = true;
  809. editorVector2FieldStyle.height = 30;
  810. editorVector2FieldStyle.minWidth = 30;
  811. editorVector2FieldStyle.subStyles[GUIVector2Field::getLabelStyleType()] = GUITextField::getLabelStyleType();
  812. editorVector2FieldStyle.subStyles[GUIVector2Field::getFloatFieldStyleType()] = GUIFloatField::getGUITypeName();
  813. mSkin.setStyle(GUIVector2Field::getGUITypeName(), editorVector2FieldStyle);
  814. GUIElementStyle editorVector3FieldStyle;
  815. editorVector3FieldStyle.fixedHeight = true;
  816. editorVector3FieldStyle.height = 30;
  817. editorVector3FieldStyle.minWidth = 30;
  818. editorVector3FieldStyle.subStyles[GUIVector3Field::getLabelStyleType()] = GUITextField::getLabelStyleType();
  819. editorVector3FieldStyle.subStyles[GUIVector3Field::getFloatFieldStyleType()] = GUIFloatField::getGUITypeName();
  820. mSkin.setStyle(GUIVector3Field::getGUITypeName(), editorVector3FieldStyle);
  821. GUIElementStyle editorVector4FieldStyle;
  822. editorVector4FieldStyle.fixedHeight = true;
  823. editorVector4FieldStyle.height = 30;
  824. editorVector4FieldStyle.minWidth = 30;
  825. editorVector4FieldStyle.subStyles[GUIVector4Field::getLabelStyleType()] = GUITextField::getLabelStyleType();
  826. editorVector4FieldStyle.subStyles[GUIVector4Field::getFloatFieldStyleType()] = GUIFloatField::getGUITypeName();
  827. mSkin.setStyle(GUIVector4Field::getGUITypeName(), editorVector4FieldStyle);
  828. /************************************************************************/
  829. /* COMPONENT FOLDOUT */
  830. /************************************************************************/
  831. GUIElementStyle cmpFoldoutBtnStyle;
  832. cmpFoldoutBtnStyle.normal.texture = getGUITexture(CmpFoldoutClosedNormalTex);
  833. cmpFoldoutBtnStyle.hover.texture = getGUITexture(CmpFoldoutClosedHoverTex);
  834. cmpFoldoutBtnStyle.active.texture = getGUITexture(CmpFoldoutOpenActiveTex);
  835. cmpFoldoutBtnStyle.normalOn.texture = getGUITexture(CmpFoldoutOpenNormalTex);
  836. cmpFoldoutBtnStyle.hoverOn.texture = getGUITexture(CmpFoldoutOpenHoverTex);
  837. cmpFoldoutBtnStyle.activeOn.texture = getGUITexture(CmpFoldoutOpenActiveTex);
  838. cmpFoldoutBtnStyle.fixedHeight = true;
  839. cmpFoldoutBtnStyle.fixedWidth = false;
  840. cmpFoldoutBtnStyle.height = 10;
  841. cmpFoldoutBtnStyle.minWidth = 10;
  842. cmpFoldoutBtnStyle.font = font;
  843. cmpFoldoutBtnStyle.fontSize = DefaultFontSize;
  844. cmpFoldoutBtnStyle.textHorzAlign = THA_Left;
  845. cmpFoldoutBtnStyle.textVertAlign = TVA_Center;
  846. cmpFoldoutBtnStyle.contentOffset = RectOffset(12, 0, 0, 0);
  847. cmpFoldoutBtnStyle.border.left = 8;
  848. mSkin.setStyle(GUIComponentFoldout::getFoldoutButtonStyleType(), cmpFoldoutBtnStyle);
  849. GUIElementStyle cmpFoldoutStyle;
  850. cmpFoldoutStyle.fixedHeight = true;
  851. cmpFoldoutStyle.height = 12;
  852. cmpFoldoutStyle.minWidth = 30;
  853. cmpFoldoutStyle.subStyles[GUIComponentFoldout::getFoldoutButtonStyleType()] = GUIComponentFoldout::getFoldoutButtonStyleType();
  854. mSkin.setStyle(GUIComponentFoldout::getGUITypeName(), cmpFoldoutStyle);
  855. /************************************************************************/
  856. /* FOLDOUT */
  857. /************************************************************************/
  858. GUIElementStyle foldoutBtnStyle;
  859. foldoutBtnStyle.normal.texture = getGUITexture(FoldoutClosedNormalTex);
  860. foldoutBtnStyle.hover.texture = getGUITexture(FoldoutClosedHoverTex);
  861. foldoutBtnStyle.active.texture = foldoutBtnStyle.hover.texture;
  862. foldoutBtnStyle.normalOn.texture = getGUITexture(FoldoutOpenNormalTex);
  863. foldoutBtnStyle.hoverOn.texture = getGUITexture(FoldoutOpenHoverTex);
  864. foldoutBtnStyle.activeOn.texture = foldoutBtnStyle.hoverOn.texture;
  865. foldoutBtnStyle.fixedHeight = true;
  866. foldoutBtnStyle.fixedWidth = true;
  867. foldoutBtnStyle.height = 10;
  868. foldoutBtnStyle.width = 8;
  869. mSkin.setStyle(GUIFoldout::getFoldoutButtonStyleType(), foldoutBtnStyle);
  870. GUIElementStyle foldoutStyle;
  871. foldoutStyle.fixedHeight = true;
  872. foldoutStyle.height = 12;
  873. foldoutStyle.minWidth = 30;
  874. foldoutStyle.subStyles[GUIFoldout::getLabelStyleType()] = GUIFoldout::getLabelStyleType();
  875. foldoutStyle.subStyles[GUIFoldout::getFoldoutButtonStyleType()] = GUIFoldout::getFoldoutButtonStyleType();
  876. mSkin.setStyle(GUIFoldout::getGUITypeName(), foldoutStyle);
  877. }
  878. void BuiltinEditorResources::preprocess()
  879. {
  880. static const WString GUI_TEXTURES[] =
  881. { WindowBackgroundTexture, ButtonNormalTex, ButtonHoverTex, ButtonActiveTex, ToggleNormalTex,
  882. ToggleHoverTex, ToggleActiveTex, ToggleNormalOnTex, ToggleHoverOnTex, ToggleActiveOnTex,
  883. ObjectDropBtnNormalTex, ObjectDropBtnNormalOnTex, ObjectClearBtnNormalTex, ObjectClearBtnHoverTex,
  884. ObjectClearBtnActiveTex, FoldoutOpenNormalTex, FoldoutOpenHoverTex, FoldoutClosedNormalTex,
  885. FoldoutClosedHoverTex, CmpFoldoutOpenNormalTex, CmpFoldoutOpenHoverTex, CmpFoldoutOpenActiveTex,
  886. CmpFoldoutClosedNormalTex, CmpFoldoutClosedHoverTex, CmpFoldoutClosedActiveTex, WindowFrameNormal,
  887. WindowFrameFocused, WindowTitleBarBg, WindowCloseButtonNormal, WindowCloseButtonHover, WindowMinButtonNormal,
  888. WindowMinButtonHover, WindowMaxButtonNormal, WindowMaxButtonHover, TabbedBarBtnNormal, TabbedBarBtnActive,
  889. InputBoxNormalTex, InputBoxHoverTex, InputBoxFocusedTex, ScrollBarUpNormalTex, ScrollBarUpHoverTex,
  890. ScrollBarUpActiveTex, ScrollBarDownNormalTex, ScrollBarDownHoverTex, ScrollBarDownActiveTex, ScrollBarLeftNormalTex,
  891. ScrollBarLeftHoverTex, ScrollBarLeftActiveTex, ScrollBarRightNormalTex, ScrollBarRightHoverTex, ScrollBarRightActiveTex,
  892. ScrollBarHandleHorzNormalTex, ScrollBarHandleHorzHoverTex, ScrollBarHandleHorzActiveTex, ScrollBarHandleVertNormalTex,
  893. ScrollBarHandleVertHoverTex, ScrollBarHandleVertActiveTex, DropDownBtnNormalTex, DropDownBtnHoverTex,
  894. DropDownBoxBgTex, DropDownBoxEntryNormalTex, DropDownBoxEntryHoverTex, DropDownBoxBtnUpNormalTex,
  895. DropDownBoxBtnUpHoverTex, DropDownBoxBtnDownNormalTex, DropDownBoxBtnDownHoverTex, DropDownBoxEntryExpNormalTex,
  896. DropDownBoxEntryExpHoverTex, DropDownSeparatorTex, DropDownBoxBtnUpArrowTex, DropDownBoxBtnDownArrowTex,
  897. ScrollBarBgTex, MenuBarBgTex, MenuBarBtnNormalTex, MenuBarBtnHoverTex, MenuBarBansheeLogoTex, DockSliderNormalTex,
  898. TreeViewExpandButtonOffNormal, TreeViewExpandButtonOffHover, TreeViewExpandButtonOnNormal, TreeViewExpandButtonOnHover,
  899. TreeViewSelectionBackground, TreeViewEditBox, TreeViewElementHighlight, TreeViewElementSepHighlight };
  900. static const GpuProgramImportData GPU_PROGRAM_IMPORT_DATA[] =
  901. {
  902. { SceneGridVSFile, "vs_main", GPT_VERTEX_PROGRAM, GPP_VS_4_0, "hlsl", HLSL11ShaderSubFolder },
  903. { SceneGridPSFile, "ps_main", GPT_FRAGMENT_PROGRAM, GPP_FS_4_0, "hlsl", HLSL11ShaderSubFolder },
  904. { ShaderDockOverlayVSFile, "vs_main", GPT_VERTEX_PROGRAM, GPP_VS_4_0, "hlsl", HLSL11ShaderSubFolder },
  905. { ShaderDockOverlayPSFile, "ps_main", GPT_FRAGMENT_PROGRAM, GPP_FS_4_0, "hlsl", HLSL11ShaderSubFolder },
  906. { PickingVSFile, "vs_main", GPT_VERTEX_PROGRAM, GPP_VS_4_0, "hlsl", HLSL11ShaderSubFolder },
  907. { PickingPSFile, "ps_main", GPT_FRAGMENT_PROGRAM, GPP_FS_4_0, "hlsl", HLSL11ShaderSubFolder },
  908. { PickingAlphaVSFile, "vs_main", GPT_VERTEX_PROGRAM, GPP_VS_4_0, "hlsl", HLSL11ShaderSubFolder },
  909. { PickingAlphaPSFile, "ps_main", GPT_FRAGMENT_PROGRAM, GPP_FS_4_0, "hlsl", HLSL11ShaderSubFolder },
  910. { ShaderWireGizmoVSFile, "vs_main", GPT_VERTEX_PROGRAM, GPP_VS_4_0, "hlsl", HLSL11ShaderSubFolder },
  911. { ShaderWireGizmoPSFile, "ps_main", GPT_FRAGMENT_PROGRAM, GPP_FS_4_0, "hlsl", HLSL11ShaderSubFolder },
  912. { ShaderSolidGizmoVSFile, "vs_main", GPT_VERTEX_PROGRAM, GPP_VS_4_0, "hlsl", HLSL11ShaderSubFolder },
  913. { ShaderSolidGizmoPSFile, "ps_main", GPT_FRAGMENT_PROGRAM, GPP_FS_4_0, "hlsl", HLSL11ShaderSubFolder },
  914. { ShaderIconGizmo0VSFile, "vs_main", GPT_VERTEX_PROGRAM, GPP_VS_4_0, "hlsl", HLSL11ShaderSubFolder },
  915. { ShaderIconGizmo0PSFile, "ps_main", GPT_FRAGMENT_PROGRAM, GPP_FS_4_0, "hlsl", HLSL11ShaderSubFolder },
  916. { ShaderIconGizmo1VSFile, "vs_main", GPT_VERTEX_PROGRAM, GPP_VS_4_0, "hlsl", HLSL11ShaderSubFolder },
  917. { ShaderIconGizmo1PSFile, "ps_main", GPT_FRAGMENT_PROGRAM, GPP_FS_4_0, "hlsl", HLSL11ShaderSubFolder },
  918. { GizmoPickingVSFile, "vs_main", GPT_VERTEX_PROGRAM, GPP_VS_4_0, "hlsl", HLSL11ShaderSubFolder },
  919. { GizmoPickingPSFile, "ps_main", GPT_FRAGMENT_PROGRAM, GPP_FS_4_0, "hlsl", HLSL11ShaderSubFolder },
  920. { GizmoPickingAlphaVSFile, "vs_main", GPT_VERTEX_PROGRAM, GPP_VS_4_0, "hlsl", HLSL11ShaderSubFolder },
  921. { GizmoPickingAlphaPSFile, "ps_main", GPT_FRAGMENT_PROGRAM, GPP_FS_4_0, "hlsl", HLSL11ShaderSubFolder },
  922. { SceneGridVSFile, "vs_main", GPT_VERTEX_PROGRAM, GPP_VS_2_0, "hlsl", HLSL9ShaderSubFolder },
  923. { SceneGridPSFile, "ps_main", GPT_FRAGMENT_PROGRAM, GPP_FS_2_0, "hlsl", HLSL9ShaderSubFolder },
  924. { ShaderDockOverlayVSFile, "vs_main", GPT_VERTEX_PROGRAM, GPP_VS_2_0, "hlsl", HLSL9ShaderSubFolder },
  925. { ShaderDockOverlayPSFile, "ps_main", GPT_FRAGMENT_PROGRAM, GPP_FS_2_0, "hlsl", HLSL9ShaderSubFolder },
  926. { PickingVSFile, "vs_main", GPT_VERTEX_PROGRAM, GPP_VS_3_0, "hlsl", HLSL9ShaderSubFolder },
  927. { PickingPSFile, "ps_main", GPT_FRAGMENT_PROGRAM, GPP_FS_3_0, "hlsl", HLSL9ShaderSubFolder },
  928. { PickingAlphaVSFile, "vs_main", GPT_VERTEX_PROGRAM, GPP_VS_3_0, "hlsl", HLSL9ShaderSubFolder },
  929. { PickingAlphaPSFile, "ps_main", GPT_FRAGMENT_PROGRAM, GPP_FS_3_0, "hlsl", HLSL9ShaderSubFolder },
  930. { ShaderWireGizmoVSFile, "vs_main", GPT_VERTEX_PROGRAM, GPP_VS_3_0, "hlsl", HLSL9ShaderSubFolder },
  931. { ShaderWireGizmoPSFile, "ps_main", GPT_FRAGMENT_PROGRAM, GPP_FS_3_0, "hlsl", HLSL9ShaderSubFolder },
  932. { ShaderSolidGizmoVSFile, "vs_main", GPT_VERTEX_PROGRAM, GPP_VS_3_0, "hlsl", HLSL9ShaderSubFolder },
  933. { ShaderSolidGizmoPSFile, "ps_main", GPT_FRAGMENT_PROGRAM, GPP_FS_3_0, "hlsl", HLSL9ShaderSubFolder },
  934. { ShaderIconGizmo0VSFile, "vs_main", GPT_VERTEX_PROGRAM, GPP_VS_3_0, "hlsl", HLSL9ShaderSubFolder },
  935. { ShaderIconGizmo0PSFile, "ps_main", GPT_FRAGMENT_PROGRAM, GPP_FS_3_0, "hlsl", HLSL9ShaderSubFolder },
  936. { ShaderIconGizmo1VSFile, "vs_main", GPT_VERTEX_PROGRAM, GPP_VS_3_0, "hlsl", HLSL9ShaderSubFolder },
  937. { ShaderIconGizmo1PSFile, "ps_main", GPT_FRAGMENT_PROGRAM, GPP_FS_3_0, "hlsl", HLSL9ShaderSubFolder },
  938. { GizmoPickingVSFile, "vs_main", GPT_VERTEX_PROGRAM, GPP_VS_3_0, "hlsl", HLSL9ShaderSubFolder },
  939. { GizmoPickingPSFile, "ps_main", GPT_FRAGMENT_PROGRAM, GPP_FS_3_0, "hlsl", HLSL9ShaderSubFolder },
  940. { GizmoPickingAlphaVSFile, "vs_main", GPT_VERTEX_PROGRAM, GPP_VS_3_0, "hlsl", HLSL9ShaderSubFolder },
  941. { GizmoPickingAlphaPSFile, "ps_main", GPT_FRAGMENT_PROGRAM, GPP_FS_3_0, "hlsl", HLSL9ShaderSubFolder },
  942. { SceneGridVSFile, "main", GPT_VERTEX_PROGRAM, GPP_VS_4_0, "glsl", GLSLShaderSubFolder },
  943. { SceneGridPSFile, "main", GPT_FRAGMENT_PROGRAM, GPP_FS_4_0, "glsl", GLSLShaderSubFolder },
  944. { ShaderDockOverlayVSFile, "main", GPT_VERTEX_PROGRAM, GPP_VS_4_0, "glsl", GLSLShaderSubFolder },
  945. { ShaderDockOverlayPSFile, "main", GPT_FRAGMENT_PROGRAM, GPP_FS_4_0, "glsl", GLSLShaderSubFolder },
  946. { PickingVSFile, "main", GPT_VERTEX_PROGRAM, GPP_VS_4_0, "glsl", GLSLShaderSubFolder },
  947. { PickingPSFile, "main", GPT_FRAGMENT_PROGRAM, GPP_FS_4_0, "glsl", GLSLShaderSubFolder },
  948. { PickingAlphaVSFile, "main", GPT_VERTEX_PROGRAM, GPP_VS_4_0, "glsl", GLSLShaderSubFolder },
  949. { PickingAlphaPSFile, "main", GPT_FRAGMENT_PROGRAM, GPP_FS_4_0, "glsl", GLSLShaderSubFolder },
  950. { ShaderWireGizmoVSFile, "main", GPT_VERTEX_PROGRAM, GPP_VS_4_0, "glsl", GLSLShaderSubFolder },
  951. { ShaderWireGizmoPSFile, "main", GPT_FRAGMENT_PROGRAM, GPP_FS_4_0, "glsl", GLSLShaderSubFolder },
  952. { ShaderSolidGizmoVSFile, "main", GPT_VERTEX_PROGRAM, GPP_VS_4_0, "glsl", GLSLShaderSubFolder },
  953. { ShaderSolidGizmoPSFile, "main", GPT_FRAGMENT_PROGRAM, GPP_FS_4_0, "glsl", GLSLShaderSubFolder },
  954. { ShaderIconGizmo0VSFile, "main", GPT_VERTEX_PROGRAM, GPP_VS_4_0, "glsl", GLSLShaderSubFolder },
  955. { ShaderIconGizmo0PSFile, "main", GPT_FRAGMENT_PROGRAM, GPP_FS_4_0, "glsl", GLSLShaderSubFolder },
  956. { ShaderIconGizmo1VSFile, "main", GPT_VERTEX_PROGRAM, GPP_VS_4_0, "glsl", GLSLShaderSubFolder },
  957. { ShaderIconGizmo1PSFile, "main", GPT_FRAGMENT_PROGRAM, GPP_FS_4_0, "glsl", GLSLShaderSubFolder },
  958. { GizmoPickingVSFile, "main", GPT_VERTEX_PROGRAM, GPP_VS_4_0, "glsl", GLSLShaderSubFolder },
  959. { GizmoPickingPSFile, "main", GPT_FRAGMENT_PROGRAM, GPP_FS_4_0, "glsl", GLSLShaderSubFolder },
  960. { GizmoPickingAlphaVSFile, "main", GPT_VERTEX_PROGRAM, GPP_VS_4_0, "glsl", GLSLShaderSubFolder },
  961. { GizmoPickingAlphaPSFile, "main", GPT_FRAGMENT_PROGRAM, GPP_FS_4_0, "glsl", GLSLShaderSubFolder },
  962. };
  963. if (FileSystem::exists(DefaultSkinFolderRaw))
  964. {
  965. FileSystem::remove(DefaultSkinFolder);
  966. for (auto& tex : GUI_TEXTURES)
  967. importGUITexture(tex);
  968. {
  969. Path fontPath = FileSystem::getWorkingDirectoryPath();
  970. fontPath.append(DefaultSkinFolderRaw);
  971. fontPath.append(DefaultFontFilename);
  972. ImportOptionsPtr fontImportOptions = Importer::instance().createImportOptions(fontPath);
  973. if (rtti_is_of_type<FontImportOptions>(fontImportOptions))
  974. {
  975. FontImportOptions* importOptions = static_cast<FontImportOptions*>(fontImportOptions.get());
  976. Vector<UINT32> fontSizes;
  977. fontSizes.push_back(DefaultFontSize);
  978. importOptions->setFontSizes(fontSizes);
  979. importOptions->setAntialiasing(false);
  980. }
  981. HFont font = Importer::instance().import<Font>(fontPath, fontImportOptions);
  982. Path outputPath = FileSystem::getWorkingDirectoryPath();
  983. outputPath.append(DefaultSkinFolder);
  984. outputPath.append(DefaultFontFilename + L".asset");
  985. Resources::instance().save(font, outputPath, true);
  986. // Save font texture pages as well. TODO - Later maybe figure out a more automatic way to do this
  987. const FontData* fontData = font->getFontDataForSize(DefaultFontSize);
  988. Path texPageOutputPath = FileSystem::getWorkingDirectoryPath();
  989. texPageOutputPath.append(DefaultSkinFolder);
  990. UINT32 pageIdx = 0;
  991. for (auto tex : fontData->texturePages)
  992. {
  993. texPageOutputPath.setFilename(DefaultFontFilename + L"_texpage_" + toWString(pageIdx) + L".asset");
  994. Resources::instance().save(tex, texPageOutputPath, true);
  995. }
  996. }
  997. }
  998. if (FileSystem::exists(DefaultShaderFolderRaw))
  999. {
  1000. Path shaderFolder = DefaultShaderFolder;
  1001. shaderFolder.append(mActiveShaderSubFolder);
  1002. FileSystem::remove(shaderFolder);
  1003. for (auto& importData : GPU_PROGRAM_IMPORT_DATA)
  1004. {
  1005. if (importData.folder != mActiveShaderSubFolder)
  1006. continue;
  1007. Path gpuProgInputLoc = DefaultShaderFolderRaw;
  1008. gpuProgInputLoc.append(importData.folder);
  1009. gpuProgInputLoc.append(importData.filename);
  1010. Path gpuProgOutputLoc = DefaultShaderFolder;
  1011. gpuProgOutputLoc.append(importData.folder);
  1012. gpuProgOutputLoc.append(importData.filename + L".asset");
  1013. ImportOptionsPtr gpuProgImportOptions = Importer::instance().createImportOptions(gpuProgInputLoc);
  1014. if (rtti_is_of_type<GpuProgramImportOptions>(gpuProgImportOptions))
  1015. {
  1016. GpuProgramImportOptions* importOptions = static_cast<GpuProgramImportOptions*>(gpuProgImportOptions.get());
  1017. importOptions->setEntryPoint(importData.entryPoint);
  1018. importOptions->setLanguage(importData.language);
  1019. importOptions->setProfile(importData.profile);
  1020. importOptions->setType(importData.type);
  1021. }
  1022. HGpuProgram gpuProgram = Importer::instance().import<GpuProgram>(gpuProgInputLoc, gpuProgImportOptions);
  1023. Resources::instance().save(gpuProgram, gpuProgOutputLoc, true);
  1024. }
  1025. }
  1026. Resources::instance().unloadAllUnused();
  1027. }
  1028. void BuiltinEditorResources::importGUITexture(const WString& name)
  1029. {
  1030. Path texturePath = FileSystem::getWorkingDirectoryPath();
  1031. texturePath.append(DefaultSkinFolderRaw);
  1032. texturePath.append(name);
  1033. Path texOutputPath = FileSystem::getWorkingDirectoryPath();
  1034. texOutputPath.append(DefaultSkinFolder);
  1035. Path spriteTexOutputPath = texOutputPath;
  1036. texOutputPath.append(name + L".asset");
  1037. spriteTexOutputPath.append(L"sprite_" + name + L".asset");
  1038. HTexture tex = Importer::instance().import<Texture>(texturePath);
  1039. Resources::instance().save(tex, texOutputPath, true);
  1040. HSpriteTexture spriteTex = SpriteTexture::create(tex);
  1041. Resources::instance().save(spriteTex, spriteTexOutputPath, true);
  1042. }
  1043. HSpriteTexture BuiltinEditorResources::getGUITexture(const WString& name)
  1044. {
  1045. Path texturePath = FileSystem::getWorkingDirectoryPath();
  1046. texturePath.append(DefaultSkinFolder);
  1047. texturePath.append(L"sprite_" + name + L".asset");
  1048. return Resources::instance().load<SpriteTexture>(texturePath);
  1049. }
  1050. HGpuProgram BuiltinEditorResources::getGpuProgram(const WString& name)
  1051. {
  1052. Path programPath = DefaultShaderFolder;
  1053. programPath.append(mActiveShaderSubFolder);
  1054. programPath.append(name + L".asset");
  1055. return gResources().load<GpuProgram>(programPath);
  1056. }
  1057. void BuiltinEditorResources::initDockDropOverlayShader()
  1058. {
  1059. HGpuProgram vsProgram = getGpuProgram(ShaderDockOverlayVSFile);
  1060. HGpuProgram psProgram = getGpuProgram(ShaderDockOverlayPSFile);
  1061. BLEND_STATE_DESC desc;
  1062. desc.renderTargetDesc[0].blendEnable = true;
  1063. desc.renderTargetDesc[0].srcBlend = BF_SOURCE_ALPHA;
  1064. desc.renderTargetDesc[0].dstBlend = BF_INV_SOURCE_ALPHA;
  1065. desc.renderTargetDesc[0].blendOp = BO_ADD;
  1066. HBlendState blendState = BlendState::create(desc);
  1067. DEPTH_STENCIL_STATE_DESC depthStateDesc;
  1068. depthStateDesc.depthReadEnable = false;
  1069. depthStateDesc.depthWriteEnable = false;
  1070. HDepthStencilState depthState = DepthStencilState::create(depthStateDesc);
  1071. PASS_DESC passDesc;
  1072. passDesc.vertexProgram = vsProgram;
  1073. passDesc.fragmentProgram = psProgram;
  1074. passDesc.blendState = blendState;
  1075. passDesc.depthStencilState = depthState;
  1076. PassPtr newPass = Pass::create(passDesc);
  1077. TechniquePtr newTechnique = Technique::create(mActiveRenderSystem, RendererInvariant, { newPass });
  1078. SHADER_DESC shaderDesc;
  1079. shaderDesc.addParameter("invViewportWidth", "invViewportWidth", GPDT_FLOAT1);
  1080. shaderDesc.addParameter("invViewportHeight", "invViewportHeight", GPDT_FLOAT1);
  1081. shaderDesc.addParameter("tintColor", "tintColor", GPDT_FLOAT4);
  1082. shaderDesc.addParameter("highlightColor", "highlightColor", GPDT_FLOAT4);
  1083. shaderDesc.addParameter("highlightActive", "highlightActive", GPDT_FLOAT4);
  1084. mShaderDockOverlay = Shader::create("DockDropOverlayShader", shaderDesc, { newTechnique });
  1085. }
  1086. void BuiltinEditorResources::initSceneGridShader()
  1087. {
  1088. HGpuProgram vsProgram = getGpuProgram(SceneGridVSFile);
  1089. HGpuProgram psProgram = getGpuProgram(SceneGridPSFile);
  1090. BLEND_STATE_DESC blendDesc;
  1091. blendDesc.renderTargetDesc[0].blendEnable = true;
  1092. blendDesc.renderTargetDesc[0].srcBlend = BF_SOURCE_ALPHA;
  1093. blendDesc.renderTargetDesc[0].dstBlend = BF_INV_SOURCE_ALPHA;
  1094. blendDesc.renderTargetDesc[0].blendOp = BO_ADD;
  1095. blendDesc.renderTargetDesc[0].renderTargetWriteMask = 0x7; // Don't write to alpha
  1096. HBlendState blendState = BlendState::create(blendDesc);
  1097. RASTERIZER_STATE_DESC rasterizerDesc;
  1098. rasterizerDesc.cullMode = CULL_NONE;
  1099. HRasterizerState rasterizerState = RasterizerState::create(rasterizerDesc);
  1100. PASS_DESC passDesc;
  1101. passDesc.vertexProgram = vsProgram;
  1102. passDesc.fragmentProgram = psProgram;
  1103. passDesc.blendState = blendState;
  1104. passDesc.rasterizerState = rasterizerState;
  1105. PassPtr newPass = Pass::create(passDesc);
  1106. TechniquePtr newTechnique = Technique::create(mActiveRenderSystem, RendererInvariant, { newPass });
  1107. SHADER_DESC shaderDesc;
  1108. shaderDesc.addParameter("matViewProj", "matViewProj", GPDT_MATRIX_4X4);
  1109. mShaderSceneGrid = Shader::create("SceneGridShader", shaderDesc, { newTechnique });
  1110. }
  1111. void BuiltinEditorResources::initPickingShader(CullingMode cullMode)
  1112. {
  1113. UINT32 modeIdx = (UINT32)cullMode;
  1114. HGpuProgram vsProgram = getGpuProgram(PickingVSFile);
  1115. HGpuProgram psProgram = getGpuProgram(PickingPSFile);
  1116. RASTERIZER_STATE_DESC rasterizerDesc;
  1117. rasterizerDesc.scissorEnable = true;
  1118. rasterizerDesc.cullMode = cullMode;
  1119. HRasterizerState rasterizerState = RasterizerState::create(rasterizerDesc);
  1120. PASS_DESC passDesc;
  1121. passDesc.vertexProgram = vsProgram;
  1122. passDesc.fragmentProgram = psProgram;
  1123. passDesc.rasterizerState = rasterizerState;
  1124. PassPtr newPass = Pass::create(passDesc);
  1125. TechniquePtr newTechnique = Technique::create(mActiveRenderSystem, RendererInvariant, { newPass });
  1126. SHADER_DESC shaderDesc;
  1127. shaderDesc.addParameter("colorIndex", "colorIndex", GPDT_FLOAT4);
  1128. shaderDesc.addParameter("matWorldViewProj", "matWorldViewProj", GPDT_MATRIX_4X4);
  1129. mShaderPicking[modeIdx] = Shader::create("PickingShader", shaderDesc, { newTechnique });
  1130. }
  1131. void BuiltinEditorResources::initPickingAlphaShader(CullingMode cullMode)
  1132. {
  1133. UINT32 modeIdx = (UINT32)cullMode;
  1134. HGpuProgram vsProgram = getGpuProgram(PickingAlphaVSFile);
  1135. HGpuProgram psProgram = getGpuProgram(PickingAlphaPSFile);
  1136. RASTERIZER_STATE_DESC rasterizerDesc;
  1137. rasterizerDesc.scissorEnable = true;
  1138. rasterizerDesc.cullMode = cullMode;
  1139. HRasterizerState rasterizerState = RasterizerState::create(rasterizerDesc);
  1140. PASS_DESC passDesc;
  1141. passDesc.vertexProgram = vsProgram;
  1142. passDesc.fragmentProgram = psProgram;
  1143. passDesc.rasterizerState = rasterizerState;
  1144. PassPtr newPass = Pass::create(passDesc);
  1145. TechniquePtr newTechnique = Technique::create(mActiveRenderSystem, RendererInvariant, { newPass });
  1146. SHADER_DESC shaderDesc;
  1147. shaderDesc.addParameter("mainTexSamp", "mainTexSamp", GPOT_SAMPLER2D);
  1148. shaderDesc.addParameter("mainTexSamp", "mainTexture", GPOT_SAMPLER2D);
  1149. shaderDesc.addParameter("mainTexture", "mainTexture", GPOT_TEXTURE2D);
  1150. shaderDesc.addParameter("alphaCutoff", "alphaCutoff", GPDT_FLOAT1);
  1151. shaderDesc.addParameter("colorIndex", "colorIndex", GPDT_FLOAT4);
  1152. shaderDesc.addParameter("matWorldViewProj", "matWorldViewProj", GPDT_MATRIX_4X4);
  1153. mShaderPickingAlpha[modeIdx] = Shader::create("PickingAlphaShader", shaderDesc, { newTechnique });
  1154. }
  1155. void BuiltinEditorResources::initWireGizmoShader()
  1156. {
  1157. HGpuProgram vsProgram = getGpuProgram(ShaderWireGizmoVSFile);
  1158. HGpuProgram psProgram = getGpuProgram(ShaderWireGizmoPSFile);
  1159. PASS_DESC passDesc;
  1160. passDesc.vertexProgram = vsProgram;
  1161. passDesc.fragmentProgram = psProgram;
  1162. PassPtr newPass = Pass::create(passDesc);
  1163. TechniquePtr newTechnique = Technique::create(mActiveRenderSystem, RendererInvariant, { newPass });
  1164. SHADER_DESC shaderDesc;
  1165. shaderDesc.addParameter("matViewProj", "matViewProj", GPDT_MATRIX_4X4);
  1166. mShaderGizmoWire = Shader::create("GizmoWire", shaderDesc, { newTechnique });
  1167. }
  1168. void BuiltinEditorResources::initSolidGizmoShader()
  1169. {
  1170. HGpuProgram vsProgram = getGpuProgram(ShaderSolidGizmoVSFile);
  1171. HGpuProgram psProgram = getGpuProgram(ShaderSolidGizmoPSFile);
  1172. PASS_DESC passDesc;
  1173. passDesc.vertexProgram = vsProgram;
  1174. passDesc.fragmentProgram = psProgram;
  1175. PassPtr newPass = Pass::create(passDesc);
  1176. TechniquePtr newTechnique = Technique::create(mActiveRenderSystem, RendererInvariant, { newPass });
  1177. SHADER_DESC shaderDesc;
  1178. shaderDesc.addParameter("matViewProj", "matViewProj", GPDT_MATRIX_4X4);
  1179. mShaderGizmoSolid = Shader::create("GizmoSolid", shaderDesc, { newTechnique });
  1180. }
  1181. void BuiltinEditorResources::initWireHandleShader()
  1182. {
  1183. HGpuProgram vsProgram = getGpuProgram(ShaderWireGizmoVSFile);
  1184. HGpuProgram psProgram = getGpuProgram(ShaderWireGizmoPSFile);
  1185. DEPTH_STENCIL_STATE_DESC depthStencilStateDesc;
  1186. depthStencilStateDesc.depthWriteEnable = false;
  1187. depthStencilStateDesc.depthReadEnable = false;
  1188. HDepthStencilState depthStencilState = DepthStencilState::create(depthStencilStateDesc);
  1189. BLEND_STATE_DESC blendDesc;
  1190. blendDesc.renderTargetDesc[0].blendEnable = true;
  1191. blendDesc.renderTargetDesc[0].srcBlend = BF_SOURCE_ALPHA;
  1192. blendDesc.renderTargetDesc[0].dstBlend = BF_INV_SOURCE_ALPHA;
  1193. blendDesc.renderTargetDesc[0].blendOp = BO_ADD;
  1194. HBlendState blendState = BlendState::create(blendDesc);
  1195. PASS_DESC passDesc;
  1196. passDesc.vertexProgram = vsProgram;
  1197. passDesc.fragmentProgram = psProgram;
  1198. passDesc.depthStencilState = depthStencilState;
  1199. passDesc.blendState = blendState;
  1200. PassPtr newPass = Pass::create(passDesc);
  1201. TechniquePtr newTechnique = Technique::create(mActiveRenderSystem, RendererInvariant, { newPass });
  1202. SHADER_DESC shaderDesc;
  1203. shaderDesc.addParameter("matViewProj", "matViewProj", GPDT_MATRIX_4X4);
  1204. mShaderHandleWire = Shader::create("HandleWire", shaderDesc, { newTechnique });
  1205. }
  1206. void BuiltinEditorResources::initSolidHandleShader()
  1207. {
  1208. HGpuProgram vsProgram = getGpuProgram(ShaderSolidGizmoVSFile);
  1209. HGpuProgram psProgram = getGpuProgram(ShaderSolidGizmoPSFile);
  1210. DEPTH_STENCIL_STATE_DESC depthStencilStateDesc;
  1211. depthStencilStateDesc.depthWriteEnable = false;
  1212. depthStencilStateDesc.depthReadEnable = false;
  1213. HDepthStencilState depthStencilState = DepthStencilState::create(depthStencilStateDesc);
  1214. BLEND_STATE_DESC blendDesc;
  1215. blendDesc.renderTargetDesc[0].blendEnable = true;
  1216. blendDesc.renderTargetDesc[0].srcBlend = BF_SOURCE_ALPHA;
  1217. blendDesc.renderTargetDesc[0].dstBlend = BF_INV_SOURCE_ALPHA;
  1218. blendDesc.renderTargetDesc[0].blendOp = BO_ADD;
  1219. HBlendState blendState = BlendState::create(blendDesc);
  1220. PASS_DESC passDesc;
  1221. passDesc.vertexProgram = vsProgram;
  1222. passDesc.fragmentProgram = psProgram;
  1223. passDesc.depthStencilState = depthStencilState;
  1224. passDesc.blendState = blendState;
  1225. PassPtr newPass = Pass::create(passDesc);
  1226. TechniquePtr newTechnique = Technique::create(mActiveRenderSystem, RendererInvariant, { newPass });
  1227. SHADER_DESC shaderDesc;
  1228. shaderDesc.addParameter("matViewProj", "matViewProj", GPDT_MATRIX_4X4);
  1229. mShaderHandleSolid = Shader::create("HandleSolid", shaderDesc, { newTechnique });
  1230. }
  1231. void BuiltinEditorResources::initIconGizmoShader()
  1232. {
  1233. HGpuProgram vsProgram0 = getGpuProgram(ShaderIconGizmo0VSFile);
  1234. HGpuProgram psProgram0 = getGpuProgram(ShaderIconGizmo0PSFile);
  1235. HGpuProgram vsProgram1 = getGpuProgram(ShaderIconGizmo1VSFile);
  1236. HGpuProgram psProgram1 = getGpuProgram(ShaderIconGizmo1PSFile);
  1237. BLEND_STATE_DESC blendDesc;
  1238. blendDesc.renderTargetDesc[0].blendEnable = true;
  1239. blendDesc.renderTargetDesc[0].srcBlend = BF_SOURCE_ALPHA;
  1240. blendDesc.renderTargetDesc[0].dstBlend = BF_INV_SOURCE_ALPHA;
  1241. blendDesc.renderTargetDesc[0].blendOp = BO_ADD;
  1242. HBlendState blendState = BlendState::create(blendDesc);
  1243. DEPTH_STENCIL_STATE_DESC depthStencilState0Desc;
  1244. depthStencilState0Desc.depthWriteEnable = false;
  1245. depthStencilState0Desc.depthComparisonFunc = CMPF_LESS_EQUAL;
  1246. HDepthStencilState depthStencilState0 = DepthStencilState::create(depthStencilState0Desc);
  1247. DEPTH_STENCIL_STATE_DESC depthStencilState1Desc;
  1248. depthStencilState1Desc.depthWriteEnable = false;
  1249. depthStencilState1Desc.depthComparisonFunc = CMPF_GREATER;
  1250. HDepthStencilState depthStencilState1 = DepthStencilState::create(depthStencilState1Desc);
  1251. PASS_DESC pass0Desc;
  1252. pass0Desc.vertexProgram = vsProgram0;
  1253. pass0Desc.fragmentProgram = psProgram0;
  1254. pass0Desc.blendState = blendState;
  1255. pass0Desc.depthStencilState = depthStencilState0;
  1256. PassPtr newPass0 = Pass::create(pass0Desc);
  1257. PASS_DESC pass1Desc;
  1258. pass1Desc.vertexProgram = vsProgram1;
  1259. pass1Desc.fragmentProgram = psProgram1;
  1260. pass1Desc.blendState = blendState;
  1261. pass1Desc.depthStencilState = depthStencilState1;
  1262. PassPtr newPass1 = Pass::create(pass1Desc);
  1263. TechniquePtr newTechnique = Technique::create(mActiveRenderSystem, RendererInvariant, { newPass0, newPass1 });
  1264. SHADER_DESC shaderDesc;
  1265. shaderDesc.addParameter("matViewProj", "matViewProj", GPDT_MATRIX_4X4);
  1266. shaderDesc.addParameter("mainTexSamp", "mainTexSamp", GPOT_SAMPLER2D);
  1267. shaderDesc.addParameter("mainTexSamp", "mainTexture", GPOT_SAMPLER2D);
  1268. shaderDesc.addParameter("mainTexture", "mainTexture", GPOT_TEXTURE2D);
  1269. mShaderGizmoIcon = Shader::create("GizmoIcon", shaderDesc, { newTechnique });
  1270. }
  1271. void BuiltinEditorResources::initGizmoPickingShader()
  1272. {
  1273. HGpuProgram vsProgram = getGpuProgram(GizmoPickingVSFile);
  1274. HGpuProgram psProgram = getGpuProgram(GizmoPickingPSFile);
  1275. RASTERIZER_STATE_DESC rasterizerDesc;
  1276. rasterizerDesc.scissorEnable = true;
  1277. HRasterizerState rasterizerState = RasterizerState::create(rasterizerDesc);
  1278. PASS_DESC passDesc;
  1279. passDesc.vertexProgram = vsProgram;
  1280. passDesc.fragmentProgram = psProgram;
  1281. passDesc.rasterizerState = rasterizerState;
  1282. PassPtr newPass = Pass::create(passDesc);
  1283. TechniquePtr newTechnique = Technique::create(mActiveRenderSystem, RendererInvariant, { newPass });
  1284. SHADER_DESC shaderDesc;
  1285. shaderDesc.addParameter("matViewProj", "matViewProj", GPDT_MATRIX_4X4);
  1286. mShaderGizmoPicking = Shader::create("GizmoPickingShader", shaderDesc, { newTechnique });
  1287. }
  1288. void BuiltinEditorResources::initGizmoPickingAlphaShader()
  1289. {
  1290. HGpuProgram vsProgram = getGpuProgram(GizmoPickingAlphaVSFile);
  1291. HGpuProgram psProgram = getGpuProgram(GizmoPickingAlphaPSFile);
  1292. RASTERIZER_STATE_DESC rasterizerDesc;
  1293. rasterizerDesc.scissorEnable = true;
  1294. HRasterizerState rasterizerState = RasterizerState::create(rasterizerDesc);
  1295. PASS_DESC passDesc;
  1296. passDesc.vertexProgram = vsProgram;
  1297. passDesc.fragmentProgram = psProgram;
  1298. passDesc.rasterizerState = rasterizerState;
  1299. PassPtr newPass = Pass::create(passDesc);
  1300. TechniquePtr newTechnique = Technique::create(mActiveRenderSystem, RendererInvariant, { newPass });
  1301. SHADER_DESC shaderDesc;
  1302. shaderDesc.addParameter("mainTexSamp", "mainTexSamp", GPOT_SAMPLER2D);
  1303. shaderDesc.addParameter("mainTexSamp", "mainTexture", GPOT_SAMPLER2D);
  1304. shaderDesc.addParameter("mainTexture", "mainTexture", GPOT_TEXTURE2D);
  1305. shaderDesc.addParameter("alphaCutoff", "alphaCutoff", GPDT_FLOAT1);
  1306. shaderDesc.addParameter("matViewProj", "matViewProj", GPDT_MATRIX_4X4);
  1307. mShaderGizmoAlphaPicking = Shader::create("GizmoPickingAlphaShader", shaderDesc, { newTechnique });
  1308. }
  1309. HMaterial BuiltinEditorResources::createDockDropOverlayMaterial() const
  1310. {
  1311. return Material::create(mShaderDockOverlay);
  1312. }
  1313. HMaterial BuiltinEditorResources::createSceneGridMaterial() const
  1314. {
  1315. return Material::create(mShaderSceneGrid);
  1316. }
  1317. HMaterial BuiltinEditorResources::createPicking(CullingMode cullMode) const
  1318. {
  1319. UINT32 modeIdx = (UINT32)cullMode;
  1320. return Material::create(mShaderPicking[modeIdx]);
  1321. }
  1322. HMaterial BuiltinEditorResources::createPickingAlpha(CullingMode cullMode) const
  1323. {
  1324. UINT32 modeIdx = (UINT32)cullMode;
  1325. return Material::create(mShaderPickingAlpha[modeIdx]);
  1326. }
  1327. HMaterial BuiltinEditorResources::createWireGizmoMat() const
  1328. {
  1329. return Material::create(mShaderGizmoWire);
  1330. }
  1331. HMaterial BuiltinEditorResources::createSolidGizmoMat() const
  1332. {
  1333. return Material::create(mShaderGizmoSolid);
  1334. }
  1335. HMaterial BuiltinEditorResources::createIconGizmoMat() const
  1336. {
  1337. return Material::create(mShaderGizmoIcon);
  1338. }
  1339. HMaterial BuiltinEditorResources::createGizmoPickingMat() const
  1340. {
  1341. return Material::create(mShaderGizmoPicking);
  1342. }
  1343. HMaterial BuiltinEditorResources::createAlphaGizmoPickingMat() const
  1344. {
  1345. return Material::create(mShaderGizmoAlphaPicking);
  1346. }
  1347. HMaterial BuiltinEditorResources::createWireHandleMat() const
  1348. {
  1349. return Material::create(mShaderHandleWire);
  1350. }
  1351. HMaterial BuiltinEditorResources::createSolidHandleMat() const
  1352. {
  1353. return Material::create(mShaderHandleSolid);
  1354. }
  1355. }