mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-04-26 14:55:39 +00:00
gui offscreen material test
added interaction static guioffscreencanvas to capture mouse events added test shape
This commit is contained in:
parent
a276ad2505
commit
6f9c4158d8
10 changed files with 190 additions and 7 deletions
|
|
@ -0,0 +1,11 @@
|
|||
<ImageAsset
|
||||
AssetName="ScreenTarget"
|
||||
imageFile="@assetFile=#screen_Canvas"
|
||||
VersionId="1">
|
||||
<ImageAsset.ImageMetadata>
|
||||
<ImageInfo
|
||||
ImageWidth="-1"
|
||||
ImageHeight="-1"
|
||||
ImageDepth="-1"/>
|
||||
</ImageAsset.ImageMetadata>
|
||||
</ImageAsset>
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
<MaterialAsset
|
||||
AssetName="monitor_base_mat"
|
||||
materialDefinitionName="monitor_base_mat">
|
||||
<Material
|
||||
Name="monitor_base_mat"
|
||||
mapTo="monitor_base_mat"
|
||||
originalAssetName="monitor_base_mat">
|
||||
<Material.Stages>
|
||||
<Stages_beginarray
|
||||
DiffuseColor="0 0 0 1"/>
|
||||
</Material.Stages>
|
||||
</Material>
|
||||
</MaterialAsset>
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
<MaterialAsset
|
||||
AssetName="monitor_screen_mat"
|
||||
materialDefinitionName="monitor_screen_mat">
|
||||
<Material
|
||||
Name="monitor_screen_mat"
|
||||
mapTo="monitor_screen_mat"
|
||||
originalAssetName="monitor_base_mat">
|
||||
<Material.Stages>
|
||||
<Stages_beginarray
|
||||
DiffuseMapAsset="@asset=Prototyping:ScreenTarget"
|
||||
IgnoreLighting="true"/>
|
||||
<Stages_beginarray
|
||||
DiffuseColor="White"/>
|
||||
</Material.Stages>
|
||||
</Material>
|
||||
</MaterialAsset>
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
<ShapeAsset
|
||||
AssetName="monitor_shape"
|
||||
fileName="@assetFile=monitor_shape.fbx"
|
||||
constuctorFileName="@assetFile=monitor_shape.tscript"
|
||||
materialSlot0="@asset=Prototyping:monitor_base_mat"
|
||||
materialSlot1="@asset=Prototyping:monitor_screen_mat"/>
|
||||
Binary file not shown.
|
|
@ -0,0 +1,61 @@
|
|||
|
||||
singleton TSShapeConstructor(monitor_shapefbx)
|
||||
{
|
||||
baseShapeAsset = "Prototyping:monitor_shape";
|
||||
singleDetailSize = "0";
|
||||
neverImportMat = "DefaultMaterial ColorEffect*";
|
||||
flipUVCoords = "0";
|
||||
joinIdenticalVerts = "0";
|
||||
reverseWindingOrder = "0";
|
||||
removeRedundantMats = "0";
|
||||
animFPS = "2";
|
||||
};
|
||||
|
||||
function monitor_shapefbx::onLoad(%this)
|
||||
{
|
||||
%this.addNode("Col-1", "", "0 0 0 0 0 1 0", "0", "");
|
||||
%this.addNode("ColBox-1", "Col-1", "0 0 0 1 0 0 0", "0", "Bounds");
|
||||
%this.addCollisionDetail("-1", "Box", "Bounds", "4", "10", "30", "32", "30", "30", "30", "Flood fill");
|
||||
%this.setBounds("-0.8 -0.244957 -0.0409516 0.8 0.244957 1.10231");
|
||||
|
||||
if (!isObject(screen_Canvas))
|
||||
{
|
||||
new GuiOffscreenCanvas(screen_Canvas) {
|
||||
targetName = "screen_Canvas";
|
||||
targetSize = "1280 720";
|
||||
dynamicTarget = false;
|
||||
canInteract = true;
|
||||
maxInteractDistance = "3";
|
||||
};
|
||||
}
|
||||
|
||||
if(isObject(OptionsMenu))
|
||||
{
|
||||
screen_Canvas.setContent(OptionsMenu);
|
||||
}
|
||||
|
||||
%screen_Canvas_asset = "Prototyping:ScreenTarget";
|
||||
if(!AssetDatabase.isDeclaredAsset(%screen_Canvas_asset))
|
||||
{
|
||||
%screen_asset = new ImageAsset()
|
||||
{
|
||||
assetName = "ScreenTarget";
|
||||
versionId = 1;
|
||||
imageFile = "#screen_Canvas";
|
||||
};
|
||||
TamlWrite(%screen_asset, expandPath("^Prototyping/gui_offscreen_test/" @ %screen_asset.AssetName @ ".asset.taml"));
|
||||
%previewModule = ModuleDatabase.findModule("Prototyping",1);
|
||||
AssetDatabase.addDeclaredAsset(%previewModule, expandPath("^Prototyping/gui_offscreen_test/" @ %screen_asset.AssetName @ ".asset.taml"));
|
||||
}
|
||||
|
||||
%mat_asset = "Prototyping:monitor_screen_mat";
|
||||
if(!AssetDatabase.isDeclaredAsset(%mat_asset))
|
||||
{
|
||||
echo("Material asset not found, this should exist");
|
||||
}
|
||||
|
||||
%assetDef = AssetDatabase.acquireAsset(%mat_asset);
|
||||
%material = %assetDef.materialDefinitionName;
|
||||
%material.DiffuseMapAsset = %screen_Canvas_asset;
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue