This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
Messages - Chockosta
Pages: 1 ... 12 13 [14] 15 16 ... 31
197
« on: December 11, 2011, 01:44:33 pm »
Why don't you use string.usub() instead of string.sub() ?
In my opinion, it should work
198
« on: December 10, 2011, 05:22:28 pm »
I've never had problems with on.charIn() All the problems that I've had were with string.sub() (which I just had to replace with string.usub())
199
« on: December 10, 2011, 01:21:55 pm »
This will be really, really, really useful to me. And your interface looks good. I'd just like a convenient documentation.
When I program with OCLua (really often), sometimes I just can't remember some functions.
200
« on: December 08, 2011, 01:30:25 pm »
I'm not sure I will succeed, but I will try to port my 3D engine to C, and then I'll try to make a mini-minecraft. Just because I like the idea.
And a nice TI-z80 emulator would be great. Also, maybe a java interpreter ? (like Khavi for the prizm) But since I don't know anything about ASM, I won't try to do these 2 projects.
201
« on: December 07, 2011, 03:54:39 pm »
CubeFieldhttp://www.omnimaga.org/index.php?action=downloads;sa=view;down=734This is a game inspired by CubeRunner (for smartphones), written in Lua (OS>3) Survive as long as you can without getting hit by the cubes! Every 1000 points, a corridor appears to introduce the next level, where the speed icreases.
202
« on: December 07, 2011, 07:48:22 am »
I'm not sure that 3,000 coins would be possible...
203
« on: December 06, 2011, 01:48:02 pm »
You made me spoil 20 minutes of my life
204
« on: December 04, 2011, 02:56:15 pm »
So amazing ! Congrats
205
« on: December 04, 2011, 01:08:48 pm »
I'd like to try it, but I only have a TI-83 BE and the Nspire emultor won't run it.  Anyway, it is awesome. EDIT : Nvm, I just used an emulator...
206
« on: December 04, 2011, 08:29:08 am »
Actually, the space key and delete key also repeat, but I agree with you.
BTW, a very small update, with a little bugfix. With very high values for the offset, the faces did not display right. It is now fixed.
--Lua Tiny3D - By Loic Pujet
function multiplyMatrix(matrix,vector) local x=matrix[1][1]*vector[1]+matrix[1][2]*vector[2]+matrix[1][3]*vector[3] local y=matrix[2][1]*vector[1]+matrix[2][2]*vector[2]+matrix[2][3]*vector[3] local z=matrix[3][1]*vector[1]+matrix[3][2]*vector[2]+matrix[3][3]*vector[3] return x,y,z end
function width() return platform.window:width() end function height() return platform.window:height() end
function reverseTable(tbl) local tbl2={} for i,e in ipairs(tbl) do tbl2[#tbl-i+1]=e end return tbl2 end
function replaceFaces(tbl1,tbl2,faces) local faces2,count={},1 for i,e in pairs(tbl1) do for j,e2 in pairs(tbl2) do if e2 then if e==e2 then faces2[count]=faces[j] count=count+1 tbl2[j]=nil end end end end return reverseTable(faces2) end
function sortFaces(vertices,faces,offset) local faces2,distTbl,facesTbl={},{},{} local middle={} local dist,xsum,ysum,zsum=0,0,0,0 for i,e in pairs(faces) do xsum,ysum,zsum=0,0,0,0 for j,e2 in pairs(e) do xsum,ysum,zsum=xsum+vertices[e2][1],ysum+vertices[e2][2],zsum+vertices[e2][3] end middle={xsum/#e,ysum/#e+offset,zsum/#e} dist=middle[1]*middle[1]+middle[2]*middle[2]+middle[3]*middle[3] distTbl[i]=dist facesTbl[i]=dist end table.sort(distTbl) return replaceFaces(distTbl,facesTbl,faces) end
function chooseColor(gc,vertices,face,color) if #face<3 then gc:setColorRGB(color[1],color[2],color[3]) else local a,b,c=vertices[face[1]][1]-vertices[face[2]][1],vertices[face[1]][2]-vertices[face[2]][2],vertices[face[1]][3]-vertices[face[2]][3] local d,e,f=vertices[face[1]][1]-vertices[face[3]][1],vertices[face[1]][2]-vertices[face[3]][2],vertices[face[1]][3]-vertices[face[3]][3] local normale={math.abs(b*f-c*e),math.abs(c*d-a*f),math.abs(a*e-b*d)} local angle=math.atan(math.sqrt(normale[1]*normale[1]+normale[3]*normale[3])/normale[2]) local R,G,B=color[1]+angle*-60+50,color[2]+angle*-60+50,color[3]+angle*-60+50 R,G,B=R>255 and 255 or R,G>255 and 255 or G,B>255 and 255 or B R,G,B=R<0 and 0 or R,G<0 and 0 or G,B<0 and 0 or B gc:setColorRGB(R,G,B) end end
function renderFaces(gc,vertices,faces,pos,mode,color,offset) local polygon,size,faces2={},0,{} if mode==4 or mode==5 or mode==6 then faces2=sortFaces(vertices,faces,offset) else faces2=faces end for i,e in pairs(faces2) do polygon,size={},0 drawPoly=true for j,f in pairs(faces2[i]) do if not pos[f] then drawPoly=false else polygon[j*2-1]=pos[f][1] polygon[j*2]=pos[f][2] size=size+2 end end if drawPoly then polygon[size+1]=pos[faces2[i][1]][1] polygon[size+2]=pos[faces2[i][1]][2] if mode==4 then gc:setColorRGB(color[1],color[2],color[3]) gc:fillPolygon(polygon) elseif mode==5 or mode==6 then chooseColor(gc,vertices,e,color) gc:fillPolygon(polygon) end if mode==2 or mode==3 or mode==4 or mode==5 then gc:setColorRGB(0,0,0) gc:setPen("thin","smooth") gc:drawPolyLine(polygon) end end end end
function renderVertices(gc,pos) gc:setColorRGB(0,0,0) for i,e in pairs(pos) do if e then gc:fillRect(e[1]-1,e[2]-1,3,3) end end end
----------------------------------------------------------------------------
function rotate(vertices,angle,x,y,z) local sum=x+y+z x,y,z=x/sum,y/sum,z/sum local c,s=math.cos(angle),math.sin(angle) local matrix={{x*x+(1-x*x)*c,x*y*(1-c)-z*s,x*z*(1-c)+y*s},{x*y*(1-c)+z*s,y*y+(1-y*y)*c,y*z*(1-c)-x*s},{x*z*(1-c)-y*s,y*z*(1-c)+x*s,z*z+(1-z*z)*c}} for i,e in pairs(vertices) do vertices[i]={multiplyMatrix(matrix,e)} end end
function translate(vertices,x,y,z) for i,e in pairs(vertices) do vertices[i]={e[1]+x,e[2]+y,e[3]+z} end end
function scale(vertices,x,y,z) for i,e in pairs(vertices) do vertices[i]={e[1]*x,e[2]*y,e[3]*z} end end
function render(gc,vertices,faces,mode,color,offset) local yDist,pos=0,{} for i,e in pairs(vertices) do if e[2]>-offset then yDist=offset/(e[2]+offset) pos[i]={e[1]*yDist*25+width()/2,height()/2-e[3]*yDist*25} else pos[i]=false end end if mode==1 or mode==2 then renderVertices(gc,pos) end if #faces>0 and (mode==2 or mode==3 or mode==4 or mode==5 or mode==6) then renderFaces(gc,vertices,faces,pos,mode,color,offset) end end
----------------------------------------------------------------------------
207
« on: December 04, 2011, 08:09:57 am »
I just realised that I spent days to write this useless tool... 
This is not useless, this can be made more powerful that the OS 3D graphing. Can you make it accept any functions? i.e. to insert x^2+y^2+z^2=2^2 which is an origin centered radius 2 sphere in the OS 3d graphing I've got to solve it in order to z before writing that which results in 2 equations: z(x,y)=sqrt(2^2-x^2-y^2) and z(x,y)=sqrt(2^2-x^2-y^2) it would be nice if your Tiny3D accepted any function to draw.
Actually my function drawer is really basic. It only draw one function, which has to be like z(x,y)=... I could write another one to allow that. This looks nice. You should post a tns demo so we can see how fast it is. I wonder if it could be fast enough for simple games like Star fox? I'm glad you're still working on this by the way. 
EDIT: Nvm I didn't see the zip file above the screenshots. Gonna try it soon.
I'm not sure that it's possible, but I'll try. The main problem is the key input...
208
« on: December 03, 2011, 04:49:55 pm »
Yes  Nice to see that someone use it !
209
« on: December 03, 2011, 09:58:01 am »
Okay, I'm writing a tutorial. I'll post it soon.
EDIT : Finished ! It is attached to my post. (English isn't my first language, so maybe there are mistakes) And here is the latest vesion of the engine.
--Lua Tiny3D - By Loic Pujet
function multiplyMatrix(matrix,vector) local x=matrix[1][1]*vector[1]+matrix[1][2]*vector[2]+matrix[1][3]*vector[3] local y=matrix[2][1]*vector[1]+matrix[2][2]*vector[2]+matrix[2][3]*vector[3] local z=matrix[3][1]*vector[1]+matrix[3][2]*vector[2]+matrix[3][3]*vector[3] return x,y,z end
function rotate(vertices,angle,x,y,z) local sum=x+y+z x,y,z=x/sum,y/sum,z/sum local c,s=math.cos(angle),math.sin(angle) local matrix={{x*x+(1-x*x)*c,x*y*(1-c)-z*s,x*z*(1-c)+y*s},{x*y*(1-c)+z*s,y*y+(1-y*y)*c,y*z*(1-c)-x*s},{x*z*(1-c)-y*s,y*z*(1-c)+x*s,z*z+(1-z*z)*c}} for i,e in pairs(vertices) do vertices[i]={multiplyMatrix(matrix,e)} end end
function translate(vertices,x,y,z) for i,e in pairs(vertices) do vertices[i]={e[1]+x,e[2]+y,e[3]+z} end end
function scale(vertices,x,y,z) for i,e in pairs(vertices) do vertices[i]={e[1]*x,e[2]*y,e[3]*z} end end
function width() return platform.window:width() end function height() return platform.window:height() end
function reverseTable(tbl) local tbl2={} for i,e in ipairs(tbl) do tbl2[#tbl-i+1]=e end return tbl2 end
function replaceFaces(tbl1,tbl2,faces) local faces2,count={},1 for i,e in pairs(tbl1) do for j,e2 in pairs(tbl2) do if e2 then if e==e2 then faces2[count]=faces[j] count=count+1 tbl2[j]=nil end end end end return reverseTable(faces2) end
function sortFaces(vertices,faces) local faces2,distTbl,facesTbl={},{},{} local middle={} local dist,xsum,ysum,zsum=0,0,0,0 for i,e in pairs(faces) do xsum,ysum,zsum=0,0,0,0 for j,e2 in pairs(e) do xsum,ysum,zsum=xsum+vertices[e2][1],ysum+vertices[e2][2],zsum+vertices[e2][3] end middle={xsum/#e,ysum/#e+5,zsum/#e} dist=middle[1]*middle[1]+middle[2]*middle[2]+middle[3]*middle[3] distTbl[i]=dist facesTbl[i]=dist end table.sort(distTbl) return replaceFaces(distTbl,facesTbl,faces) end
function chooseColor(gc,vertices,face,color) if #face<3 then gc:setColorRGB(color[1],color[2],color[3]) else local a,b,c=vertices[face[1]][1]-vertices[face[2]][1],vertices[face[1]][2]-vertices[face[2]][2],vertices[face[1]][3]-vertices[face[2]][3] local d,e,f=vertices[face[1]][1]-vertices[face[3]][1],vertices[face[1]][2]-vertices[face[3]][2],vertices[face[1]][3]-vertices[face[3]][3] local normale={math.abs(b*f-c*e),math.abs(c*d-a*f),math.abs(a*e-b*d)} local angle=math.atan(math.sqrt(normale[1]*normale[1]+normale[3]*normale[3])/normale[2]) local R,G,B=color[1]+angle*-60+50,color[2]+angle*-60+50,color[3]+angle*-60+50 R,G,B=R>255 and 255 or R,G>255 and 255 or G,B>255 and 255 or B R,G,B=R<0 and 0 or R,G<0 and 0 or G,B<0 and 0 or B gc:setColorRGB(R,G,B) end end
function renderFaces(gc,vertices,faces,pos,mode,color) local polygon,size,faces2={},0,{} if mode==4 or mode==5 or mode==6 then faces2=sortFaces(vertices,faces) else faces2=faces end for i,e in pairs(faces2) do polygon,size={},0 drawPoly=true for j,f in pairs(faces2[i]) do if not pos[f] then drawPoly=false else polygon[j*2-1]=pos[f][1] polygon[j*2]=pos[f][2] size=size+2 end end if drawPoly then polygon[size+1]=pos[faces2[i][1]][1] polygon[size+2]=pos[faces2[i][1]][2] if mode==4 then gc:setColorRGB(color[1],color[2],color[3]) gc:fillPolygon(polygon) elseif mode==5 or mode==6 then chooseColor(gc,vertices,e,color) gc:fillPolygon(polygon) end if mode==2 or mode==3 or mode==4 or mode==5 then gc:setColorRGB(0,0,0) gc:setPen("thin","smooth") gc:drawPolyLine(polygon) end end end end
function renderVertices(gc,pos) gc:setColorRGB(0,0,0) for i,e in pairs(pos) do if e then gc:fillRect(e[1]-1,e[2]-1,3,3) end end end
function render(gc,vertices,faces,mode,color,offset) local yDist,pos=0,{} for i,e in pairs(vertices) do if e[2]>-offset then yDist=offset/(e[2]+offset) pos[i]={e[1]*yDist*25+width()/2,height()/2-e[3]*yDist*25} else pos[i]=false end end if mode==1 or mode==2 then renderVertices(gc,pos) end if #faces>0 and (mode==2 or mode==3 or mode==4 or mode==5 or mode==6) then renderFaces(gc,vertices,faces,pos,mode,color) end end
210
« on: December 03, 2011, 09:12:05 am »
Hello ! I wrote a little 3D viewer with this engine. You can draw : - Cube - Tetrahedron - Pyramid - Cone - Torus - Sphere - Cylinder - Hypercube (tesseract) You also can draw 3D functions. (even if the OS already provides this) You can choose the color, the zoom... I just realised that I spent days to write this useless tool...  I really should create a new game. DOWNLOAD
Pages: 1 ... 12 13 [14] 15 16 ... 31
|