Go Back   AC3D Forums > General > AC3D General
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Display Modes
Old 29th August 2008, 09:51 AM   #1
ELRODO
Junior Member
Junior member
 
Join Date: Aug 2008
Posts: 1
Question AC3D & OpenSim // Osgrid ( Secondlife box Builder )

Hello there ppl. I'm a new user and this is my first post.
I was wondering about ac3d capabilities to import / export stuff to opensims.

I got the Builders tool Secondlife Box and Triangle for secondlife.
I was wondering if there is any way to use them in opensim / osgrid.

Please let me know!
thanks in advance
ELRODO is offline   Reply With Quote
Old 30th December 2008, 07:36 AM   #2
elrodo2kx
Junior Member
Junior member
 
Join Date: Oct 2008
Posts: 4
Default Re: AC3D & OpenSim // Osgrid ( Secondlife box Builder )

up!

Is there any update?
i need to use box and triangle creators in osgrid (opensim based)

please give me a hand and let me know if this is possible
thank you!

And have a great 2009!
elrodo2kx is offline   Reply With Quote
Old 30th December 2008, 11:53 AM   #3
Andy
Administrator
Professional user
 
Andy's Avatar
 
Join Date: Jun 2003
Posts: 4,563
Default Re: AC3D & OpenSim // Osgrid ( Secondlife box Builder )

currently there is no way to use these tools in OpenSim.
Andy is offline   Reply With Quote
Old 28th June 2009, 03:23 AM   #4
Fred Foley
Junior Member
Junior member
 
Join Date: Jun 2009
Posts: 1
Default Re: AC3D & OpenSim // Osgrid ( Secondlife box Builder )

Hi Elrodo,

Normally you should just be able to move the rezzing script from the SL rezzer object over to osgrid but for some incomprehensible reason the script provided by invis is no-modify (hence no-read) in SL, so there is no way to see the contents. Wanting the same thing as you I made one of my own for use in osgrid. I hope you can make use of it too.

First make an object called 'triangle' that has type box and size <1.3,0.5,1.3> and taper <1.0,0.0> (these are not critical). Place the following script into it:

Code:
// One time scale and shear script
// 2009 Fred Foley (fred.foley@yahoo.com or inworld at osgrid), based on
// 2007 Copyright by Shine Renoir (fb@frank-buss.de)
// Use it for whatever you want, but keep this copyright notice
// and credit my name in notecards etc., if you use it in
// closed source objects

integer handle;
integer gChannel= -42;
integer gChannel2= -666;

move(vector posn)
{
    vector last;
    do {
        last= llGetPos();
        llSetPos(posn);
    } while ((llVecDist(llGetPos(), posn) > 0.001) && (llGetPos() != last));
}

default
{
    state_entry()
    {
        handle = llListen(gChannel, "", NULL_KEY, "" );
        llSay(gChannel2, "+");
    }
    
    listen(integer channel, string name, key id, string message)
    {
        list   tokens = llCSV2List(message);
        vector pos    = llList2Vector(tokens, 0);
        vector size   = llList2Vector(tokens, 1);
        float  shear  = llList2Float (tokens, 2);
        vector colour = llList2Vector(tokens, 3);
        llSetPrimitiveParams([
            PRIM_TYPE, PRIM_TYPE_BOX,
            0,  // hollow shape
            <0.0, 1.0, 0.0>,  // cut
            0.0,  // hollow
            <0.0, 0.0, 0.0>,  // twist
            <0.0, 1.0, 0.0>,  // taper
            <shear, 0.0, 0.0>,  // top shear
            PRIM_SIZE, size
        ]);
        move(pos);
        llSetColor(colour, ALL_SIDES);
        llListenRemove(handle);
        llRemoveInventory(llGetScriptName());
    }
    
    on_rez(integer param)
    {
        llResetScript();
    }
}
Take the 'triangle' object into your inventory.

Next make an object called 'triangle builder' and put a copy of the 'triangle' object into it along with the following script:

Code:
// (C) 2009 Fred Foley (fred.foley@yahoo.com or inworld at osgrid)
// 
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
// 
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
// 
// THE SOFTWARE IS PROVIDED "AS IS". USE ENTIRELY AT YOUR OWN RISK.

float   gScale= 1.0;    // change this to scale the model uniformly

integer gNotecardNumber= 0;
string  gNotecardName= "";
integer gNotecardLine= 0;
integer gChannel= -42;
integer gChannel2= -666;
key     gQueryID;
integer gListenID;
string  gTriangleData;
vector  gBase;
integer gPrimCount= 0;

// the triangle object is a Box with scale <1.309,0.05,1.311> and taper <1.0,0.0>

