BsBuiltinEditorResources.cpp 72 KB

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