SkylineGlobe 如何使用二次开发接口创建粒子效果

SkylineGlobe在6.6版本,ICreator66接口新增加了CreateEffect方法,用来创建粒子效果对象;

以及ITerrainEffect66对象接口,可以灵活设置粒子效果对象的相关属性;

下图是TerraExplorer Pro中对应的菜单界面:

下图是ITerrainEffect66接口的属性:

SkylineGlobe提供的示例代码:

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>ToolTitle</title>
    <meta http-equiv="X-UA-Compatible" content="IE=9" />
	<link href="css/cupertino/jquery-ui-1.10.4.custom.css" rel="stylesheet">

	<script src="js/jquery-1.10.2.js"></script>
	<script src="js/jquery-ui-1.10.4.custom.js"></script>
        <!--<script language="javascript" src="jquery-1.5.min.js"></script>-->
        <script language="javascript" src="ToolsCommon-NoJQ.js"></script>
        <link href="jquery-ui-Override.css" rel="stylesheet">    

 <link rel="StyleSheet" href="Style.css" type="text/css">
 </head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" style="border: 0;    overflow: auto; background-color: #ffffff" id="Body"  onunload="Reset(0,1)" >
<!--oncontextmenu="return false;"  onclick="bHide=true;HideOptionsNow()" > -->
       <!--<table border="0" width="100%" cellspacing="0" cellpadding="2">
        <tr>
            <td id="TopAreaTD" height="50px" width="100%" valign="middle" style="background-color: #CAD8E2">
                <table border="0" width="100%" cellspacing="0" cellpadding="0">
                    <tr>
                        <td width="12px"></td>
                        <td width="55px"><img src="ParticleEditor.ico" align="absmiddle" /></td>
                        <td id="TitleTD" align="center" class="s12b  i18n">ToolName</td>
                        <td valign="top" align="right" id="CloseHelpTd"></td>
                    </tr>
                </table>
            </td>
        </tr> 

        <tr height="1px">
            <td style="background-repeat: repeat-x;" background="Iamges/separator.gif">
            </td>
        </tr>
        <tr>
            <td>
                <br />
            </td>
        </tr>
    </table> -->
    <!--Was in place of ** in the above id="CloseHelpTd">**</td> : <img src="../CommonImg/help.gif" border="0" class="i18n" alt="help" title="help" onclick="DisplayHelpPopup6 (SGLang.i18nFile(‘help.html‘),SGLang.i18n(‘help‘))" style="cursor: pointer;">-->
    <table border="0" cellspacing="1" cellpadding="3" bgcolor="#ffffff" class="s8" width="100%">

        <tr>
            <td>
                <div id="tabs">
                  <ul>
                    <li style="list-style: none;"><a href="#tabs-1">1</a><input id="tabsCheck-1" name="tabs-1" type="checkbox" value="1" style="width:20px;" checked></li>
	                <li style="list-style: none;"><a href="#tabs-2">2</a><input id="tabsCheck-2" name="tabs-2" type="checkbox" value="2" style="width:20px;"></li>
	                <li style="list-style: none;"><a href="#tabs-3">3</a><input id="tabsCheck-3" name="tabs-3" type="checkbox" value="3" style="width:20px;"></li>
	                <li style="list-style: none;"><a href="#tabs-4">4</a><input id="tabsCheck-4" name="tabs-4" type="checkbox" value="4" style="width:20px;"></li>
                    <li style="list-style: none;"><a href="#tabs-5">5</a><input id="tabsCheck-5" name="tabs-5" type="checkbox" value="5" style="width:20px;"></li>
                  </ul>
            <div id="Div1" style="display:block"><iframe src="PropertiesSheet.html" id="tabs-1" style="width:350px; height:660px; padding:0.5em 0.5em;"></iframe></div>
            <div id="Div2" style="display:block"><iframe src="PropertiesSheet.html" id="tabs-2" style="width:350px; height:660px; padding:0.5em 0.5em;"></iframe></div>
            <div id="Div3" style="display:block"><iframe src="PropertiesSheet.html" id="tabs-3" style="width:350px; height:660px; padding:0.5em 0.5em;"></iframe></div>
            <div id="Div4" style="display:block"><iframe src="PropertiesSheet.html" id="tabs-4" style="width:350px; height:660px; padding:0.5em 0.5em;"></iframe></div>
            <div id="Div5" style="display:block"><iframe src="PropertiesSheet.html" id="tabs-5" style="width:350px; height:660px; padding:0.5em 0.5em;"></iframe></div>
                </div>
            </td>
        </tr>
        <tr id="buttonsRow">
            <td colspan="2" valign="top" class="s8b i18n" align="center">

                <button id="groupButton" class="MenuButton" onclick="AddFinishObject()"><img src="images/AddObject.gif" /><br /> <span id="startstopSpan" class="i18n">Text11</span></button>
                <button id="editButton" class="MenuButton" onclick="EditExisting(null)"><img src="images/AddObject.gif" /><br /> <span id="existingStartstopSpan" class="i18n">Text34</span></button>
            </td>
            </tr>

    </table>
	 <object id="SGWorld" classid="CLSID:3a4f9199-65a8-11d5-85c1-0001023952c1">    </object>