drawTriangle(vector v1, vector v2, vector v3, vector colour)
{
    // 2009 Fred Foley (fred.foley@yahoo.com or inworld at osgrid), based on
    // 2007 Copyright by Shine Renoir (fb@frank-buss.de)
    // Use it for whatever you want, but keep this copyright notice
    // and credit my name in notecards etc., if you use it in
    // closed source objects
    // assuming a normal triangle: no zero area

    // make v1-v3 the longest side
    integer i = 0;
    for (i = 0; i < 2; i++) {
        float aa = llVecDist(v2, v3);
        float bb = llVecDist(v1, v3);
        float cc = llVecDist(v1, v2);
        if (aa > bb || cc > bb) {
            vector tmp = v1;
            v1 = v2;
            v2 = v3;
            v3 = tmp;
        }
    }
    
    // calculate side lengths
    float a = llVecDist(v2, v3);
    float b = llVecDist(v1, v3);
    float c = llVecDist(v1, v2);

    // b=b1+b2, a^2=h^2+b2^2, c^2=b1^2+h^2, solving:
    float b2 = (a*a + b*b - c*c)/2.0/b;
    float b1 = b - b2;
    float h = llSqrt(a*a - b2*b2);  // triangle height

    // calculate triangle height vector and shear value
    float hPosition = b1 / b;
    vector vb1 = (v3 - v1) * hPosition;
    vector vh = v2 - (v1 + vb1);
    float shear = hPosition - 0.5;

    // calculate position and rotation
    vector pos = gBase + v1 + (v3 - v1) / 2 + vh / 2;
    a= 0.05;
    if (b < 0.01) b= 0.01;
    if (h < 0.01) h= 0.01;
    if (b < a) a= b;
    if (h < a) a= h;
    vector size = <b, a, h>;
    vector up = <0.0, 1.0, 0.0>;
    rotation rot = llRotBetween(up, llVecNorm(vh));
    vector fwd = llVecNorm(v3 - v1);  // fwd is the base
    vector left = llVecNorm(vh);
    left = llVecNorm(left % fwd);  // "left" is cross product (orthogonal to base and left)
    rot = llAxes2Rot(fwd, left, fwd % left);  // calculate the needed rotation
    
    // create object
    llRezObject("triangle", gBase, ZERO_VECTOR, rot, 0);    
    // set size and shear value
    gTriangleData = llList2CSV([pos, size, shear, colour]);
}

vector adjust(vector v)
{
    return <v.x, v.z, v.y> * gScale;
}

default
{
    on_rez(integer param)
    {
        llResetScript();
    }

    state_entry()
    {
        llOwnerSay("ready");
    }

    touch_start(integer num)
    {
        gBase= llGetPos() + <0, 0, 1>;
        gListenID= llListen(gChannel2, "", NULL_KEY, "");
        gNotecardName= llGetInventoryName(INVENTORY_NOTECARD, gNotecardNumber);
        if (gNotecardName == "") llResetScript();
        llOwnerSay("reading " + gNotecardName);
        gQueryID= llGetNotecardLine(gNotecardName, gNotecardLine);
    }

    dataserver(key id, string data)
    {
        if (id == gQueryID) {
            if (EOF == data) {
                gNotecardName= llGetInventoryName(INVENTORY_NOTECARD, ++gNotecardNumber);
                if (gNotecardName == "") {
                    llListenRemove(gListenID);
                    llOwnerSay("done");
                    llResetScript();
                }
                llOwnerSay("reading " + gNotecardName);
                gNotecardLine= 0;
                gQueryID= llGetNotecardLine(gNotecardName, gNotecardLine);
            }
            else {
                if (data == "")
                    gQueryID= llGetNotecardLine(gNotecardName, ++gNotecardLine);
                else {
                    list line= llParseString2List(data, [" "], []);
                    vector v1= <llList2Float(line, 0), llList2Float(line, 1), llList2Float(line, 2)>;  v1= adjust(v1);
                    vector v2= <llList2Float(line, 3), llList2Float(line, 4), llList2Float(line, 5)>;  v2= adjust(v2);
                    vector v3= <llList2Float(line, 6), llList2Float(line, 7), llList2Float(line, 8)>;  v3= adjust(v3);
                    integer rgb= (integer)("0x" + llGetSubString(llList2String(line, 9), 2, 7));
                    vector colour= <(float)((rgb / 65536) % 256) / 255.0,
                                    (float)((rgb /   256) % 256) / 255.0,
                                    (float)((rgb /     1) % 256) / 255.0>;
                    drawTriangle(v1, v2, v3, colour);
                }
            }
        }
    }

    listen(integer channel, string name, key id, string message)
    {
        gQueryID= llGetNotecardLine(gNotecardName, ++gNotecardLine);
        llSay(gChannel, gTriangleData);
        if (++gPrimCount % 10 == 0) llOwnerSay((string)gPrimCount + " prims");
    }
}
Then place one or more notecards containing AC3D triangle data into the 'triangle builder' object and 'touch' it to begin rezzing. The notecard(s) can be called anything you like and are read in the order they appear in the contents tab. They can contain blank lines but anything else will probably have bad results. Here is the example notecard that is provided in the closed-source rezzer from invis for you to try:

Code:
0.75 1.14 1.19209e-007  0.534724 1.14 -0.494975  0.015 2.61 -8.15999e-038  0xFF00
0.534724 1.14 -0.494975  0.0150001 1.14 -0.7  0.015 2.61 -8.15999e-038  0xFFFF00
0.0150001 1.14 -0.7  -0.504723 1.14 -0.494975  0.015 2.61 -8.15999e-038  0xFF7700
-0.504723 1.14 -0.494975  -0.72 1.14 2.02342e-017  0.015 2.61 -8.15999e-038  0xFF0000
-0.72 1.14 2.02342e-017  -0.504723 1.14 0.494975  0.015 2.61 -8.15999e-038  0xA04040
-0.504723 1.14 0.494975  0.015 1.14 0.7  0.015 2.61 -8.15999e-038  0xEE80EE
0.015 1.14 0.7  0.534724 1.14 0.494975  0.015 2.61 -8.15999e-038  0x82004B
0.534724 1.14 0.494975  0.75 1.14 1.19209e-007  0.015 2.61 -8.15999e-038  0xFF
Now that we have something we can share, feel free to help me improve it!

Best,
Freddie
Fred Foley is offline   Reply With Quote
Reply

Tags
opensim, osgrid, secondlife

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



All times are GMT -4. The time now is 03:59 PM.


AC3D Forum
(C) Inivis Limited 2020