This week's major concern was to search inside model and show/hide parts of the model. But I am still struggling for the previous week's work which is to merge obj files. So this week's priority tasks are repository cleanup, deployment, and merging.
Even sunday felt like I should be working. I am starting to enjoy working on OGV.
Today I finished the repository cleanup, I pulled all my changes from my fork to the BRL-CAD repository. Now there are only two branches in github repo that are master and development.
Also merged some new changes in the master branch of BRL-CAD's OGV repository. Before merging I tested it for small errors.
Today was saturday, I usually take a break on weekend but today I felt I should work. The merge problem kept bugging my head.
Regular expression seemed a valid approach now, as any parameter of ls command didn't work. So I started reading about regular expressions. How to implement them in javascript. How to design a regular expression that may match my desire
I used the site Regexr to test and modify the reqular expression. After few trials, I was able to get desired results. The regular expression that did the work was /\w*\.r/g
The basic logic of merging was done, now I had to think about implementing it in OGV codebase.
One thing I have to take care of is that I only have to merge the object files in .g file and not the objects ending with .r. So I had to think of a way to get all the files that doesn't end with .r
Currently ls command is used to list objects so I thought of some parameter of ls command that could do the required purpose. But sadly I couldn't get it working.
Today I was thinking about a bit different approach to merging the obj files. Till now I was thinking to merge the files after obj files are created. But today I saw the workflow of OGV backend and a thought appeared in my mind. What actually happens is that first the objects are listed from a .g file and then an obj file is created for each object. So I thought how about instead of merging the obj files, I should merge objects and a single obj file would be created for an entire model.
I started reading mged documentation in order to find a command that can do the required work
Came across r command and it said it can merge objects. I tried the r command manually in mged console, and created an object named everything. When converted to obj file (everything.obj) and rendered only that file in browser, luckily I got complete model.
Today I came across a mail, as per which I was given access to the BRL-CAD repo. I could start commiting in the original repository after I click on confirm invitation in mail. I did that and started looking through code of all the branches.
I deleted all the branches except master and GSOC15-merged. GSOC15-merged contained the latest OGV code, and it was the branch I was working on since the start of GSoC.
I started testing out the code on GSOC15-merged to see if it's ready to be merged into master or not.
Today I started studying how actually the g file is shown in browser. What's the exact workflow a g file undergoes for rendering itself on browser. I read some threeJs documentation, as I already knew that this was the rendering library being used in OGV. After that there's a file in OGV at server/cfs_uploader.js
All the magic happens in this file.
We are using three npm packages shell fs and child_process
to execute shell command from app.
Two shell commands are being used to convert a g file into obj file. First mged
lists all the objects in a g file, and after that a for loop executes for each object, in which g_obj
converts each object into it's respective .obj file. And also it updates the ObjFiles
collection.