Built-in raytracer?

(2 posts) (2 voices)
  • Started 8 months ago by mariustreu
  • Latest reply from c_ridley
  1. mariustreu

    enthusiast
    Joined: May '13
    Posts: 53

    Hi,

    is there any realtime raytracer that you can use?
    If so, is it working on Graficscard or only via CPU?

    How to import a text file and read out data?
    On C++ I would know how to but not on VLS.

    Kind regards and thanks in advance,
    Marius

    Posted 8 months ago #
  2. c_ridley

    member
    Joined: May '13
    Posts: 31

    This is a section of code I came across and modified to read from a .TXT file. The .TXT file is read into 3DVIA in a single block. You then have to parse the data. Your target file needs to be in root folder of your 3DVIA Studio project.

    I hope this helps.

    vkURI localFile;
    vkString str(GetStage().GetProject().GetAssetURI().GetString());
    str.Replace("RobotMotion.mpproj","points.txt");
    localFile.Create(str);

    pos_data ipos[255];
    pos_data ipos1[255];
    pos_data ipos2[255];
    pos_data ipos3[255];
    vkString iLine[255];
    vkString iLine1[255];
    vkString iLine2[255];
    vkString iLine3[255];
    int cntr = 0;

    vkAssetPtr assetFile;
    vkArray<vkResourcePtr> fileresource;

    error sloading = GetStage().LoadAsset(localFile, fileresource, &assetFile, true, true);
    if(sloading==errOk){
    vkTextResourcePtr r = fileresource[0];
    if (r) {
    vkString fileContent= r.m_Text;
    }

    // Parse file to array strings for each set of position data.
    vkString kEOLs[3]; // Possible End of lines depending of the platform.
    kEOLs[0] = "\r\n";
    kEOLs[1] = "\r";
    kEOLs[2] = "\n";

    vkString::Iterator itStart = r.m_Text.Begin();
    vkString::Iterator it = r.m_Text.Find(kEOLs[0]);

    while(it!=r.m_Text.End()){
    oLines.PushBack(r.m_Text.SubString(itStart,it));
    if (cntr <=254){
    iLine[cntr] = r.m_Text.SubString(itStart,it);
    }
    if ((cntr > 254)&(cntr<=509)){
    iLine1[cntr-255] = r.m_Text.SubString(itStart,it);
    }
    if ((cntr > 509)&(cntr<=764)){
    iLine2[cntr-510] = r.m_Text.SubString(itStart,it);
    }
    if (cntr>764){
    iLine3[cntr-765] = r.m_Text.SubString(itStart,it);
    }
    cntr=cntr+1;
    itStart = it++;
    it = r.m_Text.Find(kEOLs[0],itStart);
    }

    Posted 8 months ago #

Reply

You must log in to post.