2
0

BsBuiltinEditorResources.cpp 79 KB

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