BsBuiltinEditorResources.cpp 70 KB

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