BsBuiltinEditorResources.cpp 79 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784
  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.normalOn.texture = dropDownEntryBtnStyle.hover.texture;
  546. dropDownEntryBtnStyle.hoverOn.texture = dropDownEntryBtnStyle.hover.texture;
  547. dropDownEntryBtnStyle.activeOn.texture = dropDownEntryBtnStyle.hover.texture;
  548. dropDownEntryBtnStyle.fixedHeight = true;
  549. dropDownEntryBtnStyle.fixedWidth = false;
  550. dropDownEntryBtnStyle.height = 14;
  551. dropDownEntryBtnStyle.width = 30;
  552. dropDownEntryBtnStyle.border.left = 1;
  553. dropDownEntryBtnStyle.border.right = 1;
  554. dropDownEntryBtnStyle.border.top = 1;
  555. dropDownEntryBtnStyle.border.bottom = 1;
  556. dropDownEntryBtnStyle.font = font;
  557. dropDownEntryBtnStyle.fontSize = DefaultFontSize;
  558. dropDownEntryBtnStyle.textHorzAlign = THA_Left;
  559. dropDownEntryBtnStyle.textVertAlign = TVA_Top;
  560. mSkin.setStyle(GUIDropDownContent::ENTRY_STYLE_TYPE, dropDownEntryBtnStyle);
  561. // DropDown entry button with expand
  562. GUIElementStyle dropDownEntryExpBtnStyle;
  563. dropDownEntryExpBtnStyle.normal.texture = getGUITexture(DropDownBoxEntryExpNormalTex);
  564. dropDownEntryExpBtnStyle.hover.texture = getGUITexture(DropDownBoxEntryExpHoverTex);
  565. dropDownEntryExpBtnStyle.active.texture = dropDownEntryExpBtnStyle.hover.texture;
  566. dropDownEntryExpBtnStyle.normalOn.texture = dropDownEntryExpBtnStyle.hover.texture;
  567. dropDownEntryExpBtnStyle.hoverOn.texture = dropDownEntryExpBtnStyle.hover.texture;
  568. dropDownEntryExpBtnStyle.activeOn.texture = dropDownEntryExpBtnStyle.hover.texture;
  569. dropDownEntryExpBtnStyle.fixedHeight = true;
  570. dropDownEntryExpBtnStyle.fixedWidth = false;
  571. dropDownEntryExpBtnStyle.height = 14;
  572. dropDownEntryExpBtnStyle.width = 30;
  573. dropDownEntryExpBtnStyle.border.left = 1;
  574. dropDownEntryExpBtnStyle.border.right = 6;
  575. dropDownEntryExpBtnStyle.border.top = 1;
  576. dropDownEntryExpBtnStyle.border.bottom = 1;
  577. dropDownEntryExpBtnStyle.font = font;
  578. dropDownEntryExpBtnStyle.fontSize = DefaultFontSize;
  579. dropDownEntryExpBtnStyle.textHorzAlign = THA_Left;
  580. dropDownEntryExpBtnStyle.textVertAlign = TVA_Top;
  581. mSkin.setStyle(GUIDropDownContent::ENTRY_EXP_STYLE_TYPE, dropDownEntryExpBtnStyle);
  582. // Drop down separator
  583. GUIElementStyle dropDownSeparatorStyle;
  584. dropDownSeparatorStyle.normal.texture = getGUITexture(DropDownSeparatorTex);
  585. dropDownSeparatorStyle.fixedHeight = true;
  586. dropDownSeparatorStyle.fixedWidth = false;
  587. dropDownSeparatorStyle.height = 3;
  588. dropDownSeparatorStyle.width = 30;
  589. dropDownSeparatorStyle.border.left = 1;
  590. dropDownSeparatorStyle.border.right = 1;
  591. dropDownSeparatorStyle.border.top = 1;
  592. dropDownSeparatorStyle.border.bottom = 1;
  593. mSkin.setStyle(GUIDropDownContent::SEPARATOR_STYLE_TYPE, dropDownSeparatorStyle);
  594. // Drop down content
  595. GUIElementStyle dropDownContentStyle;
  596. dropDownContentStyle.minWidth = 50;
  597. dropDownContentStyle.minHeight = 20;
  598. dropDownContentStyle.subStyles[GUIDropDownContent::ENTRY_STYLE_TYPE] = GUIDropDownContent::ENTRY_STYLE_TYPE;
  599. dropDownContentStyle.subStyles[GUIDropDownContent::ENTRY_EXP_STYLE_TYPE] = GUIDropDownContent::ENTRY_EXP_STYLE_TYPE;
  600. dropDownContentStyle.subStyles[GUIDropDownContent::SEPARATOR_STYLE_TYPE] = GUIDropDownContent::SEPARATOR_STYLE_TYPE;
  601. mSkin.setStyle("ListBoxContent", dropDownContentStyle);
  602. mSkin.setStyle("MenuBarContent", dropDownContentStyle);
  603. mSkin.setStyle("ContextMenuContent", dropDownContentStyle);
  604. // DropDown box frame
  605. GUIElementStyle dropDownBoxStyle;
  606. dropDownBoxStyle.normal.texture = getGUITexture(DropDownBoxBgTex);
  607. dropDownBoxStyle.hover.texture = dropDownEntryBtnStyle.normal.texture;
  608. dropDownBoxStyle.active.texture = dropDownEntryBtnStyle.hover.texture;
  609. dropDownBoxStyle.fixedHeight = false;
  610. dropDownBoxStyle.fixedWidth = false;
  611. dropDownBoxStyle.border.left = 1;
  612. dropDownBoxStyle.border.right = 1;
  613. dropDownBoxStyle.border.top = 1;
  614. dropDownBoxStyle.border.bottom = 1;
  615. dropDownBoxStyle.margins.left = 1;
  616. dropDownBoxStyle.margins.right = 1;
  617. dropDownBoxStyle.margins.top = 1;
  618. dropDownBoxStyle.margins.bottom = 1;
  619. mSkin.setStyle("ListBoxFrame", dropDownBoxStyle);
  620. mSkin.setStyle("MenuBarFrame", dropDownBoxStyle);
  621. mSkin.setStyle("ContextMenuFrame", dropDownBoxStyle);
  622. /************************************************************************/
  623. /* MENU BAR */
  624. /************************************************************************/
  625. // MenuBar background
  626. GUIElementStyle menuBarBgStyle;
  627. menuBarBgStyle.normal.texture = getGUITexture(MenuBarBgTex);
  628. menuBarBgStyle.fixedHeight = false;
  629. menuBarBgStyle.fixedWidth = false;
  630. menuBarBgStyle.height = 4;
  631. menuBarBgStyle.width = 4;
  632. mSkin.setStyle("MenuBarBg", menuBarBgStyle);
  633. // MenuBar Banshee logo
  634. GUIElementStyle menuBarBansheeLogoStyle;
  635. menuBarBansheeLogoStyle.normal.texture = getGUITexture(MenuBarBansheeLogoTex);
  636. menuBarBansheeLogoStyle.fixedHeight = true;
  637. menuBarBansheeLogoStyle.fixedWidth = true;
  638. menuBarBansheeLogoStyle.height = 7;
  639. menuBarBansheeLogoStyle.width = 51;
  640. mSkin.setStyle("MenuBarBansheeLogo", menuBarBansheeLogoStyle);
  641. // MenuBar button
  642. GUIElementStyle menuBarBtnStyle;
  643. menuBarBtnStyle.normal.texture = getGUITexture(MenuBarBtnNormalTex);
  644. menuBarBtnStyle.hover.texture = getGUITexture(MenuBarBtnHoverTex);
  645. menuBarBtnStyle.active.texture = menuBarBtnStyle.hover.texture;
  646. menuBarBtnStyle.normalOn.texture = menuBarBtnStyle.hover.texture;
  647. menuBarBtnStyle.hoverOn.texture = menuBarBtnStyle.hover.texture;
  648. menuBarBtnStyle.activeOn.texture = menuBarBtnStyle.hover.texture;
  649. menuBarBtnStyle.fixedHeight = true;
  650. menuBarBtnStyle.fixedWidth = false;
  651. menuBarBtnStyle.height = 15;
  652. menuBarBtnStyle.width = 4;
  653. menuBarBtnStyle.margins.left = 2;
  654. menuBarBtnStyle.margins.right = 2;
  655. menuBarBtnStyle.margins.top = 2;
  656. menuBarBtnStyle.margins.bottom = 2;
  657. menuBarBtnStyle.font = font;
  658. menuBarBtnStyle.fontSize = DefaultFontSize;
  659. menuBarBtnStyle.textHorzAlign = THA_Left;
  660. menuBarBtnStyle.textVertAlign = TVA_Top;
  661. mSkin.setStyle("MenuBarBtn", menuBarBtnStyle);
  662. /************************************************************************/
  663. /* DOCK SLIDER */
  664. /************************************************************************/
  665. GUIElementStyle dockSliderBtnStyle;
  666. dockSliderBtnStyle.normal.texture = getGUITexture(DockSliderNormalTex);
  667. dockSliderBtnStyle.fixedHeight = false;
  668. dockSliderBtnStyle.fixedWidth = false;
  669. dockSliderBtnStyle.height = 2;
  670. dockSliderBtnStyle.width = 2;
  671. mSkin.setStyle("DockSliderBtn", dockSliderBtnStyle);
  672. /************************************************************************/
  673. /* TREE VIEW */
  674. /************************************************************************/
  675. // Expand button
  676. GUIElementStyle treeViewExpandButtonStyle;
  677. treeViewExpandButtonStyle.normal.texture = getGUITexture(TreeViewExpandButtonOffNormal);
  678. treeViewExpandButtonStyle.hover.texture = getGUITexture(TreeViewExpandButtonOffHover);
  679. treeViewExpandButtonStyle.active.texture = treeViewExpandButtonStyle.hover.texture;
  680. treeViewExpandButtonStyle.normalOn.texture = getGUITexture(TreeViewExpandButtonOnNormal);
  681. treeViewExpandButtonStyle.hoverOn.texture = getGUITexture(TreeViewExpandButtonOnHover);
  682. treeViewExpandButtonStyle.activeOn.texture = treeViewExpandButtonStyle.hoverOn.texture;
  683. treeViewExpandButtonStyle.margins.left = 4;
  684. treeViewExpandButtonStyle.margins.right = 4;
  685. treeViewExpandButtonStyle.margins.top = 5;
  686. treeViewExpandButtonStyle.margins.bottom = 4;
  687. treeViewExpandButtonStyle.fixedHeight = true;
  688. treeViewExpandButtonStyle.fixedWidth = true;
  689. treeViewExpandButtonStyle.height = 16;
  690. treeViewExpandButtonStyle.width = 16;
  691. mSkin.setStyle("TreeViewFoldoutBtn", treeViewExpandButtonStyle);
  692. // Entry
  693. GUIElementStyle treeViewEntryStyle;
  694. treeViewEntryStyle.font = font;
  695. treeViewEntryStyle.fontSize = DefaultFontSize;
  696. treeViewEntryStyle.fixedWidth = false;
  697. treeViewEntryStyle.fixedHeight = true;
  698. treeViewEntryStyle.height = 16;
  699. treeViewEntryStyle.minWidth = 10;
  700. mSkin.setStyle("TreeViewElementBtn", treeViewEntryStyle);
  701. // Selection background
  702. GUIElementStyle treeViewSelBackgroundStyle;
  703. treeViewSelBackgroundStyle.normal.texture = getGUITexture(TreeViewSelectionBackground);
  704. treeViewSelBackgroundStyle.fixedHeight = false;
  705. treeViewSelBackgroundStyle.fixedWidth = false;
  706. treeViewSelBackgroundStyle.height = 2;
  707. treeViewSelBackgroundStyle.width = 2;
  708. mSkin.setStyle("TreeViewSelectionBackground", treeViewSelBackgroundStyle);
  709. // Edit box
  710. GUIElementStyle treeViewEditBox;
  711. treeViewEditBox.normal.texture = getGUITexture(TreeViewEditBox);
  712. treeViewEditBox.hover.texture = treeViewEditBox.normal.texture;
  713. treeViewEditBox.focused.texture = treeViewEditBox.normal.texture;
  714. treeViewEditBox.active.texture = treeViewEditBox.normal.texture;
  715. treeViewEditBox.border.left = 1;
  716. treeViewEditBox.border.right = 1;
  717. treeViewEditBox.border.top = 1;
  718. treeViewEditBox.border.bottom = 1;
  719. treeViewEditBox.margins.left = 1;
  720. treeViewEditBox.margins.right = 1;
  721. treeViewEditBox.margins.top = 1;
  722. treeViewEditBox.margins.bottom = 1;
  723. treeViewEditBox.fixedHeight = true;
  724. treeViewEditBox.height = 13;
  725. treeViewEditBox.minWidth = 10;
  726. treeViewEditBox.font = font;
  727. treeViewEditBox.fontSize = DefaultFontSize;
  728. treeViewEditBox.textHorzAlign = THA_Left;
  729. treeViewEditBox.textVertAlign = TVA_Top;
  730. mSkin.setStyle(GUITreeViewEditBox::getGUITypeName(), treeViewEditBox);
  731. // Element highlight
  732. GUIElementStyle treeViewElementHighlight;
  733. treeViewElementHighlight.normal.texture = getGUITexture(TreeViewElementHighlight);
  734. treeViewElementHighlight.border.left = 1;
  735. treeViewElementHighlight.border.right = 1;
  736. treeViewElementHighlight.border.top = 1;
  737. treeViewElementHighlight.border.bottom = 1;
  738. mSkin.setStyle("TreeViewElementHighlight", treeViewElementHighlight);
  739. // Element separator highlight
  740. GUIElementStyle treeViewElementSepHighlight;
  741. treeViewElementSepHighlight.normal.texture = getGUITexture(TreeViewElementSepHighlight);
  742. treeViewElementSepHighlight.border.left = 1;
  743. treeViewElementSepHighlight.border.right = 1;
  744. treeViewElementSepHighlight.border.top = 1;
  745. treeViewElementSepHighlight.border.bottom = 1;
  746. mSkin.setStyle("TreeViewElementSepHighlight", treeViewElementSepHighlight);
  747. /************************************************************************/
  748. /* OBJECT DROP FIELD */
  749. /************************************************************************/
  750. GUIElementStyle objectDropStyle;
  751. objectDropStyle.normal.texture = getGUITexture(ObjectDropBtnNormalTex);
  752. objectDropStyle.normalOn.texture = getGUITexture(ObjectDropBtnNormalOnTex);
  753. objectDropStyle.fixedHeight = true;
  754. objectDropStyle.height = 15;
  755. objectDropStyle.minWidth = 50;
  756. objectDropStyle.font = font;
  757. objectDropStyle.fontSize = DefaultFontSize;
  758. objectDropStyle.textHorzAlign = THA_Center;
  759. objectDropStyle.textVertAlign = TVA_Center;
  760. mSkin.setStyle(ObjectFieldDropBtnStyleName, objectDropStyle);
  761. GUIElementStyle objectClearBtnStyle;
  762. objectClearBtnStyle.normal.texture = getGUITexture(ObjectClearBtnNormalTex);
  763. objectClearBtnStyle.hover.texture = getGUITexture(ObjectClearBtnHoverTex);
  764. objectClearBtnStyle.active.texture = getGUITexture(ObjectClearBtnActiveTex);
  765. objectClearBtnStyle.fixedHeight = true;
  766. objectClearBtnStyle.fixedWidth = true;
  767. objectClearBtnStyle.height = 15;
  768. objectClearBtnStyle.width = 13;
  769. mSkin.setStyle(ObjectFieldClearBtnStyleName, objectClearBtnStyle);
  770. GUIElementStyle editorObjectFieldStyle;
  771. editorObjectFieldStyle.fixedHeight = true;
  772. editorObjectFieldStyle.height = 15;
  773. editorObjectFieldStyle.minWidth = 30;
  774. editorObjectFieldStyle.subStyles[ObjectFieldLabelStyleName] = GUITextField::getLabelStyleType();
  775. editorObjectFieldStyle.subStyles[ObjectFieldDropBtnStyleName] = ObjectFieldDropBtnStyleName;
  776. editorObjectFieldStyle.subStyles[ObjectFieldClearBtnStyleName] = ObjectFieldClearBtnStyleName;
  777. mSkin.setStyle(ObjectFieldStyleName, editorObjectFieldStyle);
  778. /************************************************************************/
  779. /* EDITOR FIELDS */
  780. /************************************************************************/
  781. GUIElementStyle editorFieldLabelStyle;
  782. editorFieldLabelStyle.font = font;
  783. editorFieldLabelStyle.fontSize = DefaultFontSize;
  784. editorFieldLabelStyle.fixedWidth = false;
  785. editorFieldLabelStyle.fixedHeight = true;
  786. editorFieldLabelStyle.height = 11;
  787. editorFieldLabelStyle.minWidth = 10;
  788. editorFieldLabelStyle.textHorzAlign = THA_Left;
  789. mSkin.setStyle(GUITextField::getLabelStyleType(), editorFieldLabelStyle);
  790. GUIElementStyle editorIntFieldStyle;
  791. editorIntFieldStyle.fixedHeight = true;
  792. editorIntFieldStyle.height = 15;
  793. editorIntFieldStyle.minWidth = 30;
  794. editorIntFieldStyle.subStyles[GUIIntField::getLabelStyleType()] = GUITextField::getLabelStyleType();
  795. editorIntFieldStyle.subStyles[GUIIntField::getInputStyleType()] = GUIInputBox::getGUITypeName();
  796. mSkin.setStyle(GUIIntField::getGUITypeName(), editorIntFieldStyle);
  797. GUIElementStyle editorFloatFieldStyle;
  798. editorFloatFieldStyle.fixedHeight = true;
  799. editorFloatFieldStyle.height = 15;
  800. editorFloatFieldStyle.minWidth = 30;
  801. editorFloatFieldStyle.subStyles[GUIFloatField::getLabelStyleType()] = GUITextField::getLabelStyleType();
  802. editorFloatFieldStyle.subStyles[GUIFloatField::getInputStyleType()] = GUIInputBox::getGUITypeName();
  803. mSkin.setStyle(GUIFloatField::getGUITypeName(), editorFloatFieldStyle);
  804. GUIElementStyle editorTextFieldStyle;
  805. editorTextFieldStyle.fixedHeight = true;
  806. editorTextFieldStyle.height = 15;
  807. editorTextFieldStyle.minWidth = 30;
  808. editorTextFieldStyle.subStyles[GUITextField::getLabelStyleType()] = GUITextField::getLabelStyleType();
  809. editorTextFieldStyle.subStyles[GUITextField::getInputStyleType()] = GUIInputBox::getGUITypeName();
  810. mSkin.setStyle(GUITextField::getGUITypeName(), editorTextFieldStyle);
  811. GUIElementStyle editorColorFieldStyle;
  812. editorColorFieldStyle.fixedHeight = true;
  813. editorColorFieldStyle.height = 15;
  814. editorColorFieldStyle.minWidth = 30;
  815. editorColorFieldStyle.subStyles[GUIColorField::getLabelStyleType()] = GUITextField::getLabelStyleType();
  816. editorColorFieldStyle.subStyles[GUIColorField::getColorInputStyleType()] = GUIColor::getGUITypeName();
  817. mSkin.setStyle(GUIColorField::getGUITypeName(), editorColorFieldStyle);
  818. GUIElementStyle editorToggleFieldStyle;
  819. editorToggleFieldStyle.fixedHeight = true;
  820. editorToggleFieldStyle.height = 15;
  821. editorToggleFieldStyle.minWidth = 30;
  822. editorToggleFieldStyle.subStyles[GUIToggleField::getLabelStyleType()] = GUITextField::getLabelStyleType();
  823. editorToggleFieldStyle.subStyles[GUIToggleField::getToggleStyleType()] = GUIToggle::getGUITypeName();
  824. mSkin.setStyle(GUIToggleField::getGUITypeName(), editorToggleFieldStyle);
  825. GUIElementStyle editorVector2FieldStyle;
  826. editorVector2FieldStyle.fixedHeight = true;
  827. editorVector2FieldStyle.height = 30;
  828. editorVector2FieldStyle.minWidth = 30;
  829. editorVector2FieldStyle.subStyles[GUIVector2Field::getLabelStyleType()] = GUITextField::getLabelStyleType();
  830. editorVector2FieldStyle.subStyles[GUIVector2Field::getFloatFieldStyleType()] = GUIFloatField::getGUITypeName();
  831. mSkin.setStyle(GUIVector2Field::getGUITypeName(), editorVector2FieldStyle);
  832. GUIElementStyle editorVector3FieldStyle;
  833. editorVector3FieldStyle.fixedHeight = true;
  834. editorVector3FieldStyle.height = 30;
  835. editorVector3FieldStyle.minWidth = 30;
  836. editorVector3FieldStyle.subStyles[GUIVector3Field::getLabelStyleType()] = GUITextField::getLabelStyleType();
  837. editorVector3FieldStyle.subStyles[GUIVector3Field::getFloatFieldStyleType()] = GUIFloatField::getGUITypeName();
  838. mSkin.setStyle(GUIVector3Field::getGUITypeName(), editorVector3FieldStyle);
  839. GUIElementStyle editorVector4FieldStyle;
  840. editorVector4FieldStyle.fixedHeight = true;
  841. editorVector4FieldStyle.height = 30;
  842. editorVector4FieldStyle.minWidth = 30;
  843. editorVector4FieldStyle.subStyles[GUIVector4Field::getLabelStyleType()] = GUITextField::getLabelStyleType();
  844. editorVector4FieldStyle.subStyles[GUIVector4Field::getFloatFieldStyleType()] = GUIFloatField::getGUITypeName();
  845. mSkin.setStyle(GUIVector4Field::getGUITypeName(), editorVector4FieldStyle);
  846. /************************************************************************/
  847. /* COMPONENT FOLDOUT */
  848. /************************************************************************/
  849. GUIElementStyle cmpFoldoutBtnStyle;
  850. cmpFoldoutBtnStyle.normal.texture = getGUITexture(CmpFoldoutClosedNormalTex);
  851. cmpFoldoutBtnStyle.hover.texture = getGUITexture(CmpFoldoutClosedHoverTex);
  852. cmpFoldoutBtnStyle.active.texture = getGUITexture(CmpFoldoutOpenActiveTex);
  853. cmpFoldoutBtnStyle.normalOn.texture = getGUITexture(CmpFoldoutOpenNormalTex);
  854. cmpFoldoutBtnStyle.hoverOn.texture = getGUITexture(CmpFoldoutOpenHoverTex);
  855. cmpFoldoutBtnStyle.activeOn.texture = getGUITexture(CmpFoldoutOpenActiveTex);
  856. cmpFoldoutBtnStyle.fixedHeight = true;
  857. cmpFoldoutBtnStyle.fixedWidth = false;
  858. cmpFoldoutBtnStyle.height = 10;
  859. cmpFoldoutBtnStyle.minWidth = 10;
  860. cmpFoldoutBtnStyle.font = font;
  861. cmpFoldoutBtnStyle.fontSize = DefaultFontSize;
  862. cmpFoldoutBtnStyle.textHorzAlign = THA_Left;
  863. cmpFoldoutBtnStyle.textVertAlign = TVA_Center;
  864. cmpFoldoutBtnStyle.contentOffset = RectOffset(12, 0, 0, 0);
  865. cmpFoldoutBtnStyle.border.left = 8;
  866. mSkin.setStyle(GUIComponentFoldout::getFoldoutButtonStyleType(), cmpFoldoutBtnStyle);
  867. GUIElementStyle cmpFoldoutStyle;
  868. cmpFoldoutStyle.fixedHeight = true;
  869. cmpFoldoutStyle.height = 12;
  870. cmpFoldoutStyle.minWidth = 30;
  871. cmpFoldoutStyle.subStyles[GUIComponentFoldout::getFoldoutButtonStyleType()] = GUIComponentFoldout::getFoldoutButtonStyleType();
  872. mSkin.setStyle(GUIComponentFoldout::getGUITypeName(), cmpFoldoutStyle);
  873. /************************************************************************/
  874. /* FOLDOUT */
  875. /************************************************************************/
  876. GUIElementStyle foldoutBtnStyle;
  877. foldoutBtnStyle.normal.texture = getGUITexture(FoldoutClosedNormalTex);
  878. foldoutBtnStyle.hover.texture = getGUITexture(FoldoutClosedHoverTex);
  879. foldoutBtnStyle.active.texture = foldoutBtnStyle.hover.texture;
  880. foldoutBtnStyle.normalOn.texture = getGUITexture(FoldoutOpenNormalTex);
  881. foldoutBtnStyle.hoverOn.texture = getGUITexture(FoldoutOpenHoverTex);
  882. foldoutBtnStyle.activeOn.texture = foldoutBtnStyle.hoverOn.texture;
  883. foldoutBtnStyle.fixedHeight = true;
  884. foldoutBtnStyle.fixedWidth = true;
  885. foldoutBtnStyle.height = 10;
  886. foldoutBtnStyle.width = 8;
  887. mSkin.setStyle(GUIFoldout::getFoldoutButtonStyleType(), foldoutBtnStyle);
  888. GUIElementStyle foldoutStyle;
  889. foldoutStyle.fixedHeight = true;
  890. foldoutStyle.height = 12;
  891. foldoutStyle.minWidth = 30;
  892. foldoutStyle.subStyles[GUIFoldout::getLabelStyleType()] = GUIFoldout::getLabelStyleType();
  893. foldoutStyle.subStyles[GUIFoldout::getFoldoutButtonStyleType()] = GUIFoldout::getFoldoutButtonStyleType();
  894. mSkin.setStyle(GUIFoldout::getGUITypeName(), foldoutStyle);
  895. /************************************************************************/
  896. /* PROGRESS BAR */
  897. /************************************************************************/
  898. GUIElementStyle progressBarBgStyle;
  899. progressBarBgStyle.fixedHeight = true;
  900. progressBarBgStyle.height = 18;
  901. progressBarBgStyle.normal.texture = getGUITexture(ProgressBarBgTex);
  902. mSkin.setStyle(GUIProgressBar::getBackgroundStyleType(), progressBarBgStyle);
  903. GUIElementStyle progressBarFillStyle;
  904. progressBarFillStyle.fixedHeight = true;
  905. progressBarFillStyle.height = 12;
  906. progressBarFillStyle.normal.texture = getGUITexture(ProgressBarFillTex);
  907. mSkin.setStyle(GUIProgressBar::getBarStyleType(), progressBarFillStyle);
  908. GUIElementStyle progressBarStyle;
  909. progressBarStyle.fixedHeight = true;
  910. progressBarStyle.height = 18;
  911. progressBarStyle.minWidth = 100;
  912. progressBarStyle.margins.top = 3;
  913. progressBarStyle.margins.bottom = 3;
  914. progressBarStyle.subStyles[GUIProgressBar::getBarStyleType()] = GUIProgressBar::getBarStyleType();
  915. progressBarStyle.subStyles[GUIProgressBar::getBackgroundStyleType()] = GUIProgressBar::getBackgroundStyleType();
  916. mSkin.setStyle(GUIProgressBar::getGUITypeName(), progressBarStyle);
  917. /************************************************************************/
  918. /* COLOR PICKER SLIDER */
  919. /************************************************************************/
  920. GUIElementStyle colorPickerSliderHorzHandleStyle;
  921. colorPickerSliderHorzHandleStyle.fixedHeight = true;
  922. colorPickerSliderHorzHandleStyle.fixedWidth = true;
  923. colorPickerSliderHorzHandleStyle.height = 20;
  924. colorPickerSliderHorzHandleStyle.width = 7;
  925. colorPickerSliderHorzHandleStyle.normal.texture = getGUITexture(ColorPickerSliderHorzHandleTex);
  926. colorPickerSliderHorzHandleStyle.hover.texture = colorPickerSliderHorzHandleStyle.normal.texture;
  927. colorPickerSliderHorzHandleStyle.active.texture = colorPickerSliderHorzHandleStyle.normal.texture;
  928. mSkin.setStyle("ColorSliderHorzHandle", colorPickerSliderHorzHandleStyle);
  929. GUIElementStyle colorPickerSliderHorzStyle;
  930. colorPickerSliderHorzHandleStyle.fixedHeight = true;
  931. colorPickerSliderHorzHandleStyle.height = 32;
  932. colorPickerSliderHorzHandleStyle.minWidth = 20;
  933. colorPickerSliderHorzStyle.subStyles[GUISlider::getHandleStyleType()] = "ColorSliderHorzHandle";
  934. mSkin.setStyle("ColorSliderHorz", colorPickerSliderHorzStyle);
  935. GUIElementStyle colorPickerSliderVertHandleStyle;
  936. colorPickerSliderVertHandleStyle.fixedHeight = true;
  937. colorPickerSliderVertHandleStyle.fixedWidth = true;
  938. colorPickerSliderVertHandleStyle.height = 7;
  939. colorPickerSliderVertHandleStyle.width = 45;
  940. colorPickerSliderVertHandleStyle.normal.texture = getGUITexture(ColorPickerSliderVertHandleTex);
  941. colorPickerSliderVertHandleStyle.hover.texture = colorPickerSliderVertHandleStyle.normal.texture;
  942. colorPickerSliderVertHandleStyle.active.texture = colorPickerSliderVertHandleStyle.normal.texture;
  943. mSkin.setStyle("ColorSliderVertHandle", colorPickerSliderVertHandleStyle);
  944. GUIElementStyle colorPickerSliderVertStyle;
  945. colorPickerSliderVertStyle.fixedWidth = true;
  946. colorPickerSliderVertStyle.width = 30;
  947. colorPickerSliderVertStyle.minHeight = 20;
  948. colorPickerSliderVertStyle.subStyles[GUISlider::getHandleStyleType()] = "ColorSliderVertHandle";
  949. mSkin.setStyle("ColorSliderVert", colorPickerSliderVertStyle);
  950. GUIElementStyle colorPickerSlider2DHandleStyle;
  951. colorPickerSlider2DHandleStyle.fixedHeight = true;
  952. colorPickerSlider2DHandleStyle.fixedWidth = true;
  953. colorPickerSlider2DHandleStyle.height = 8;
  954. colorPickerSlider2DHandleStyle.width = 8;
  955. colorPickerSlider2DHandleStyle.normal.texture = getGUITexture(ColorPickerSlider2DHandleTex);
  956. colorPickerSlider2DHandleStyle.hover.texture = colorPickerSlider2DHandleStyle.normal.texture;
  957. colorPickerSlider2DHandleStyle.active.texture = colorPickerSlider2DHandleStyle.normal.texture;
  958. mSkin.setStyle("ColorSlider2DHandle", colorPickerSlider2DHandleStyle);
  959. /************************************************************************/
  960. /* OTHER */
  961. /************************************************************************/
  962. // Right-aligned label
  963. GUIElementStyle rightAlignedLabelStyle;
  964. rightAlignedLabelStyle.font = font;
  965. rightAlignedLabelStyle.fontSize = DefaultFontSize;
  966. rightAlignedLabelStyle.fixedWidth = false;
  967. rightAlignedLabelStyle.fixedHeight = true;
  968. rightAlignedLabelStyle.height = 11;
  969. rightAlignedLabelStyle.minWidth = 10;
  970. rightAlignedLabelStyle.textHorzAlign = THA_Right;
  971. mSkin.setStyle("RightAlignedLabel", rightAlignedLabelStyle);
  972. }
  973. void BuiltinEditorResources::preprocess()
  974. {
  975. static const WString GUI_TEXTURES[] =
  976. { WindowBackgroundTexture, ButtonNormalTex, ButtonHoverTex, ButtonActiveTex, ToggleNormalTex,
  977. ToggleHoverTex, ToggleActiveTex, ToggleNormalOnTex, ToggleHoverOnTex, ToggleActiveOnTex,
  978. ObjectDropBtnNormalTex, ObjectDropBtnNormalOnTex, ObjectClearBtnNormalTex, ObjectClearBtnHoverTex,
  979. ObjectClearBtnActiveTex, FoldoutOpenNormalTex, FoldoutOpenHoverTex, FoldoutClosedNormalTex,
  980. FoldoutClosedHoverTex, CmpFoldoutOpenNormalTex, CmpFoldoutOpenHoverTex, CmpFoldoutOpenActiveTex,
  981. CmpFoldoutClosedNormalTex, CmpFoldoutClosedHoverTex, CmpFoldoutClosedActiveTex, WindowFrameNormal,
  982. WindowFrameFocused, WindowTitleBarBg, WindowCloseButtonNormal, WindowCloseButtonHover, WindowMinButtonNormal,
  983. WindowMinButtonHover, WindowMaxButtonNormal, WindowMaxButtonHover, TabbedBarBtnNormal, TabbedBarBtnActive,
  984. InputBoxNormalTex, InputBoxHoverTex, InputBoxFocusedTex, ScrollBarUpNormalTex, ScrollBarUpHoverTex,
  985. ScrollBarUpActiveTex, ScrollBarDownNormalTex, ScrollBarDownHoverTex, ScrollBarDownActiveTex, ScrollBarLeftNormalTex,
  986. ScrollBarLeftHoverTex, ScrollBarLeftActiveTex, ScrollBarRightNormalTex, ScrollBarRightHoverTex, ScrollBarRightActiveTex,
  987. ScrollBarHandleHorzNormalTex, ScrollBarHandleHorzHoverTex, ScrollBarHandleHorzActiveTex, ScrollBarHandleVertNormalTex,
  988. ScrollBarHandleVertHoverTex, ScrollBarHandleVertActiveTex, DropDownBtnNormalTex, DropDownBtnHoverTex,
  989. DropDownBoxBgTex, DropDownBoxEntryNormalTex, DropDownBoxEntryHoverTex, DropDownBoxBtnUpNormalTex,
  990. DropDownBoxBtnUpHoverTex, DropDownBoxBtnDownNormalTex, DropDownBoxBtnDownHoverTex, DropDownBoxEntryExpNormalTex,
  991. DropDownBoxEntryExpHoverTex, DropDownSeparatorTex, DropDownBoxBtnUpArrowTex, DropDownBoxBtnDownArrowTex,
  992. ScrollBarBgTex, MenuBarBgTex, MenuBarBtnNormalTex, MenuBarBtnHoverTex, MenuBarBansheeLogoTex, DockSliderNormalTex,
  993. TreeViewExpandButtonOffNormal, TreeViewExpandButtonOffHover, TreeViewExpandButtonOnNormal, TreeViewExpandButtonOnHover,
  994. TreeViewSelectionBackground, TreeViewEditBox, TreeViewElementHighlight, TreeViewElementSepHighlight, ProgressBarBgTex,
  995. ProgressBarFillTex, ColorPickerSliderHorzHandleTex, ColorPickerSliderVertHandleTex, ColorPickerSlider2DHandleTex };
  996. static const GpuProgramImportData GPU_PROGRAM_IMPORT_DATA[] =
  997. {
  998. { SceneGridVSFile, "vs_main", GPT_VERTEX_PROGRAM, GPP_VS_4_0, "hlsl", HLSL11ShaderSubFolder },
  999. { SceneGridPSFile, "ps_main", GPT_FRAGMENT_PROGRAM, GPP_FS_4_0, "hlsl", HLSL11ShaderSubFolder },
  1000. { ShaderDockOverlayVSFile, "vs_main", GPT_VERTEX_PROGRAM, GPP_VS_4_0, "hlsl", HLSL11ShaderSubFolder },
  1001. { ShaderDockOverlayPSFile, "ps_main", GPT_FRAGMENT_PROGRAM, GPP_FS_4_0, "hlsl", HLSL11ShaderSubFolder },
  1002. { PickingVSFile, "vs_main", GPT_VERTEX_PROGRAM, GPP_VS_4_0, "hlsl", HLSL11ShaderSubFolder },
  1003. { PickingPSFile, "ps_main", GPT_FRAGMENT_PROGRAM, GPP_FS_4_0, "hlsl", HLSL11ShaderSubFolder },
  1004. { PickingAlphaVSFile, "vs_main", GPT_VERTEX_PROGRAM, GPP_VS_4_0, "hlsl", HLSL11ShaderSubFolder },
  1005. { PickingAlphaPSFile, "ps_main", GPT_FRAGMENT_PROGRAM, GPP_FS_4_0, "hlsl", HLSL11ShaderSubFolder },
  1006. { ShaderWireGizmoVSFile, "vs_main", GPT_VERTEX_PROGRAM, GPP_VS_4_0, "hlsl", HLSL11ShaderSubFolder },
  1007. { ShaderWireGizmoPSFile, "ps_main", GPT_FRAGMENT_PROGRAM, GPP_FS_4_0, "hlsl", HLSL11ShaderSubFolder },
  1008. { ShaderSolidGizmoVSFile, "vs_main", GPT_VERTEX_PROGRAM, GPP_VS_4_0, "hlsl", HLSL11ShaderSubFolder },
  1009. { ShaderSolidGizmoPSFile, "ps_main", GPT_FRAGMENT_PROGRAM, GPP_FS_4_0, "hlsl", HLSL11ShaderSubFolder },
  1010. { ShaderIconGizmo0VSFile, "vs_main", GPT_VERTEX_PROGRAM, GPP_VS_4_0, "hlsl", HLSL11ShaderSubFolder },
  1011. { ShaderIconGizmo0PSFile, "ps_main", GPT_FRAGMENT_PROGRAM, GPP_FS_4_0, "hlsl", HLSL11ShaderSubFolder },
  1012. { ShaderIconGizmo1VSFile, "vs_main", GPT_VERTEX_PROGRAM, GPP_VS_4_0, "hlsl", HLSL11ShaderSubFolder },
  1013. { ShaderIconGizmo1PSFile, "ps_main", GPT_FRAGMENT_PROGRAM, GPP_FS_4_0, "hlsl", HLSL11ShaderSubFolder },
  1014. { GizmoPickingVSFile, "vs_main", GPT_VERTEX_PROGRAM, GPP_VS_4_0, "hlsl", HLSL11ShaderSubFolder },
  1015. { GizmoPickingPSFile, "ps_main", GPT_FRAGMENT_PROGRAM, GPP_FS_4_0, "hlsl", HLSL11ShaderSubFolder },
  1016. { GizmoPickingAlphaVSFile, "vs_main", GPT_VERTEX_PROGRAM, GPP_VS_4_0, "hlsl", HLSL11ShaderSubFolder },
  1017. { GizmoPickingAlphaPSFile, "ps_main", GPT_FRAGMENT_PROGRAM, GPP_FS_4_0, "hlsl", HLSL11ShaderSubFolder },
  1018. { SceneGridVSFile, "vs_main", GPT_VERTEX_PROGRAM, GPP_VS_2_0, "hlsl", HLSL9ShaderSubFolder },
  1019. { SceneGridPSFile, "ps_main", GPT_FRAGMENT_PROGRAM, GPP_FS_2_0, "hlsl", HLSL9ShaderSubFolder },
  1020. { ShaderDockOverlayVSFile, "vs_main", GPT_VERTEX_PROGRAM, GPP_VS_2_0, "hlsl", HLSL9ShaderSubFolder },
  1021. { ShaderDockOverlayPSFile, "ps_main", GPT_FRAGMENT_PROGRAM, GPP_FS_2_0, "hlsl", HLSL9ShaderSubFolder },
  1022. { PickingVSFile, "vs_main", GPT_VERTEX_PROGRAM, GPP_VS_3_0, "hlsl", HLSL9ShaderSubFolder },
  1023. { PickingPSFile, "ps_main", GPT_FRAGMENT_PROGRAM, GPP_FS_3_0, "hlsl", HLSL9ShaderSubFolder },
  1024. { PickingAlphaVSFile, "vs_main", GPT_VERTEX_PROGRAM, GPP_VS_3_0, "hlsl", HLSL9ShaderSubFolder },
  1025. { PickingAlphaPSFile, "ps_main", GPT_FRAGMENT_PROGRAM, GPP_FS_3_0, "hlsl", HLSL9ShaderSubFolder },
  1026. { ShaderWireGizmoVSFile, "vs_main", GPT_VERTEX_PROGRAM, GPP_VS_3_0, "hlsl", HLSL9ShaderSubFolder },
  1027. { ShaderWireGizmoPSFile, "ps_main", GPT_FRAGMENT_PROGRAM, GPP_FS_3_0, "hlsl", HLSL9ShaderSubFolder },
  1028. { ShaderSolidGizmoVSFile, "vs_main", GPT_VERTEX_PROGRAM, GPP_VS_3_0, "hlsl", HLSL9ShaderSubFolder },
  1029. { ShaderSolidGizmoPSFile, "ps_main", GPT_FRAGMENT_PROGRAM, GPP_FS_3_0, "hlsl", HLSL9ShaderSubFolder },
  1030. { ShaderIconGizmo0VSFile, "vs_main", GPT_VERTEX_PROGRAM, GPP_VS_3_0, "hlsl", HLSL9ShaderSubFolder },
  1031. { ShaderIconGizmo0PSFile, "ps_main", GPT_FRAGMENT_PROGRAM, GPP_FS_3_0, "hlsl", HLSL9ShaderSubFolder },
  1032. { ShaderIconGizmo1VSFile, "vs_main", GPT_VERTEX_PROGRAM, GPP_VS_3_0, "hlsl", HLSL9ShaderSubFolder },
  1033. { ShaderIconGizmo1PSFile, "ps_main", GPT_FRAGMENT_PROGRAM, GPP_FS_3_0, "hlsl", HLSL9ShaderSubFolder },
  1034. { GizmoPickingVSFile, "vs_main", GPT_VERTEX_PROGRAM, GPP_VS_3_0, "hlsl", HLSL9ShaderSubFolder },
  1035. { GizmoPickingPSFile, "ps_main", GPT_FRAGMENT_PROGRAM, GPP_FS_3_0, "hlsl", HLSL9ShaderSubFolder },
  1036. { GizmoPickingAlphaVSFile, "vs_main", GPT_VERTEX_PROGRAM, GPP_VS_3_0, "hlsl", HLSL9ShaderSubFolder },
  1037. { GizmoPickingAlphaPSFile, "ps_main", GPT_FRAGMENT_PROGRAM, GPP_FS_3_0, "hlsl", HLSL9ShaderSubFolder },
  1038. { SceneGridVSFile, "main", GPT_VERTEX_PROGRAM, GPP_VS_4_0, "glsl", GLSLShaderSubFolder },
  1039. { SceneGridPSFile, "main", GPT_FRAGMENT_PROGRAM, GPP_FS_4_0, "glsl", GLSLShaderSubFolder },
  1040. { ShaderDockOverlayVSFile, "main", GPT_VERTEX_PROGRAM, GPP_VS_4_0, "glsl", GLSLShaderSubFolder },
  1041. { ShaderDockOverlayPSFile, "main", GPT_FRAGMENT_PROGRAM, GPP_FS_4_0, "glsl", GLSLShaderSubFolder },
  1042. { PickingVSFile, "main", GPT_VERTEX_PROGRAM, GPP_VS_4_0, "glsl", GLSLShaderSubFolder },
  1043. { PickingPSFile, "main", GPT_FRAGMENT_PROGRAM, GPP_FS_4_0, "glsl", GLSLShaderSubFolder },
  1044. { PickingAlphaVSFile, "main", GPT_VERTEX_PROGRAM, GPP_VS_4_0, "glsl", GLSLShaderSubFolder },
  1045. { PickingAlphaPSFile, "main", GPT_FRAGMENT_PROGRAM, GPP_FS_4_0, "glsl", GLSLShaderSubFolder },
  1046. { ShaderWireGizmoVSFile, "main", GPT_VERTEX_PROGRAM, GPP_VS_4_0, "glsl", GLSLShaderSubFolder },
  1047. { ShaderWireGizmoPSFile, "main", GPT_FRAGMENT_PROGRAM, GPP_FS_4_0, "glsl", GLSLShaderSubFolder },
  1048. { ShaderSolidGizmoVSFile, "main", GPT_VERTEX_PROGRAM, GPP_VS_4_0, "glsl", GLSLShaderSubFolder },
  1049. { ShaderSolidGizmoPSFile, "main", GPT_FRAGMENT_PROGRAM, GPP_FS_4_0, "glsl", GLSLShaderSubFolder },
  1050. { ShaderIconGizmo0VSFile, "main", GPT_VERTEX_PROGRAM, GPP_VS_4_0, "glsl", GLSLShaderSubFolder },
  1051. { ShaderIconGizmo0PSFile, "main", GPT_FRAGMENT_PROGRAM, GPP_FS_4_0, "glsl", GLSLShaderSubFolder },
  1052. { ShaderIconGizmo1VSFile, "main", GPT_VERTEX_PROGRAM, GPP_VS_4_0, "glsl", GLSLShaderSubFolder },
  1053. { ShaderIconGizmo1PSFile, "main", GPT_FRAGMENT_PROGRAM, GPP_FS_4_0, "glsl", GLSLShaderSubFolder },
  1054. { GizmoPickingVSFile, "main", GPT_VERTEX_PROGRAM, GPP_VS_4_0, "glsl", GLSLShaderSubFolder },
  1055. { GizmoPickingPSFile, "main", GPT_FRAGMENT_PROGRAM, GPP_FS_4_0, "glsl", GLSLShaderSubFolder },
  1056. { GizmoPickingAlphaVSFile, "main", GPT_VERTEX_PROGRAM, GPP_VS_4_0, "glsl", GLSLShaderSubFolder },
  1057. { GizmoPickingAlphaPSFile, "main", GPT_FRAGMENT_PROGRAM, GPP_FS_4_0, "glsl", GLSLShaderSubFolder },
  1058. };
  1059. if (FileSystem::exists(DefaultSkinFolderRaw))
  1060. {
  1061. FileSystem::remove(DefaultSkinFolder);
  1062. for (auto& tex : GUI_TEXTURES)
  1063. importGUITexture(tex);
  1064. {
  1065. Path fontPath = FileSystem::getWorkingDirectoryPath();
  1066. fontPath.append(DefaultSkinFolderRaw);
  1067. fontPath.append(DefaultFontFilename);
  1068. ImportOptionsPtr fontImportOptions = Importer::instance().createImportOptions(fontPath);
  1069. if (rtti_is_of_type<FontImportOptions>(fontImportOptions))
  1070. {
  1071. FontImportOptions* importOptions = static_cast<FontImportOptions*>(fontImportOptions.get());
  1072. Vector<UINT32> fontSizes;
  1073. fontSizes.push_back(DefaultFontSize);
  1074. importOptions->setFontSizes(fontSizes);
  1075. importOptions->setAntialiasing(false);
  1076. }
  1077. HFont font = Importer::instance().import<Font>(fontPath, fontImportOptions);
  1078. Path outputPath = FileSystem::getWorkingDirectoryPath();
  1079. outputPath.append(DefaultSkinFolder);
  1080. outputPath.append(DefaultFontFilename + L".asset");
  1081. Resources::instance().save(font, outputPath, true);
  1082. // Save font texture pages as well. TODO - Later maybe figure out a more automatic way to do this
  1083. const FontData* fontData = font->getFontDataForSize(DefaultFontSize);
  1084. Path texPageOutputPath = FileSystem::getWorkingDirectoryPath();
  1085. texPageOutputPath.append(DefaultSkinFolder);
  1086. UINT32 pageIdx = 0;
  1087. for (auto tex : fontData->texturePages)
  1088. {
  1089. texPageOutputPath.setFilename(DefaultFontFilename + L"_texpage_" + toWString(pageIdx) + L".asset");
  1090. Resources::instance().save(tex, texPageOutputPath, true);
  1091. }
  1092. }
  1093. }
  1094. if (FileSystem::exists(DefaultShaderFolderRaw))
  1095. {
  1096. Path shaderFolder = DefaultShaderFolder;
  1097. shaderFolder.append(mActiveShaderSubFolder);
  1098. FileSystem::remove(shaderFolder);
  1099. for (auto& importData : GPU_PROGRAM_IMPORT_DATA)
  1100. {
  1101. if (importData.folder != mActiveShaderSubFolder)
  1102. continue;
  1103. Path gpuProgInputLoc = DefaultShaderFolderRaw;
  1104. gpuProgInputLoc.append(importData.folder);
  1105. gpuProgInputLoc.append(importData.filename);
  1106. Path gpuProgOutputLoc = DefaultShaderFolder;
  1107. gpuProgOutputLoc.append(importData.folder);
  1108. gpuProgOutputLoc.append(importData.filename + L".asset");
  1109. ImportOptionsPtr gpuProgImportOptions = Importer::instance().createImportOptions(gpuProgInputLoc);
  1110. if (rtti_is_of_type<GpuProgramImportOptions>(gpuProgImportOptions))
  1111. {
  1112. GpuProgramImportOptions* importOptions = static_cast<GpuProgramImportOptions*>(gpuProgImportOptions.get());
  1113. importOptions->setEntryPoint(importData.entryPoint);
  1114. importOptions->setLanguage(importData.language);
  1115. importOptions->setProfile(importData.profile);
  1116. importOptions->setType(importData.type);
  1117. }
  1118. HGpuProgram gpuProgram = Importer::instance().import<GpuProgram>(gpuProgInputLoc, gpuProgImportOptions);
  1119. Resources::instance().save(gpuProgram, gpuProgOutputLoc, true);
  1120. }
  1121. }
  1122. Resources::instance().unloadAllUnused();
  1123. }
  1124. void BuiltinEditorResources::importGUITexture(const WString& name)
  1125. {
  1126. Path texturePath = FileSystem::getWorkingDirectoryPath();
  1127. texturePath.append(DefaultSkinFolderRaw);
  1128. texturePath.append(name);
  1129. Path texOutputPath = FileSystem::getWorkingDirectoryPath();
  1130. texOutputPath.append(DefaultSkinFolder);
  1131. Path spriteTexOutputPath = texOutputPath;
  1132. texOutputPath.append(name + L".asset");
  1133. spriteTexOutputPath.append(L"sprite_" + name + L".asset");
  1134. HTexture tex = Importer::instance().import<Texture>(texturePath);
  1135. Resources::instance().save(tex, texOutputPath, true);
  1136. HSpriteTexture spriteTex = SpriteTexture::create(tex);
  1137. Resources::instance().save(spriteTex, spriteTexOutputPath, true);
  1138. }
  1139. HSpriteTexture BuiltinEditorResources::getGUITexture(const WString& name)
  1140. {
  1141. Path texturePath = FileSystem::getWorkingDirectoryPath();
  1142. texturePath.append(DefaultSkinFolder);
  1143. texturePath.append(L"sprite_" + name + L".asset");
  1144. return Resources::instance().load<SpriteTexture>(texturePath);
  1145. }
  1146. HGpuProgram BuiltinEditorResources::getGpuProgram(const WString& name)
  1147. {
  1148. Path programPath = DefaultShaderFolder;
  1149. programPath.append(mActiveShaderSubFolder);
  1150. programPath.append(name + L".asset");
  1151. return gResources().load<GpuProgram>(programPath);
  1152. }
  1153. void BuiltinEditorResources::initDockDropOverlayShader()
  1154. {
  1155. HGpuProgram vsProgram = getGpuProgram(ShaderDockOverlayVSFile);
  1156. HGpuProgram psProgram = getGpuProgram(ShaderDockOverlayPSFile);
  1157. BLEND_STATE_DESC desc;
  1158. desc.renderTargetDesc[0].blendEnable = true;
  1159. desc.renderTargetDesc[0].srcBlend = BF_SOURCE_ALPHA;
  1160. desc.renderTargetDesc[0].dstBlend = BF_INV_SOURCE_ALPHA;
  1161. desc.renderTargetDesc[0].blendOp = BO_ADD;
  1162. HBlendState blendState = BlendState::create(desc);
  1163. DEPTH_STENCIL_STATE_DESC depthStateDesc;
  1164. depthStateDesc.depthReadEnable = false;
  1165. depthStateDesc.depthWriteEnable = false;
  1166. HDepthStencilState depthState = DepthStencilState::create(depthStateDesc);
  1167. PASS_DESC passDesc;
  1168. passDesc.vertexProgram = vsProgram;
  1169. passDesc.fragmentProgram = psProgram;
  1170. passDesc.blendState = blendState;
  1171. passDesc.depthStencilState = depthState;
  1172. PassPtr newPass = Pass::create(passDesc);
  1173. TechniquePtr newTechnique = Technique::create(mActiveRenderSystem, RendererInvariant, { newPass });
  1174. SHADER_DESC shaderDesc;
  1175. shaderDesc.addParameter("invViewportWidth", "invViewportWidth", GPDT_FLOAT1);
  1176. shaderDesc.addParameter("invViewportHeight", "invViewportHeight", GPDT_FLOAT1);
  1177. shaderDesc.addParameter("tintColor", "tintColor", GPDT_FLOAT4);
  1178. shaderDesc.addParameter("highlightColor", "highlightColor", GPDT_FLOAT4);
  1179. shaderDesc.addParameter("highlightActive", "highlightActive", GPDT_FLOAT4);
  1180. mShaderDockOverlay = Shader::create("DockDropOverlayShader", shaderDesc, { newTechnique });
  1181. }
  1182. void BuiltinEditorResources::initSceneGridShader()
  1183. {
  1184. HGpuProgram vsProgram = getGpuProgram(SceneGridVSFile);
  1185. HGpuProgram psProgram = getGpuProgram(SceneGridPSFile);
  1186. BLEND_STATE_DESC blendDesc;
  1187. blendDesc.renderTargetDesc[0].blendEnable = true;
  1188. blendDesc.renderTargetDesc[0].srcBlend = BF_SOURCE_ALPHA;
  1189. blendDesc.renderTargetDesc[0].dstBlend = BF_INV_SOURCE_ALPHA;
  1190. blendDesc.renderTargetDesc[0].blendOp = BO_ADD;
  1191. blendDesc.renderTargetDesc[0].renderTargetWriteMask = 0x7; // Don't write to alpha
  1192. HBlendState blendState = BlendState::create(blendDesc);
  1193. RASTERIZER_STATE_DESC rasterizerDesc;
  1194. rasterizerDesc.cullMode = CULL_NONE;
  1195. HRasterizerState rasterizerState = RasterizerState::create(rasterizerDesc);
  1196. PASS_DESC passDesc;
  1197. passDesc.vertexProgram = vsProgram;
  1198. passDesc.fragmentProgram = psProgram;
  1199. passDesc.blendState = blendState;
  1200. passDesc.rasterizerState = rasterizerState;
  1201. PassPtr newPass = Pass::create(passDesc);
  1202. TechniquePtr newTechnique = Technique::create(mActiveRenderSystem, RendererInvariant, { newPass });
  1203. SHADER_DESC shaderDesc;
  1204. shaderDesc.addParameter("matViewProj", "matViewProj", GPDT_MATRIX_4X4);
  1205. mShaderSceneGrid = Shader::create("SceneGridShader", shaderDesc, { newTechnique });
  1206. }
  1207. void BuiltinEditorResources::initPickingShader(CullingMode cullMode)
  1208. {
  1209. UINT32 modeIdx = (UINT32)cullMode;
  1210. HGpuProgram vsProgram = getGpuProgram(PickingVSFile);
  1211. HGpuProgram psProgram = getGpuProgram(PickingPSFile);
  1212. RASTERIZER_STATE_DESC rasterizerDesc;
  1213. rasterizerDesc.scissorEnable = true;
  1214. rasterizerDesc.cullMode = cullMode;
  1215. HRasterizerState rasterizerState = RasterizerState::create(rasterizerDesc);
  1216. PASS_DESC passDesc;
  1217. passDesc.vertexProgram = vsProgram;
  1218. passDesc.fragmentProgram = psProgram;
  1219. passDesc.rasterizerState = rasterizerState;
  1220. PassPtr newPass = Pass::create(passDesc);
  1221. TechniquePtr newTechnique = Technique::create(mActiveRenderSystem, RendererInvariant, { newPass });
  1222. SHADER_DESC shaderDesc;
  1223. shaderDesc.addParameter("colorIndex", "colorIndex", GPDT_FLOAT4);
  1224. shaderDesc.addParameter("matWorldViewProj", "matWorldViewProj", GPDT_MATRIX_4X4);
  1225. mShaderPicking[modeIdx] = Shader::create("PickingShader", shaderDesc, { newTechnique });
  1226. }
  1227. void BuiltinEditorResources::initPickingAlphaShader(CullingMode cullMode)
  1228. {
  1229. UINT32 modeIdx = (UINT32)cullMode;
  1230. HGpuProgram vsProgram = getGpuProgram(PickingAlphaVSFile);
  1231. HGpuProgram psProgram = getGpuProgram(PickingAlphaPSFile);
  1232. RASTERIZER_STATE_DESC rasterizerDesc;
  1233. rasterizerDesc.scissorEnable = true;
  1234. rasterizerDesc.cullMode = cullMode;
  1235. HRasterizerState rasterizerState = RasterizerState::create(rasterizerDesc);
  1236. PASS_DESC passDesc;
  1237. passDesc.vertexProgram = vsProgram;
  1238. passDesc.fragmentProgram = psProgram;
  1239. passDesc.rasterizerState = rasterizerState;
  1240. PassPtr newPass = Pass::create(passDesc);
  1241. TechniquePtr newTechnique = Technique::create(mActiveRenderSystem, RendererInvariant, { newPass });
  1242. SHADER_DESC shaderDesc;
  1243. shaderDesc.addParameter("mainTexSamp", "mainTexSamp", GPOT_SAMPLER2D);
  1244. shaderDesc.addParameter("mainTexSamp", "mainTexture", GPOT_SAMPLER2D);
  1245. shaderDesc.addParameter("mainTexture", "mainTexture", GPOT_TEXTURE2D);
  1246. shaderDesc.addParameter("alphaCutoff", "alphaCutoff", GPDT_FLOAT1);
  1247. shaderDesc.addParameter("colorIndex", "colorIndex", GPDT_FLOAT4);
  1248. shaderDesc.addParameter("matWorldViewProj", "matWorldViewProj", GPDT_MATRIX_4X4);
  1249. mShaderPickingAlpha[modeIdx] = Shader::create("PickingAlphaShader", shaderDesc, { newTechnique });
  1250. }
  1251. void BuiltinEditorResources::initWireGizmoShader()
  1252. {
  1253. HGpuProgram vsProgram = getGpuProgram(ShaderWireGizmoVSFile);
  1254. HGpuProgram psProgram = getGpuProgram(ShaderWireGizmoPSFile);
  1255. PASS_DESC passDesc;
  1256. passDesc.vertexProgram = vsProgram;
  1257. passDesc.fragmentProgram = psProgram;
  1258. PassPtr newPass = Pass::create(passDesc);
  1259. TechniquePtr newTechnique = Technique::create(mActiveRenderSystem, RendererInvariant, { newPass });
  1260. SHADER_DESC shaderDesc;
  1261. shaderDesc.addParameter("matViewProj", "matViewProj", GPDT_MATRIX_4X4);
  1262. mShaderGizmoWire = Shader::create("GizmoWire", shaderDesc, { newTechnique });
  1263. }
  1264. void BuiltinEditorResources::initSolidGizmoShader()
  1265. {
  1266. HGpuProgram vsProgram = getGpuProgram(ShaderSolidGizmoVSFile);
  1267. HGpuProgram psProgram = getGpuProgram(ShaderSolidGizmoPSFile);
  1268. PASS_DESC passDesc;
  1269. passDesc.vertexProgram = vsProgram;
  1270. passDesc.fragmentProgram = psProgram;
  1271. PassPtr newPass = Pass::create(passDesc);
  1272. TechniquePtr newTechnique = Technique::create(mActiveRenderSystem, RendererInvariant, { newPass });
  1273. SHADER_DESC shaderDesc;
  1274. shaderDesc.addParameter("matViewProj", "matViewProj", GPDT_MATRIX_4X4);
  1275. mShaderGizmoSolid = Shader::create("GizmoSolid", shaderDesc, { newTechnique });
  1276. }
  1277. void BuiltinEditorResources::initWireHandleShader()
  1278. {
  1279. HGpuProgram vsProgram = getGpuProgram(ShaderWireGizmoVSFile);
  1280. HGpuProgram psProgram = getGpuProgram(ShaderWireGizmoPSFile);
  1281. DEPTH_STENCIL_STATE_DESC depthStencilStateDesc;
  1282. depthStencilStateDesc.depthWriteEnable = false;
  1283. depthStencilStateDesc.depthReadEnable = false;
  1284. HDepthStencilState depthStencilState = DepthStencilState::create(depthStencilStateDesc);
  1285. BLEND_STATE_DESC blendDesc;
  1286. blendDesc.renderTargetDesc[0].blendEnable = true;
  1287. blendDesc.renderTargetDesc[0].srcBlend = BF_SOURCE_ALPHA;
  1288. blendDesc.renderTargetDesc[0].dstBlend = BF_INV_SOURCE_ALPHA;
  1289. blendDesc.renderTargetDesc[0].blendOp = BO_ADD;
  1290. HBlendState blendState = BlendState::create(blendDesc);
  1291. PASS_DESC passDesc;
  1292. passDesc.vertexProgram = vsProgram;
  1293. passDesc.fragmentProgram = psProgram;
  1294. passDesc.depthStencilState = depthStencilState;
  1295. passDesc.blendState = blendState;
  1296. PassPtr newPass = Pass::create(passDesc);
  1297. TechniquePtr newTechnique = Technique::create(mActiveRenderSystem, RendererInvariant, { newPass });
  1298. SHADER_DESC shaderDesc;
  1299. shaderDesc.addParameter("matViewProj", "matViewProj", GPDT_MATRIX_4X4);
  1300. mShaderHandleWire = Shader::create("HandleWire", shaderDesc, { newTechnique });
  1301. }
  1302. void BuiltinEditorResources::initSolidHandleShader()
  1303. {
  1304. HGpuProgram vsProgram = getGpuProgram(ShaderSolidGizmoVSFile);
  1305. HGpuProgram psProgram = getGpuProgram(ShaderSolidGizmoPSFile);
  1306. DEPTH_STENCIL_STATE_DESC depthStencilStateDesc;
  1307. depthStencilStateDesc.depthWriteEnable = false;
  1308. depthStencilStateDesc.depthReadEnable = false;
  1309. HDepthStencilState depthStencilState = DepthStencilState::create(depthStencilStateDesc);
  1310. BLEND_STATE_DESC blendDesc;
  1311. blendDesc.renderTargetDesc[0].blendEnable = true;
  1312. blendDesc.renderTargetDesc[0].srcBlend = BF_SOURCE_ALPHA;
  1313. blendDesc.renderTargetDesc[0].dstBlend = BF_INV_SOURCE_ALPHA;
  1314. blendDesc.renderTargetDesc[0].blendOp = BO_ADD;
  1315. HBlendState blendState = BlendState::create(blendDesc);
  1316. PASS_DESC passDesc;
  1317. passDesc.vertexProgram = vsProgram;
  1318. passDesc.fragmentProgram = psProgram;
  1319. passDesc.depthStencilState = depthStencilState;
  1320. passDesc.blendState = blendState;
  1321. PassPtr newPass = Pass::create(passDesc);
  1322. TechniquePtr newTechnique = Technique::create(mActiveRenderSystem, RendererInvariant, { newPass });
  1323. SHADER_DESC shaderDesc;
  1324. shaderDesc.addParameter("matViewProj", "matViewProj", GPDT_MATRIX_4X4);
  1325. mShaderHandleSolid = Shader::create("HandleSolid", shaderDesc, { newTechnique });
  1326. }
  1327. void BuiltinEditorResources::initIconGizmoShader()
  1328. {
  1329. HGpuProgram vsProgram0 = getGpuProgram(ShaderIconGizmo0VSFile);
  1330. HGpuProgram psProgram0 = getGpuProgram(ShaderIconGizmo0PSFile);
  1331. HGpuProgram vsProgram1 = getGpuProgram(ShaderIconGizmo1VSFile);
  1332. HGpuProgram psProgram1 = getGpuProgram(ShaderIconGizmo1PSFile);
  1333. BLEND_STATE_DESC blendDesc;
  1334. blendDesc.renderTargetDesc[0].blendEnable = true;
  1335. blendDesc.renderTargetDesc[0].srcBlend = BF_SOURCE_ALPHA;
  1336. blendDesc.renderTargetDesc[0].dstBlend = BF_INV_SOURCE_ALPHA;
  1337. blendDesc.renderTargetDesc[0].blendOp = BO_ADD;
  1338. HBlendState blendState = BlendState::create(blendDesc);
  1339. DEPTH_STENCIL_STATE_DESC depthStencilState0Desc;
  1340. depthStencilState0Desc.depthWriteEnable = false;
  1341. depthStencilState0Desc.depthComparisonFunc = CMPF_LESS_EQUAL;
  1342. HDepthStencilState depthStencilState0 = DepthStencilState::create(depthStencilState0Desc);
  1343. DEPTH_STENCIL_STATE_DESC depthStencilState1Desc;
  1344. depthStencilState1Desc.depthWriteEnable = false;
  1345. depthStencilState1Desc.depthComparisonFunc = CMPF_GREATER;
  1346. HDepthStencilState depthStencilState1 = DepthStencilState::create(depthStencilState1Desc);
  1347. PASS_DESC pass0Desc;
  1348. pass0Desc.vertexProgram = vsProgram0;
  1349. pass0Desc.fragmentProgram = psProgram0;
  1350. pass0Desc.blendState = blendState;
  1351. pass0Desc.depthStencilState = depthStencilState0;
  1352. PassPtr newPass0 = Pass::create(pass0Desc);
  1353. PASS_DESC pass1Desc;
  1354. pass1Desc.vertexProgram = vsProgram1;
  1355. pass1Desc.fragmentProgram = psProgram1;
  1356. pass1Desc.blendState = blendState;
  1357. pass1Desc.depthStencilState = depthStencilState1;
  1358. PassPtr newPass1 = Pass::create(pass1Desc);
  1359. TechniquePtr newTechnique = Technique::create(mActiveRenderSystem, RendererInvariant, { newPass0, newPass1 });
  1360. SHADER_DESC shaderDesc;
  1361. shaderDesc.addParameter("matViewProj", "matViewProj", GPDT_MATRIX_4X4);
  1362. shaderDesc.addParameter("mainTexSamp", "mainTexSamp", GPOT_SAMPLER2D);
  1363. shaderDesc.addParameter("mainTexSamp", "mainTexture", GPOT_SAMPLER2D);
  1364. shaderDesc.addParameter("mainTexture", "mainTexture", GPOT_TEXTURE2D);
  1365. mShaderGizmoIcon = Shader::create("GizmoIcon", shaderDesc, { newTechnique });
  1366. }
  1367. void BuiltinEditorResources::initGizmoPickingShader()
  1368. {
  1369. HGpuProgram vsProgram = getGpuProgram(GizmoPickingVSFile);
  1370. HGpuProgram psProgram = getGpuProgram(GizmoPickingPSFile);
  1371. RASTERIZER_STATE_DESC rasterizerDesc;
  1372. rasterizerDesc.scissorEnable = true;
  1373. HRasterizerState rasterizerState = RasterizerState::create(rasterizerDesc);
  1374. PASS_DESC passDesc;
  1375. passDesc.vertexProgram = vsProgram;
  1376. passDesc.fragmentProgram = psProgram;
  1377. passDesc.rasterizerState = rasterizerState;
  1378. PassPtr newPass = Pass::create(passDesc);
  1379. TechniquePtr newTechnique = Technique::create(mActiveRenderSystem, RendererInvariant, { newPass });
  1380. SHADER_DESC shaderDesc;
  1381. shaderDesc.addParameter("matViewProj", "matViewProj", GPDT_MATRIX_4X4);
  1382. mShaderGizmoPicking = Shader::create("GizmoPickingShader", shaderDesc, { newTechnique });
  1383. }
  1384. void BuiltinEditorResources::initGizmoPickingAlphaShader()
  1385. {
  1386. HGpuProgram vsProgram = getGpuProgram(GizmoPickingAlphaVSFile);
  1387. HGpuProgram psProgram = getGpuProgram(GizmoPickingAlphaPSFile);
  1388. RASTERIZER_STATE_DESC rasterizerDesc;
  1389. rasterizerDesc.scissorEnable = true;
  1390. HRasterizerState rasterizerState = RasterizerState::create(rasterizerDesc);
  1391. PASS_DESC passDesc;
  1392. passDesc.vertexProgram = vsProgram;
  1393. passDesc.fragmentProgram = psProgram;
  1394. passDesc.rasterizerState = rasterizerState;
  1395. PassPtr newPass = Pass::create(passDesc);
  1396. TechniquePtr newTechnique = Technique::create(mActiveRenderSystem, RendererInvariant, { newPass });
  1397. SHADER_DESC shaderDesc;
  1398. shaderDesc.addParameter("mainTexSamp", "mainTexSamp", GPOT_SAMPLER2D);
  1399. shaderDesc.addParameter("mainTexSamp", "mainTexture", GPOT_SAMPLER2D);
  1400. shaderDesc.addParameter("mainTexture", "mainTexture", GPOT_TEXTURE2D);
  1401. shaderDesc.addParameter("alphaCutoff", "alphaCutoff", GPDT_FLOAT1);
  1402. shaderDesc.addParameter("matViewProj", "matViewProj", GPDT_MATRIX_4X4);
  1403. mShaderGizmoAlphaPicking = Shader::create("GizmoPickingAlphaShader", shaderDesc, { newTechnique });
  1404. }
  1405. HMaterial BuiltinEditorResources::createDockDropOverlayMaterial() const
  1406. {
  1407. return Material::create(mShaderDockOverlay);
  1408. }
  1409. HMaterial BuiltinEditorResources::createSceneGridMaterial() const
  1410. {
  1411. return Material::create(mShaderSceneGrid);
  1412. }
  1413. HMaterial BuiltinEditorResources::createPicking(CullingMode cullMode) const
  1414. {
  1415. UINT32 modeIdx = (UINT32)cullMode;
  1416. return Material::create(mShaderPicking[modeIdx]);
  1417. }
  1418. HMaterial BuiltinEditorResources::createPickingAlpha(CullingMode cullMode) const
  1419. {
  1420. UINT32 modeIdx = (UINT32)cullMode;
  1421. return Material::create(mShaderPickingAlpha[modeIdx]);
  1422. }
  1423. HMaterial BuiltinEditorResources::createWireGizmoMat() const
  1424. {
  1425. return Material::create(mShaderGizmoWire);
  1426. }
  1427. HMaterial BuiltinEditorResources::createSolidGizmoMat() const
  1428. {
  1429. return Material::create(mShaderGizmoSolid);
  1430. }
  1431. HMaterial BuiltinEditorResources::createIconGizmoMat() const
  1432. {
  1433. return Material::create(mShaderGizmoIcon);
  1434. }
  1435. HMaterial BuiltinEditorResources::createGizmoPickingMat() const
  1436. {
  1437. return Material::create(mShaderGizmoPicking);
  1438. }
  1439. HMaterial BuiltinEditorResources::createAlphaGizmoPickingMat() const
  1440. {
  1441. return Material::create(mShaderGizmoAlphaPicking);
  1442. }
  1443. HMaterial BuiltinEditorResources::createWireHandleMat() const
  1444. {
  1445. return Material::create(mShaderHandleWire);
  1446. }
  1447. HMaterial BuiltinEditorResources::createSolidHandleMat() const
  1448. {
  1449. return Material::create(mShaderHandleSolid);
  1450. }
  1451. }