Posted: 24th Mar 2020 15:25
If you would like to see any additional commands in Tier1, please let me know. I'm adding my own plugin code for Tier1 to return pointers and all sorts , so please shout if you have any commands in Tier1 that you would like to see as I know Tier2 is not everyone's cuppa
Posted: 24th Mar 2020 16:02
If you need a tester... PM me I can help test
Posted: 24th Mar 2020 20:40
Windows controls
Posted: 24th Mar 2020 22:27
Save object
Posted: 25th Mar 2020 3:21
This will create an .obj file from a model in memory.

It will only create verts, textures and normals. No bones or animation. Should be suitable for a static model with a texture

The example will load "track.obj" from the Documents directory and create "newtrack.obj" in the Documents directory. You can substitute your own model names

I think there is an issue with some verts not being welded. I think it has something to do with they way the verts are presented in the mem block.
So there are only two options; 1) as is or 2) nearest vert welded. The code is an as is solution.

As usual i have done very little testing so it's prolly a mine field of bugs lol.

+ Code Snippet
// Project: test113 
// Created: 20-02-22

// show all errors

SetErrorMode(2)

// set window properties
SetWindowTitle( "test113" )
SetWindowSize( 1024, 768, 0 )
SetWindowAllowResize( 1 ) // allow the user to resize the window

// set display properties
SetVirtualResolution( 1024, 768 ) // doesn't have to match the window
SetOrientationAllowed( 1, 1, 1, 1 ) // allow both portrait and landscape on mobile devices
SetSyncRate( 30, 0 ) // 30fps instead of 60 to save battery
SetScissor( 0,0,0,0 ) // use the maximum available screen space, no black borders
UseNewDefaultFonts( 1 )

SetCameraRange( 1, 1, 50000 )	

type point
	x as float
	y as float
	z as float
endtype



SetCameraPosition(1, 0, 1024, 0)
SetCameraLookAt(1, 0, 0, 0.1, 0)

global msg as string


id as integer

id = LoadObject("raw:"+GetDocumentsPath()+"/track.obj")

SaveToObj(id, 1, GetDocumentsPath()+"/newtrack.obj")

do
    Sync()
loop


function	SaveToObj(model as integer, mesh as integer, filename as string)
	id		as integer
	mem		as integer
	i		as integer
	m		as integer
	all		as tVertex[]
	c		as integer
	v		as integer
	verts	as tVertex[]
	vertex	as tVertex
	poly	as tPoly	
	offset	as integer
	p		as integer
	f		as integer
	n		as integer
	name	as string
	line	as string
	indicies as integer
	verticies as integer
	v1		as string
	v2		as string
	v3		as string		
	ext		as string
	s		as string
	
	id = CloneObject(model)
	FixObjectPivot(id)
	
	mem = CreateMemblockFromObjectMesh(id, mesh)
	
	indicies = GetIndiciesFromMemblock(mem) - 1
	verticies = GetVerticiesFromMemblock(mem) - 1		
		
	all.length = -1
	
	for v=0 to verticies
        vertex.pos.x = GetMeshMemblockVertexX(mem, v)
        vertex.pos.y = GetMeshMemblockVertexY(mem, v)
        vertex.pos.z = GetMeshMemblockVertexZ(mem, v)
        vertex.normal.x = GetMeshMemblockVertexNormalX(mem, v)
        vertex.normal.y = GetMeshMemblockVertexNormalY(mem, v)
        vertex.normal.z = GetMeshMemblockVertexNormalZ(mem, v)           
        vertex.uv.u = GetMeshMemblockVertexU(mem, v)
        vertex.uv.v = GetMeshMemblockVertexV(mem, v)
        
        all.insert(vertex)  
    next
	
	name = "raw:"+filename
	
	ext = GetStringToken(name, ".", CountStringTokens(name, "."))
	if ext  <> "obj"
		name = name + ".obj"
	endif
	
	f = OpenToWrite(name)
	
	for i=0 to all.length
		vertex = all[i]
		WriteLine(f, "v "+str(vertex.pos.x)+" "+str(vertex.pos.y)+" "+str(-vertex.pos.z)+" ")
	next

	for i=0 to all.length
		vertex = all[i]
		WriteLine(f, "vn "+str(vertex.normal.x)+" "+str(vertex.normal.y)+" "+str(vertex.normal.z)+" ")
	next
	
	for i=0 to all.length
		vertex = all[i]
		WriteLine(f, "vt "+str(vertex.uv.u)+" "+str(1 - vertex.uv.v))
	next

	c = GetPolysFromMemblock(mem) - 1				

	for i=0 to c
		poly = GetPolyFromMemblock(mem, i)	
		line = "f "
		for v=poly.vertex.length to 0 step -1
			vertex = poly.vertex[v]
			line = line + str(vertex.no+1) + "/" + str(vertex.no+1) + "/" +str(vertex.no+1) + " "
		next	
		WriteLine(f, line)
	next

	CloseFile(f)
	DeleteObject(id)
	DeleteMemblock(mem)
	
