#Proposal for Brick objects for FreeBuild (The Building Game) #By: Chris (gobbles) //A Brick's actual file will contain something like this... //---------------------------------------------------------- //brick1x8x1.brk brick1x8x1 { genPrimBrick(1,8,1); } //---------------------------------------------------------- //yes, you can have more than one brick in a file, since each brick object will be loaded //seperate from one another. This will be taken care of in the C++. // //More complex bricks will need to be written out using the genSide/Top/Bottom functions. //Support functions (will be rewritten in C++) //All these functions can be accessed thru the brick's file (EX: brick2x4x3.brk) function genPrimBrick(x,y,z) { p[1] = "0 0 0"; p[2] = "x 0 0"; p[3] = "x y 0"; p[4] = "0 y 0"; p[5] = "0 0 z"; p[6] = "x 0 z"; p[7] = "x y z"; p[8] = "0 y z"; genTop(p[5],p[6],p[7],p[8]); genSide(p[6],p[5],p[1],p[2]); genSide(p[7],p[6],p[2],p[3]); genSide(p[8],p[7],p[3],p[4]); genSide(p[5],p[8],p[4],p[1]); genBottom(p[2],p[1],p[4],p[3]); } function genTop(s1,s2,s3,s4) { //Simple Quad-creation code } function genSide(s1,s2,s3,s4) { //Determines where the edges will be, then creates 5 quads, and places them //in a way that gives the appearance of the side being "beveled" } function genBottom(s1,s2,s3,s4) { //Pretty much the same code as the Side, except for a few checks to see if it's //a brick that's 1 or 2 studs wide. (These can use less polies, so //it's best to optimize everything we can) } //some other functions may be nessesary for things such as windows or permanently transparent //objects, or slopes that may require a seperate texture.