Script
Blockly Texture Cloud Asset Example

- Project
- Texture Cloud Assets
- Author
- matas
- Created
- Jan 30, 2024, 11:49:09 AM
- Last edit
- Feb 19, 2024, 4:49:04 PM
Project
Texture Cloud Assets
In this project we demonstrate how to load Cloud image assets and create BabylonJS texture from them. Then we apply texture to material and add material on the mesh.
View full projectScript code
<xml xmlns="https://developers.google.com/blockly/xml">
<variables>
<variable id="^GqA{-4M$9kQ.d-rrI5V">file</variable>
<variable id="KiprC49|c=Qey9dr^b3[">material</variable>
<variable id=":.I8_{`VS5$!#~;3`D`Z">cubeMesh</variable>
<variable id="kFm|8k]C/Xy4hxlH#{9N">ground</variable>
</variables>
<block type="base_time_async_context" id="tAhrUodsHU7M|L9nqQ,!" x="-2071" y="-2024">
<statement name="Then">
<block type="bitbybit.babylon.scene.enableSkybox" id="3R=-+PIluBJ3pyCWj[qW">
<value name="Skybox">
<block type="bitbybit.babylon.enums.skyboxEnum" id="Ra%mS3_(%T(t*}!XDER^">
<field name="bitbybit.babylon.enums.skyboxEnum">'clearSky'</field>
</block>
</value>
<value name="Size">
<block type="math_number" id="Ge:Y8hzF`%9J=.+8glfw">
<field name="NUM">1000</field>
</block>
</value>
<value name="Blur">
<block type="math_number" id=",[M*ld-yW^c4%n+.d5^$">
<field name="NUM">0.4</field>
</block>
</value>
<value name="EnvironmentIntensity">
<block type="math_number" id="KaaQ.D5NZTguYdR?QTPv">
<field name="NUM">0.7</field>
</block>
</value>
<next>
<block type="bitbybit.babylon.scene.drawDirectionalLightNoReturn" id="V;B+G8OAET;~iD$18lvh">
<value name="Direction">
<block type="bitbybit.vector.vectorXYZ" id="#IS03BIY/*#CcKUu|Ns=">
<value name="X">
<block type="math_number" id="#_,cdruIDM`g{n`O#Oz3">
<field name="NUM">-100</field>
</block>
</value>
<value name="Y">
<block type="math_number" id="vc9f[/YhRa7$v|N%RxC3">
<field name="NUM">-100</field>
</block>
</value>
<value name="Z">
<block type="math_number" id="`|/c,R9e5RuiuH,-ZFPE">
<field name="NUM">-100</field>
</block>
</value>
</block>
</value>
<value name="Intensity">
<block type="math_number" id=";$t@m^y41gptgG,#To;#">
<field name="NUM">5</field>
</block>
</value>
<value name="Diffuse">
<block type="colour_picker" id="qW`}PjE#DrPPyugcC{J,">
<field name="COLOUR">#ffffff</field>
</block>
</value>
<value name="Specular">
<block type="colour_picker" id="+y;Qf{CyqgOITA3QPns+">
<field name="COLOUR">#ffffff</field>
</block>
</value>
<value name="ShadowGeneratorMapSize">
<block type="math_number" id="0U~0%-C,xSAys.Xg%/w1">
<field name="NUM">2056</field>
</block>
</value>
<value name="EnableShadows">
<block type="logic_boolean" id="E-f~r#?51{``An)qG4)i">
<field name="BOOL">TRUE</field>
</block>
</value>
<value name="ShadowDarkness">
<block type="math_number" id="0LR2Nzd_|kRz0.S+}{Ir">
<field name="NUM">0</field>
</block>
</value>
<next>
<block type="variables_set" id=".drFJv=?Y;OaZLs0Od;v">
<field name="VAR" id="^GqA{-4M$9kQ.d-rrI5V">file</field>
<value name="VALUE">
<block type="base_time_await_return" id="80gc-etfs?xj]E}LZ$KQ">
<value name="Promise">
<block type="bitbybit.asset.getFile" id="+iZ1`tsmYojIf^:B3;E/">
<value name="FileName">
<block type="text" id="4B9XXdMgb~48^j20b43W">
<field name="TEXT">dogs-small.jpeg</field>
</block>
</value>
</block>
</value>
</block>
</value>
<next>
<block type="variables_set" id="%#0Z^V8Bn%b6~.GzW6iV">
<field name="VAR" id="KiprC49|c=Qey9dr^b3[">material</field>
<value name="VALUE">
<block type="bitbybit.babylon.material.pbrMetallicRoughness.create" id="BDQnctCV1_LUL={)Wu[+">
<value name="Name">
<block type="text" id=",OLUYA#aOSCOO2TM(X:|">
<field name="TEXT">Custom Material</field>
</block>
</value>
<value name="BaseColor">
<block type="colour_picker" id="*CW[]D|H.-6+Hf7#hb`_">
<field name="COLOUR">#ffffff</field>
</block>
</value>
<value name="Metallic">
<block type="math_number" id="rCntc5+yi*jPVevEQM}q">
<field name="NUM">0.1</field>
</block>
</value>
<value name="Roughness">
<block type="math_number" id="S)FY=#B[3B%4kmgIZMCz">
<field name="NUM">0.9</field>
</block>
</value>
<value name="Alpha">
<block type="math_number" id="*vZd64~IT;c-KXo1r;@M">
<field name="NUM">1</field>
</block>
</value>
<value name="BackFaceCulling">
<block type="logic_boolean" id="jZ+b!z(dI~O@hLdttfff">
<field name="BOOL">TRUE</field>
</block>
</value>
<value name="ZOffset">
<block type="math_number" id="Z?#G+@8?;sQ2?0gZJ|oN">
<field name="NUM">2</field>
</block>
</value>
</block>
</value>
<next>
<block type="bitbybit.babylon.material.pbrMetallicRoughness.setBaseTexture" id="6tj9Iqbttxv~O-Xk7)*D">
<value name="Material">
<block type="variables_get" id="]tvlzYdn4,dc?LM$Oc`,">
<field name="VAR" id="KiprC49|c=Qey9dr^b3[">material</field>
</block>
</value>
<value name="BaseTexture">
<block type="bitbybit.babylon.texture.createSimple" id="cwB*--,A9pt~S^R,Vb.S">
<value name="Name">
<block type="text" id="a0Czyc*5;EVK`_xL-%z`">
<field name="TEXT">Custom Texture</field>
</block>
</value>
<value name="Url">
<block type="bitbybit.asset.createObjectURL" id="LB`g$:`]RN{yW~OZtx%n">
<value name="File">
<block type="variables_get" id="?/e1/xtJfWx.p9sbGi[5">
<field name="VAR" id="^GqA{-4M$9kQ.d-rrI5V">file</field>
</block>
</value>
</block>
</value>
<value name="InvertY">
<block type="logic_boolean" id="c6ot~I)?TG7B#;KhQF=X">
<field name="BOOL">TRUE</field>
</block>
</value>
<value name="InvertZ">
<block type="logic_boolean" id=";f0r*Cd*hBNN3PhKVV(4">
<field name="BOOL">FALSE</field>
</block>
</value>
<value name="WAng">
<block type="math_number" id="KXu1w!ad59/UQ=%hAAYd">
<field name="NUM">0</field>
</block>
</value>
<value name="UScale">
<block type="math_number" id="qEmMDy/0M%cYYXcF#Dg{">
<field name="NUM">1</field>
</block>
</value>
<value name="VScale">
<block type="math_number" id="R=~gI0aW=g-ep6;Iv1M!">
<field name="NUM">1</field>
</block>
</value>
<value name="UOffset">
<block type="math_number" id="p(`7xu50p[/X6t*(`S@O">
<field name="NUM">0</field>
</block>
</value>
<value name="VOffset">
<block type="math_number" id="3:g.(DHw0Ut:m=QgrLtQ">
<field name="NUM">0</field>
</block>
</value>
<value name="SamplingMode">
<block type="bitbybit.babylon.texture.enums.samplingModeEnum" id="_};~N@.z9V]5(D0M:)Vy">
<field name="bitbybit.babylon.texture.enums.samplingModeEnum">'nearest'</field>
</block>
</value>
</block>
</value>
<next>
<block type="base_io_console_log" id="WXVynF%bujg8M;KTCv*w">
<value name="Text">
<block type="variables_get" id="hSL)9j,1isl~Fquo1#3q">
<field name="VAR" id=":.I8_{`VS5$!#~;3`D`Z">cubeMesh</field>
</block>
</value>
<next>
<block type="variables_set" id=",To^fu:l82SLAF9QZfIb">
<field name="VAR" id=":.I8_{`VS5$!#~;3`D`Z">cubeMesh</field>
<value name="VALUE">
<block type="bitbybit.babylon.meshBuilder.createCube" id="D4_?n74j0tE!%u/oI_e}">
<value name="Size">
<block type="math_number" id="Tq:m*E7MlG^ssil]CElM">
<field name="NUM">10</field>
</block>
</value>
<value name="SideOrientation">
<block type="bitbybit.babylon.mesh.enums.sideOrientationEnum" id="fvUlj+$~6IFqI8KB*XXe">
<field name="bitbybit.babylon.mesh.enums.sideOrientationEnum">'frontside'</field>
</block>
</value>
</block>
</value>
<next>
<block type="bitbybit.babylon.mesh.moveUp" id=":gxfvj.P;od=RPqur6Gw">
<value name="BabylonMesh">
<block type="variables_get" id="FMK~oXkTBQ_|HCgd/~xW">
<field name="VAR" id=":.I8_{`VS5$!#~;3`D`Z">cubeMesh</field>
</block>
</value>
<value name="Distance">
<block type="math_number" id="~@tw4lOgnpRg.MULGWSQ">
<field name="NUM">7</field>
</block>
</value>
<next>
<block type="bitbybit.babylon.mesh.setMaterial" id="{M~IVBfCoLXFUNBaEM?l">
<value name="BabylonMesh">
<block type="variables_get" id="EpRa[0Wq,qs?5juDh7Sa">
<field name="VAR" id=":.I8_{`VS5$!#~;3`D`Z">cubeMesh</field>
</block>
</value>
<value name="Material">
<block type="variables_get" id="-_diigmDB~[LP8@b{pj#">
<field name="VAR" id="KiprC49|c=Qey9dr^b3[">material</field>
</block>
</value>
<value name="IncludeChildren">
<block type="logic_boolean" id="su-|)q.9Avb+uUjV}!9N">
<field name="BOOL">FALSE</field>
</block>
</value>
<next>
<block type="variables_set" id="1q.5`]TDxXl+3MX;Ze60">
<field name="VAR" id="kFm|8k]C/Xy4hxlH#{9N">ground</field>
<value name="VALUE">
<block type="bitbybit.babylon.meshBuilder.createSquarePlane" id="1JeFto)y0Jp*`6?bd%y]">
<value name="Size">
<block type="math_number" id="0:9]2NM*411K+It:d0!y">
<field name="NUM">40</field>
</block>
</value>
<value name="SideOrientation">
<block type="bitbybit.babylon.mesh.enums.sideOrientationEnum" id="mamFI|U,qO3jK21BA;_n">
<field name="bitbybit.babylon.mesh.enums.sideOrientationEnum">'frontside'</field>
</block>
</value>
</block>
</value>
<next>
<block type="bitbybit.babylon.mesh.pitch" id="d;pz[N^)SrpqVY775hU}">
<value name="BabylonMesh">
<block type="variables_get" id="@!5^#KD.J^,M0[k2fzw7">
<field name="VAR" id="kFm|8k]C/Xy4hxlH#{9N">ground</field>
</block>
</value>
<value name="Rotate">
<block type="math_number" id="LvbX#,dXnESSU^6`br)O">
<field name="NUM">90</field>
</block>
</value>
<next>
<block type="bitbybit.babylon.mesh.setMaterial" id="D7XvVpne2kH8;@^=YM=@">
<value name="BabylonMesh">
<block type="variables_get" id="4;m}+Zp{z8nxz]I9rngI">
<field name="VAR" id="kFm|8k]C/Xy4hxlH#{9N">ground</field>
</block>
</value>
<value name="Material">
<block type="variables_get" id="0n@lI}XS_Pc6?)CTh$Zg">
<field name="VAR" id="KiprC49|c=Qey9dr^b3[">material</field>
</block>
</value>
<value name="IncludeChildren">
<block type="logic_boolean" id="d64UI)C:*T[l^5?O1/%]">
<field name="BOOL">FALSE</field>
</block>
</value>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</statement>
</block>
</xml>