endfunction


/**************************************************************************************************
    3D memblock functions
     
    integer GetPolysFromMemBlock(id as integer)
    id = memblock id
    integer = The number of polys in this mesh
     
    tPoly = GetPolyFromMemblock(id as integer, n as integer)
    id = memblock id
    n = poly (from 0 through (GetPolysFromMemBlock() - 1))
    tPoly = tPoly.vertex is table containing information for the 3 vertex that make up the poly
            pos - Position of vertex x, y, z
            normal - Vertex normal x, y, z
            uv - Vertex uv u, v
            color - Color of vertex (if supplied)
             
 **************************************************************************************************/
  
type tUV
    u as float
    v as float
endtype
 
type tVertex
    pos     as point
    normal  as point
    uv      as tUV
    color   as integer
    no		as integer
endtype
 
type tPoly
    vertex  as tVertex[]
endtype
 
function    GetVerticiesFromMemBlock(id as integer)
    polys   as integer
    verticies as integer
     
    verticies = GetMemblockInt(id, 0)
          
endfunction verticies
 
function    GetIndiciesFromMemBlock(id as integer)
    polys   as integer
    indicies as integer
     
    indicies = GetMemblockInt(id, 4)
          
endfunction indicies
 
function    GetPolysFromMemBlock(id as integer)
    polys   as integer
    indicies as integer
     
    indicies = GetMemblockInt(id, 4)
     
    if indicies = 0
        polys = GetMemblockInt(id, 0) / 3
    else
        polys = indicies / 3        
    endif
     
endfunction polys
 
function    GetPolyFromMemblock(id as integer, n as integer)
    poly        as tPoly
    point       as point
    vertex      as tVertex
    verts       as integer
    indicies    as integer
    i           as integer
    v           as integer
    ioffset     as integer
     
    verts = GetMemblockInt(id, 0)    
    indicies = GetMemblockInt(id, 4)        
     
    SetErrorMode(0) 
     
    if indicies = 0
        for i=(n * 3) to (n * 3)+2  
        	vertex.no = i
            vertex.pos.x = GetMeshMemblockVertexX(id, i)
            vertex.pos.y = GetMeshMemblockVertexY(id, i)
            vertex.pos.z = GetMeshMemblockVertexZ(id, i)
            vertex.normal.x = GetMeshMemblockVertexNormalX(id, i)
            vertex.normal.y = GetMeshMemblockVertexNormalY(id, i)
            vertex.normal.z = GetMeshMemblockVertexNormalZ(id, i)           
            vertex.uv.u = GetMeshMemblockVertexU(id, i)
            vertex.uv.v = GetMeshMemblockVertexV(id, i)
            vertex.color = MakeColor(GetMeshMemblockVertexRed(id, i), GetMeshMemblockVertexGreen(id, i), GetMeshMemblockVertexBlue(id, i), GetMeshMemblockVertexAlpha(id, i))
            poly.vertex.insert(vertex)
        next
    else
        ioffset = GetMemblockInt(id, 20) + (n * 12)
        for i=0 to 8 step 4
            v = GetMemblockInt(id, ioffset + i)
        	vertex.no = v            
            vertex.pos.x = GetMeshMemblockVertexX(id, v)
            vertex.pos.y = GetMeshMemblockVertexY(id, v)
            vertex.pos.z = GetMeshMemblockVertexZ(id, v)
            vertex.normal.x = GetMeshMemblockVertexNormalX(id, v)
            vertex.normal.y = GetMeshMemblockVertexNormalY(id, v)
            vertex.normal.z = GetMeshMemblockVertexNormalZ(id, v)           
            vertex.uv.u = GetMeshMemblockVertexU(id, v)
            vertex.uv.v = GetMeshMemblockVertexV(id, v)
            vertex.color = MakeColor(GetMeshMemblockVertexRed(id, v), GetMeshMemblockVertexGreen(id, v), GetMeshMemblockVertexBlue(id, v), GetMeshMemblockVertexAlpha(id, v))           
            poly.vertex.insert(vertex)          
        next
    endif
     
    SetErrorMode(2)
     
