/* * Add Cube Script */ var app=new RSrsdanim(1); function SetCube() { var m=new RSmodel(false); // The model we're gonna build m.vert[0]=new RSvertex(0.0f,0.0f,0.0f); m.vert[1]=new RSvertex(100.0f,0.0f,0.0f); m.vert[2]=new RSvertex(100.0f,100.0f,0.0f); m.vert[3]=new RSvertex(0.0f,100.0f,0.0f); m.vert[4]=new RSvertex(0.0f,0.0f,100.0f); m.vert[5]=new RSvertex(100.0f,0.0f,100.0f); m.vert[6]=new RSvertex(100.0f,100.0f,100.0f); m.vert[7]=new RSvertex(0.0f,100.0f,100.0f); m.n_vert=8; // Front Face m.poly[0]=new RSpolygon(0,2,1); m.poly[0].rgb=[0xff0000,0x00ff00,0x0000ff]; m.poly[0].type=RSpolygon.PTYPE_GRADATION_COLOUR; m.poly[1]=new RSpolygon(2,0,3); m.poly[1].rgb=[0x0000ff,0x00ff00,0xff0000]; m.poly[1].type=RSpolygon.PTYPE_GRADATION_COLOUR; // Back Face m.poly[2]=new RSpolygon(4,5,6); m.poly[2].rgb=[0xff0000,0x00ff00,0x0000ff]; m.poly[2].type=RSpolygon.PTYPE_GRADATION_COLOUR; m.poly[3]=new RSpolygon(6,7,4); m.poly[3].rgb=[0x0000ff,0x00ff00,0xff0000]; m.poly[3].type=RSpolygon.PTYPE_GRADATION_COLOUR; // Top Face m.poly[4]=new RSpolygon(0,1,5); m.poly[4].rgb=[0x0000ff,0x00ff00,0xff0000]; m.poly[4].type=RSpolygon.PTYPE_GRADATION_COLOUR; m.poly[5]=new RSpolygon(0,5,4); m.poly[5].rgb=[0x0000ff,0x00ff00,0xff0000]; m.poly[5].type=RSpolygon.PTYPE_GRADATION_COLOUR; // Bottom Face m.poly[6]=new RSpolygon(6,2,3); m.poly[6].rgb=[0x0000ff,0x00ff00,0xff0000]; m.poly[6].type=RSpolygon.PTYPE_GRADATION_COLOUR; m.poly[7]=new RSpolygon(6,3,7); m.poly[7].rgb=[0x0000ff,0x00ff00,0xff0000]; m.poly[7].type=RSpolygon.PTYPE_GRADATION_COLOUR; // Left Face m.poly[8]=new RSpolygon(0,4,7); m.poly[8].rgb=[0x0000ff,0x00ff00,0xff0000]; m.poly[8].type=RSpolygon.PTYPE_GRADATION_COLOUR; m.poly[9]=new RSpolygon(0,7,3); m.poly[9].rgb=[0x0000ff,0x00ff00,0xff0000]; m.poly[9].type=RSpolygon.PTYPE_GRADATION_COLOUR; // Right Face m.poly[10]=new RSpolygon(5,1,2); m.poly[10].rgb=[0x0000ff,0x00ff00,0xff0000]; m.poly[10].type=RSpolygon.PTYPE_GRADATION_COLOUR; m.poly[11]=new RSpolygon(5,2,6); m.poly[11].rgb=[0x0000ff,0x00ff00,0xff0000]; m.poly[11].type=RSpolygon.PTYPE_GRADATION_COLOUR; m.n_poly=12; return m; } // Merge two models function MergeModels(mergeModelA,mergeModelB) { var m=new RSmodel(false); var i; var j; // merge the poly's m.poly=mergeModelA.poly.concat( mergeModelB.poly ); m.n_poly=mergeModelA.n_poly + mergeModelB.n_poly; // merge the vertices m.vert=mergeModelA.vert.concat( mergeModelB.vert ); m.n_vert=mergeModelA.n_vert + mergeModelB.n_vert; // modify the vertex id's of the merged model for(i=mergeModelA.n_poly; i