Cmdgfx - draw 3d and graphic primitives (polygons,circles etc) in cmd window (now with 24-bit RGB support!)
Posted: 15 May 2016 15:19
Here is a little something I threw together by using an old graphics engine I made and adding conversion to text.
Latest release 2023-09-03: v1.6
Where? http://www.mediafire.com/download/x2lrk ... cmdgfx.zip
Some screenshots:
Screenshots of new 24-bit RGB version cmdgfx_RGB:
Syntax:
An "ipoly" is an intersecting polygon. If lines are intersecting, the regular "poly" will not draw properly. Normally though, use "poly".
A "tpoly" is a texture-mapped polygon (not perspective-corrected). if you use another char than db, the bgcol will show through. Texture map coordinates are floating point values from 0...1, though higher values can be used to repeat the pattern.
rx,ry,rz are rotations in degrees, but for added precision a full circle is not 360 but 360*4=1440. So just multiply angles by 4.
Latest release 2023-09-03: v1.6
Where? http://www.mediafire.com/download/x2lrk ... cmdgfx.zip
Some screenshots:
Screenshots of new 24-bit RGB version cmdgfx_RGB:
Syntax:
Code: Select all
Usage: cmdgfx [operations] [flags] [fgpalette] [bgpalette]
Drawing operations (separated by &):
poly fgcol bgcol char x1,y1,x2,y2,x3,y3[,x4,y4...,y24]
ipoly fgcol bgcol char bitop x1,y1,x2,y2,x3,y3[,x4,y4...,y24]
gpoly palette x1,y1,c1,x2,y2,c2,x3,y3,c3[,x4,y4,c4...,c24]
tpoly image [-]fgcol [-]bgcol char transpchar/transpcol x1,y1,tx1,ty1,x2,y2,tx2,ty2,x3,y3,tx3,ty3[...,ty24]
image image [-]fgcol [-]bgcol char transpchar/transpcol x,y [xflip] [yflip] [w h]
box fgcol bgcol char x,y,w,h
fbox fgcol bgcol char x,y,w,h
line fgcol bgcol char x1,y1,x2,y2 [bezierPx1,bPy1[,...,bPx6,bPy6]]
pixel fgcol bgcol char x,y
circle fgcol bgcol char x,y,r
fcircle fgcol bgcol char x,y,r
ellipse fgcol bgcol char x,y,rx,ry
fellipse fgcol bgcol char x,y,rx,ry
text fgcol bgcol char string x,y
block mode[:1233] x,y,w,h x2,y2[,w2,h2[,rz]] [transpchar] [xflip] [yflip] [transform] [colExpr] [xExpr yExpr] [to|from] [mvx,mvy,mvw,mvh]
3d objectfile drawmode,drawoption[,tex_offset,tey_offset,tex_scale,tey_scale] rx[:rx2],ry[:ry2],rz[:rz2] tx[:tx2],ty[:ty2],tz[:tz2] scalex,scaley,scalez,xmod,ymod,zmod face_culling,z_culling_near,z_culling_far,z_sort_levels xpos,ypos,distance,aspect fgcol1 bgcol1 char1 [...fgcol32 bgcol32 char32]
insert file
skip
rem
Fgcol and bgcol can be specified either as decimal or hex.
Char is specified either as a char or a two-digit hexadecimal ASCII code.
For both char and fgcol+bgcol, specify ? to use existing.
Bitop: 0=Normal, 1=Or, 2=And, 3=Xor, 4=Add, 5=Sub, 6=Sub-n, 7=Normal ipoly.
Image: 256 color pcx file (first 16 colors used), or gxy file, or text file.
If a pcx file is used, transpcol should be specified, otherwise transpchar. Always set transp to -1 if transparency is not needed!
Gpoly palette follows '1233,' repeated, 1=fgcol, 2=bgcol, 3=char (all in hex).
Transform follows '1233=1233,' repeated, ?/x/- supported. Mode 0=copy, 1=move
String for text op has all _ replaced with ' '. Supports a subset of gxy codes.
Objectfile should point to either a plg, ply or obj file.
Drawmode: 0 for flat/texture, 1 for flat z-sourced, 2 for goraud-shaded z-sourced, 3 for wireframe, 4 for flat, 5=persp. correct texture/flat, 6=affine char/persp. correct color.
Drawoption: Mode 0 textured=transpchar/transpcol(-1 if not used!). Mode 0/4 flat=bitop. Mode 1/2: 0=static col, 1=even col. Mode 2: put bitop in high byte.
[flags]: 'p' preserve buffer content, 'k' return code of last keypress, 'K' wait and return key, 'e/E' suppress/pause errors,
'wn/Wn' wait/await n ms, 'M/m[wait]' return key/mouse bit pattern(see mouse examples), 'u' report key-up events for M/m,
'Zn' set projection depth, 'n' no output, 'o/O' write (/active) errorlevel to EL.dat, 'z' sleeping wait, 'S' run as server.
A "tpoly" is a texture-mapped polygon (not perspective-corrected). if you use another char than db, the bgcol will show through. Texture map coordinates are floating point values from 0...1, though higher values can be used to repeat the pattern.
rx,ry,rz are rotations in degrees, but for added precision a full circle is not 360 but 360*4=1440. So just multiply angles by 4.