[code], ejemplo de rayos de sol. By yue rexie. Para aprendiz. Libre uso. http://www.iris3d, que <<<<<<<<<<<<<<. Algo que he aprendido en la vida:
Es que no es necesario ir a una escuela para aprender.
Lo que realmente nos gusta.
Joder nadie me cree. Y soy como el perro que ha visto el arcoiris.
Graphics3d 800,600,32,2.
Setbuffer backbuffer().
Camera=createcamera ().
Translateentity Camera,0,0,-12.
Wall=createcube ().
Walltex=loadtexture (estone19.jpg).
Entitytexture wall,walltex.
Entitycolor wall,110,110,110, a bit darker por favor.
Scaleentity wall,7,6,7.
Translateentity wall,6.9,0,0.
Flipmesh wall.
Window=createsunbeams(churchwin3.jpg,40,5,5,1.0,-1.0,10.0,1,1).
Scaleentity window,1,4,2.
Entityparent wall,window.
While not keydown(1) Tang#=(ang#+1) mod 180 trotateentity window,0, ang-180,0 trenderworld() ttext 0,0,tris rendered: +trisrendered() tflip.
Wend.
End.
Function createsunbeams(texpath$, transparent=40, numsurfx#=5, numsurfy#=5, zoom#=1.0, height#=-1.0, Lenght#=3.0, ertical_on=1, horizontal_on=1) ttex=loadtexture (texpath$) ttex2=loadtexture (texpath$,2) t tsetbuffer texturebuffer(tex2) tloockbuffer() tfor j=0 todo textureheight(tex2)-1 for i=0 todo texturewidth(tex2)-1 rgb=readpixelfast(i,) and $f r=(rgb and $f0000) shr 16 g=(rgb and $f00) shr 8 b=(rgb and $f) minv=128 if r>minv or g>minv or b>minv then a = transparent shl 24 else a=0 endif r=r*3 g=g*3 b=b*3 if r>255 then r=255 if g>255 then g=255 if b>255 then b=255 argb=a or (r shl 16) or (g shl or b writepixelfast i, argb next tnext tunlockbuffer() tsetbuffer backbuffer() t twin=createquad() tentitytexture win, TeX tentityfx win,1 t tmesh=createmesh() tsurf=createsurface (Mesh) t tif vertical_on for i=0 todo numsurfx# where#=(((float(i)-numsurfx)/numsurfx)*2.0)+1.0 wherev#=(where#+1.0)/2.0 v0=addvertex(surf,-1.0,-1.0,where#,wherev,1.0) v1=addvertex(surf, 1.0*Lenght,-1.0+height,where#,wherev,1.0) v2=addvertex(surf, 1.0*Lenght,1.0+height,where#,wherev,0.0) v3=addvertex(surf,-1,1.0,where#,wherev,0.0) Vertex Color surf, 0, 255,255,255,1 Vertex Color surf, 1, 0,0,0,0 Vertex Color surf, 2, 0,0,0,0 Vertex Color surf, 3, 255,255,255,1 addtriangle (surf, 0, 1, 2) addtriangle (surf, 2, 3, 0) next tendif t tif horizontal_on for i=0 todo numsurfy# where#=(((float(i)-numsurfy)/numsurfy)*2.0)+1.0 wherev#=(where#+1.0)/2.0 v0=addvertex(surf,-1.0,where#,-1,1,-wherev) v1=addvertex(surf, 1.0*Lenght,where#*zoom+height,-1,1,-wherev) v2=addvertex(surf, 1.0*Lenght,where#*zoom+height,1,0,-wherev) v3=addvertex(surf,-1.0,where#, 1,0,-wherev) Vertex Color surf, 0, 255,255,255,1 Vertex Color surf, 1, 0,0,0,0 Vertex Color surf, 2, 0,0,0,0 Vertex Color surf, 3, 255,255,255,1 addtriangle (surf, 0, 1, 2) addtriangle (surf, 2, 3, 0) next tendif tupdatenormals Mesh tentityfx Mesh,16 or 1 or 2 tentitytexture Mesh, tex2.
Entityblend Mesh,3 ttranslateentity Mesh,1,0,0 tentityparent Mesh,win treturn Windows.
End function.
Function createquad() tmesh=createmesh() tsurf=createsurface (Mesh) tv0=addvertex(surf,0, -1.0, -1.0, 0,1) TV1=addvertex(surf,0, 1.0, -1.0, 0,0) tv2=addvertex(surf,0, 1.0, 1.0, 1,0) TV3=addvertex(surf,0, -1.0, 1.0, 1,1) taddtriangle (surf, 0, 1, 2) taddtriangle (surf, 2, 3, 0) tupdatenormals Mesh treturn Mesh.
End function[/code]
🖼️
Estamos trabajando para mostrar las imágenes del foro
Adjunto #149023
Aquí va el dodigo.
-- IMÁGENES ADJUNTAS --
🖼️
Estamos trabajando para mostrar las imágenes del foro
Adjunto #149023