<script language="JavaScript">
function DetectTEMode() {
        var vMode = document.documentMode;
        var rMode = ‘IE5 Quirks Mode‘;
        if (vMode == 8) {
            rMode = ‘IE8 Standards Mode‘;
        } else if (vMode == 7) {
            rMode = ‘IE7 Strict Mode‘;
        } else if (vMode == 9) {
            rMode = ‘IE9 Strict Mode‘;
        }
        //alert(‘Rendering in: ‘ + rMode);
    }
    DetectTEMode();

var inEdit = false;
var gParticleLabel = null;
var gMaxEmmiters = 5;
var gCurrentShowIndex = 1;

//--------------
// EditExisting
function EditExisting(ObjectID) {
    //if (ObjectID === undefined) alert("EditExisting: undefined");
    if (inEdit)
        Reset(false, false);
    else LoadExistingObject(ObjectID);
}

//--------------
// LoadExistingObject
function LoadExistingObject(ObjectID) {
    var selectedItemID;
    //if (ObjectID == null) alert("LoadExistingObject: null"); 

    if (ObjectID == null)
        selectedItemID = SGWorld.ProjectTree.GetNextItem("", 10);
    else
        selectedItemID = ObjectID;

    if (selectedItemID == "") {
        alert(SGLang.i18n("Text39"));
        return;
    }
    gParticleLabel = SGWorld.ProjectTree.GetObject(selectedItemID);
    var xml = gParticleLabel.EffectXML;

    if (!xml || xml.indexOf("$$PARTICLE$$UserDefine") != 0) {
        alert(SGLang.i18n("Text36"));
        Reset(false, false);
        return;
    }
    //inEdit = true; Moved to 2nd line from the end, otherwise many updates are sent to TE while loading the XML to the propery sheets in the HTML.
    $("#existingStartstopSpan").text(SGLang.i18n("Text12"));

    xml = xml.substring(xml.indexOf("<?xml version")); //was 27 then 23

    xmlDoc = $.parseXML(xml);
    $xml = $(xmlDoc);

    //debugger;
    var frameNum = 1;
    $xml.find("Particle>ParticleEmitter").each(function () {
        document.getElementById("tabs-" + frameNum.toString()).contentWindow.LoadParticle($(this));

        //$("#tabsCheck-" + frameNum).attr(‘checked‘, ‘checked‘);
        $("#tabsCheck-" + frameNum).prop(‘checked‘, true);
        $(‘#tabs‘).tabs("enable", frameNum-1);

        frameNum++;
    });

    for (var i = frameNum; i <= 5; i++) {

        //$("#tabsCheck-" + i).removeAttr(‘checked‘);
        $("#tabsCheck-" + i).prop(‘checked‘, false);
        $(‘#tabs‘).tabs("disable", i-1);
    }
    $(‘#tabs‘).tabs({ active: 0 });
    inEdit = true;
    UpdateParticle();
}

//--------------
// Init
function Init() {
        $("#tabs").tabs();
        $("#tabs").tabs("option", {
            //"selected": 0,
            "active":0,
            "disabled": [1, 2, 3, 4]
        });
        $("input[type=checkbox]").click(function () {
            if ($(this).is(‘:checked‘)) {
                //                $(‘#tabs‘).tabs("enable", $(this).val());
                //                $(‘#tabs‘).tabs("select", $(this).val());
                $(‘#tabs‘).tabs("enable", $(this).val());
                $(‘#tabs‘).tabs({ active: parseInt($(this).val()) - 1 });
            }
            else {
                var checkedTabs = 0;
                for (var i = 1; i <= 5; i++) {
                    if ($("#tabsCheck-" + i).prop(‘checked‘)) checkedTabs++;
                }
                if (checkedTabs == 0) {
                    $(this).prop(‘checked‘, true);
                    return;
                }
                $(‘#tabs‘).tabs("disable", $(this).val());
                //$(this).val()debugger;
                if ($("#tabs").tabs("option", "active") == ($(this).val() - 1)) {
                    for (var i = 1; i <= 5; i++) {
                        if ($("#tabsCheck-" + i).prop(‘checked‘)) {
                            $(‘#tabs‘).tabs("enable", i);
                            $(‘#tabs‘).tabs({ active: i - 1 });
                            break;
                        }
                    }
                }
            }
            UpdateParticle();
        });

    rootId = GetParamValue("rootId", "");
    groupID = -1;

    Reset(true, false);

    objectID = GetParamValue("ObjectID", "");
    if (objectID != "") {
        document.getElementById("buttonsRow").style.display="none";
        EditExisting(objectID);
    }
}

//------------------
// Reset
//------------------
function Reset(FirstTime, FromMouseInputMode) {
    try {
        inEdit = false;
        gParticleLabel = null;

        $("#startstopSpan").text(SGLang.i18n("Text11"));
        $("#existingStartstopSpan").text(SGLang.i18n("Text34"));

        if (FirstTime != 1 && FromMouseInputMode == 0) {
            //        alert("input");
            SGWorld.Window.SetInputMode(0);
        }
    }
    catch (err) { isStart = false; }
}

//--------------------
// AddFinishObject
function AddFinishObject() {
    if (inEdit)
        Reset(false, false);
    else AddNewObject();
}

//--------------------
// AddNewObject
function AddNewObject() {
    $(‘#tabs‘).tabs("refresh");
    inEdit = true;
    $("#startstopSpan").text(SGLang.i18n("Text12"));

    //Create label style
    var centerPos = SGWorld.Window.CenterPixelToWorld(-1).Position;
    centerPos.Altitude += 100;
    var labelStyle = SGWorld.Creator.CreateLabelStyle(0);
    labelStyle.LockMode = 1;
    labelStyle.Scale = 0.3;

    gParticleLabel = SGWorld.Creator.CreateEffect(centerPos);
    document.getElementById("tabs-1").contentWindow.UpdateParticle();
    UpdateParticle();

}

//-------------
//UpdateParticle
function UpdateParticle() {

    if (!inEdit)
        return;

    var colorR ;
    var colorG ;
    var colorB ;
    var size;
    var sizeRatio;
    var sizeWithRatioX;
    var sizeWithRatioY;
    var particleSpeed;
    var speedX;
    var speedY;
    var speedZ;
    var imageName ;
    var shape;
    var speedShape;
    var rotationSpeed;
    var rotationTime;
    var rotationNodeConditional;
    var randomizeRotation;
    var render;
    var gravityX;
    var gravityY;
    var gravityZ;
    var force;
    var overrideRotation;
    var scaleX;
    var scaleY;
    var scaleZ;
    var drag;
    var maxParticles ;
    var rate ;
    var timeSpan ;
    var fadeIn ;
    var fadeOut ;
    var maxFade;
    var blend;

    var particleText = "$$PARTICLE$$UserDefine: \r\n <?xml version=‘1.0‘ encoding=‘UTF-8‘?> \r\n <Particle ID=‘Custom‘>";

     for (var i = 1; i <= 5; i++)
   {

       if ($("#tabsCheck-" + i).prop(‘checked‘))
        {
            //Set label style params
            colorR = document.getElementById("tabs-"+i).contentWindow.gColorR;
            colorG = document.getElementById("tabs-"+i).contentWindow.gColorG;
            colorB = document.getElementById("tabs-"+i).contentWindow.gColorB;
            scaleX = document.getElementById("tabs-" + i).contentWindow.gScaleX;
            scaleY = document.getElementById("tabs-" + i).contentWindow.gScaleY;
            scaleZ = document.getElementById("tabs-" + i).contentWindow.gScaleZ;
            size = document.getElementById("tabs-" + i).contentWindow.gSize;
            sizeRatio = document.getElementById("tabs-" + i).contentWindow.gSizeRatio;
            particleSpeed = document.getElementById("tabs-" + i).contentWindow.gParticleSpeed;
            speedX = document.getElementById("tabs-" + i).contentWindow.gSpeedDirX;
            speedY = document.getElementById("tabs-" + i).contentWindow.gSpeedDirY;
            speedZ = document.getElementById("tabs-" + i).contentWindow.gSpeedDirZ;
            imageName = document.getElementById("tabs-"+i).contentWindow.gImageName;
            shape = document.getElementById("tabs-" + i).contentWindow.gShape;
            speedShape = document.getElementById("tabs-" + i).contentWindow.gSpeedShape;
            rotationSpeed = document.getElementById("tabs-" + i).contentWindow.gRotationSpeed;
            rotationTime = document.getElementById("tabs-" + i).contentWindow.gRotationTime;
            randomizeRotation = document.getElementById("tabs-" + i).contentWindow.gRandomizeRotation;
            render = document.getElementById("tabs-" + i).contentWindow.gRender;
            gravityX = document.getElementById("tabs-" + i).contentWindow.gGravityX;
            gravityY = document.getElementById("tabs-" + i).contentWindow.gGravityY;
            gravityZ = document.getElementById("tabs-" + i).contentWindow.gGravityZ;
            force = document.getElementById("tabs-" + i).contentWindow.gForce;
            overrideRotation = document.getElementById("tabs-" + i).contentWindow.gOverrideRotation;
            drag = document.getElementById("tabs-" + i).contentWindow.gDrag;
            maxParticles = document.getElementById("tabs-"+i).contentWindow.gMaxParticles;
            rate = document.getElementById("tabs-"+i).contentWindow.gRate;
            timeSpan = document.getElementById("tabs-"+i).contentWindow.gTimeSpan;
            fadeIn = document.getElementById("tabs-"+i).contentWindow.gFadeIn;
            fadeOut = document.getElementById("tabs-"+i).contentWindow.gFadeOut;
            maxFade = document.getElementById("tabs-" + i).contentWindow.gMaxFade;
            blend = document.getElementById("tabs-" + i).contentWindow.gBlend;

            rotationNodeConditional = (rotationSpeed == 0 || rotationTime == 0) ? "" : ("<Rotation Speed=‘" + rotationSpeed + "‘ Time=‘" + rotationTime + "‘ Initial=‘" + randomizeRotation + "‘ />" + "\r\n")
            sizeWithRatioX = (sizeRatio >= 1) ? size : size / sizeRatio;
            sizeWithRatioY = (sizeRatio > 1) ? size * sizeRatio : size;

            particleText += "<ParticleEmitter ID=‘ring‘ NumParticles=‘" + maxParticles + "‘ Texture=‘" + imageName + "‘>" + "\r\n" +
              "<Emitter Rate=‘" + rate + "‘ Shape=‘" + shape + "‘ SpeedShape=‘" + speedShape + "‘ Scale=‘"+scaleX+","+scaleY+","+scaleZ+"‘ Speed=‘"+speedX+","+speedY+","+speedZ+"‘ />" + "\r\n" + // shape:(Cone, Sphere, ShellCone, ShellSphere, Ring, Disc, Cube), scale:the size of the shape in meters,  speed:(X,Alt,Z) disform the shape like it is in radius=1.
              "<Cycle Value=‘1‘ />" + "\r\n" + // 0=one time , 1=loop
              "<Sort Value=‘1‘ />" + "\r\n" +
              rotationNodeConditional+

              "<Render Value=‘" + render + "‘ />" + "\r\n" +
              "<Gravity Value=‘" + gravityX + ", " + gravityY + ", " + gravityZ + "‘ />" + "\r\n" + // Gravity in X, Altitude and Z directions
              "<Force Value=‘" + force + "‘ OverrideRotation=‘" + overrideRotation + "‘ />" + "\r\n" + // Gravity in X, Altitude and Z directions
              "<Position Value=‘0, 0, 0‘ />" + "\r\n" + // doesn;t work
              "<Life Value=‘" + timeSpan + "‘ />" + "\r\n" + // life of each particle in seconds
              "<Speed Value=‘" + particleSpeed + "‘ />" + "\r\n" + // this value multiply the Emitter speed values (x,y,z)
              "<Color Value=‘20," + colorR + "," + colorG + "," + colorB + "‘ />" + "\r\n" +
              "<Size Value=‘" + sizeWithRatioX /*size*/ + "," + sizeWithRatioY /*size * sizeRatio*/ + "‘ />" + "\r\n" + // size of the particle image 1=original image size. Format: SizeX, SizeY
              "<Drag Value=‘" + drag + "‘ />" + "\r\n" + // drag force (units like graviy)
              "<Blend Type=‘" + blend + "‘ />" + "\r\n" +
            //***   "<Rotation Speed=‘0‘ Time=‘1.7‘ />" + "\r\n" + // optional: should be in a checkbox
              "<Fade FadeIn=‘" + fadeIn + "‘ FadeOut=‘" + fadeOut + "‘ MaxFade=‘" + maxFade + "‘ />" + "\r\n" + // fade of each particle. FadeIn/fade out in seconds. Max fade - the maximum fade value (alpha 0-1)
            "</ParticleEmitter>" + "\r\n";
        }
    }

  particleText += "</Particle>";
    gParticleLabel.EffectXML = particleText;
}

</script>

</body>
</html>

<!--Sig:00000040PACTVv.HC6Si7Qa6ezNdgCsjOp1A3GSsG7PGgWx8Lk6TFiqoR8FrYSnASLeOSAllh3Z0FCCFgRBBg6LMEvQ4JmJJ-->

  

时间: 2024-11-09 02:17:08

SkylineGlobe 如何使用二次开发接口创建粒子效果的相关文章

短信猫二次开发接口支持任何一种开发语言性能稳定

此款短信猫二次开发接口基于数据库开发方式支持任一种开发语言对短信猫开发,兼容性强.开发简单方便.灵活.稳定.可以快速地使您的应用系统实现短信功能,多种接口方式供二次开发时选择,系统具备良好的可扩展性.企事业单位通过此款短信猫二次开发接口方式实现短信功能,既实现了资源的共享和有效使用,便于企业对进出信息的管理.监控和统计,同时为以后短信功能的扩展提供了便利. 短信猫二次开发接口软件运行界面如图: 在该方案中,考虑到银行是对信息安全性要求很高的行业,采用短信猫作为短信收发设备,避免了常用的通过移动互

多口短信猫设备及相应二次开发接口程序

多口短信猫是指具备同时插入多张SIM卡使用的短信猫设备,具备单口短信猫8-16倍的短信收发效率,可满足对短信发送.接收量大的客户的应用需求.同样,借助相应的短信猫开发接口程序可以将多口短信猫应用于其他系统.软件当中. 多口短信猫设备有: 8口多口短信猫池,支持同时插入8张SIM卡使用 16口多口短信猫池设备,采用独立电源,一根USB数据线连接 多口短信猫开发接口程序与单口短信猫开发有所不同,大多购买短信猫设备提供的DLL免费短信猫开发包仅支持单口短信猫设备,不支持多口短信猫,所以多口短信猫二次开

配送短信猫二次开发接口提供多种开发语言示例

免费配送的信猫二次开发接口提供有多种开发语言示例,如C#.C++.Delphi.PowerBuilder.VB.net.VC++.VisualBasic等多种开发示例方便程序开发人员开发调试.使用简单方便,将sms.dll文件拷贝到系统安装目录中的system32文件夹中,然后再根据以下接口函数说明和提供的例程源码开发,无需安装,免加密狗. 短信猫二次开发接口提供的开发语言示例有: 部分短信猫二次开发接口函数说明: 1.Sms_Connection(Com_Port As Integer,Com

邮件系统二次开发接口

邮件系统二次开发接口 TurboMail邮件服务器为企业提供大量的二次开发接口与其他业务平台进行集成或者定制邮件功能. 二次开发接口类型 TurboMail邮件系统提供全面的二次开发接口,分别有:java/ .net/ http/ webservice,企业或者集成商可以轻松制定集成方案. 1. 短信提醒功能,短信二次开发接口 TurboMail邮件系统支持短信提醒功能,企业可以使用TurboMail提供的短信二次开发接口,通过短信猫或者短信平台连接邮件服务器,实现短信通知邮件功能. 2. 彩信

?Unity 游戏开发技巧集锦之使用忍者飞镖创建粒子效果

Unity 游戏开发技巧集锦之使用忍者飞镖创建粒子效果 使用忍者飞镖创建粒子效果 游戏中,诸如烟.火.水滴.落叶等粒子效果,都可以使用粒子系统(particle system)来实现.例如,<明朝传奇>中的篝火,如图2-32所示.粒子系统的最新版本也被称做忍者飞镖(Shuriken),因为场景中添加的粒子系统酷似忍者飞镖,如图2-33所示. 图2-32  游戏中的篝火               图2-33  粒子系统,也被称为忍者飞镖 unity中粒子基本属性 在使用粒子系统前,先了解一下它

Revit二次开发 零件创建

Revit中的零件,可以将一个图元元素,分割成许多小的零件,而这些零件对原来元素的图元没影响,只会是显示一个效果,零件可以单独列入明细表.进行标记.过滤和导出. 一.不是所有元素都可以创建零件,能够创建零件的元素有以下几个: 墙(不包括叠层墙和幕墙): 基础墙: 楼板(不包括多层的形状编辑楼板): 屋顶: 天花板: 结构楼板基础: 楼板边缘: 封檐带: 檐沟: 结构框架: 柱: 结构柱. 可以进行零件创建的图元有: 二.创建零件主要通过PartUtils的几个静态方法: 1.AreElement

SkylineGlobe 如何实现二次开发加载KML文件

示例代码如下: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title></title>

手机端扫描识别车牌二次开发接口

支持android.ios等多种主流移动操作系统.Android平台提供Jar包,IOS平台提供.a静态库,该产品期初仅支持拍照识别车牌,如今技术日新月异,用手机扫描识别车牌已经不是什么难事儿.从原本的采用手机.平板电脑摄像头拍摄汽车牌照图像,转变为通过手机扫描识别车牌,此OCR软件对车牌颜色.车牌号进行识别. 技术支持:15011261084(微信同)也可百度“车牌识别王晨”了解更多 手机扫描识别车牌号的功能描述 手机扫描识别车牌号的功能SDK是我公司开发的基于移动平台的车牌识别软件开发包,支

NX二次开发-NXOPEN创建工程图表格Annotations::TableSectionBuilder *tableSectionBuilder1;

1 NX9+VS2012 2 3 4 #include <uf.h> 5 #include <uf_tabnot.h> 6 #include <NXOpen/Part.hxx> 7 #include <NXOpen/PartCollection.hxx> 8 #include <NXOpen/Session.hxx> 9 #include <NXOpen/Annotations_TableSectionCollection.hxx>