endfunction poly
 
 
function DeleteObjectMemblock(id as integer)
    if GetMemblockExists(id)
        DeleteMemblock(id)
    endif
    DeleteObject(id)
endfunction 
Posted: 25th Mar 2020 12:09
@DannyD-thanks for the offer, I will keep you in mind when it comes to thorough testing stage.
@blink0k-can you be more specific , do you mean controls as in various gadgets, buttons, edit boxes, tracker bars etc?
@chafari-yes, no problem with "save object". I requested this years ago, but I now have code that saves to .X, .OBJ.
Posted: 25th Mar 2020 17:12
do you mean controls as in various gadgets, buttons, edit boxes, tracker bars etc?

I'm going to answer on Blinks behalf because it was discussed recently on Discord - Yes, that is what he means and I think a lot of people would very much appreciate something like that!
Posted: 29th Mar 2020 11:04
Better lightning and more than a single camera would be nice!
Posted: 30th Mar 2020 8:57
I see allot of people making paint style programs so some more advanced
drawing functions would be great ie a floodfill that's faster than the ones
around using memblocks etc Im sure there are other basic drawing functions
like polys etc that could be handy
Posted: 30th Mar 2020 11:59
If we're talking drawing programs, then pen pressure is absolutely essential.
Posted: 30th Mar 2020 13:25
Midi Files.. Funny that Dark Basic had this, but not in AGK

I've done a DLL in Softvelocity Clarion to use the winmm.dll
If I can get it somehow converted to be use in AppGameKit,. There is a bunch of Audio/Video functions...

See this Link
https://forum.thegamecreators.com/thread/213278

MS Docs
https://docs.microsoft.com/en-us/windows/win32/api/mmeapi/nf-mmeapi-midioutclose
Posted: 30th Mar 2020 13:48
many thanks for all the replies/ideas. I will certainly look into all that, I like the idea of more cameras (like DBPRO has) . Sure most of the above can be taken care of. I will get cracking....
Posted: 30th Mar 2020 23:15
This is for Windows only DLL for T1, yes?
What sort of scope are we talking about - something like a generic ODBC wrapper perhaps? Or do you mean enhancements to existing internals?
Posted: 1st Apr 2020 7:07
Discover/reconnect gamepads and joysticks after the program has started.
Posted: 12th Apr 2020 14:36
SendKeys - it's C# .NET so shouldn't be too hard to add.
Posted: 12th Apr 2020 14:47
Record Audio
Posted: 13th Apr 2020 1:04
Big plus for record audio
Posted: 13th Apr 2020 3:34
draw triangles
and fill parts of the screen
Posted: 13th Apr 2020 8:48
Support for additional hardware pointers would be fantastic for tool writers.
Posted: 13th Apr 2020 14:22
a command for spring physics would be nice too.