Hi there.... I thought about opening a new thread but I think here it fits . I made some thime ago an aplication to make mi lightmaping just coloring vertex and saving to Dbo or mesh .x . I have translated the Dbpro code to Agk and it works more or less but we can not save the model...this code paint vertex on the fly . I have to say, that object .x must be converted first to fvf 338 convert to diffuse. We can do this manually modifing the .x file and adding MeshVerterColors at the end of the file. I know the that this could be a tedious job, but I just did it for the heck of it . I hope you like it .
the brushes colors change with number 1 to 7
Atached whole project
// Project: Intersector
// Created: 2019-03-10
// show all errors
SetErrorMode(2)
// set window properties
SetWindowTitle( "Intersector" )
SetWindowSize( 1024, 768, 0 )
SetWindowAllowResize( 1 ) // allow the user to resize the window
SetRawMouseVisible(0)
// 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 ) // since version 2.0.22 we can use nicer default fonts
loadobject(1,"cardiffuse.x")
setobjectscale(1,3,3,3)
FixObjectPivot(1)
mesh = CreateMemblockFromObjectMesh(1,1)
verts= GetMemblockInt( mesh, 0 )
for i= 0 to verts-1
x#=GetMeshMemblockVertexX(mesh,i)
y#=GetMeshMemblockVertexy(mesh,i)
z#=GetMeshMemblockVertexz(mesh,i)
SetMeshMemblockVertexColor(mesh,i,255,255,255,0) `painting object white at start
next i
DeleteMemblock(1)
SetObjectMeshFromMemblock(1,1,mesh)
setcameraposition(1,-70,80,-70)
SetCameraLookAt(1,0,0,0,0)
CreateObjectSphere(2,6,10,10)
setobjectcolor(2,255,0,0,0)
SetRawMousePosition(500,400)
`sky
createobjectsphere(1200,3000,10,10)
SetObjectColorEmissive(1200,0,0,150)
SetObjectCullMode(1200,0)
SetCameraRange(1,1,5000)
global red=0
global green=0
global blue=0
do
if ( GetRawKeyState( 27) ) then end
movecameralocalz(1,(GetRawKeyState( 38 )*5)-GetRawKeyState( 40 )*5)
movecameralocalx(1,(GetRawKeyState( 39 )*5)-GetRawKeyState( 37 )*5)
setcamerarotation(1,getpointery(),-80+getpointerx(),0)
`Palette ...this shoud be done better :(
if GetRawKeyState(49) then setobjectcolor(2,255,0,0,255)
if GetRawKeyState(50) then setobjectcolor(2,255,255,0,255)
if GetRawKeyState(51) then setobjectcolor(2,0,255,0,255)
if GetRawKeyState(52) then setobjectcolor(2,255,0,255,255)
if GetRawKeyState(53) then setobjectcolor(2,0,0,255,255)
if GetRawKeyState(54) then setobjectcolor(2,160,140,0,255)
if GetRawKeyState(55) then setobjectcolor(2,10,10,10,255)
mesh = CreateMemblockFromObjectMesh(1,1)
verts= GetMemblockInt( mesh, 0 )
for i= 0 to verts-1
x#=GetMeshMemblockVertexX(mesh,i)
y#=GetMeshMemblockVertexy(mesh,i)
z#=GetMeshMemblockVertexz(mesh,i)
dx#=getobjectx(2)-x#
dz#=getobjectz(2)-z#
dy#=getobjecty(2)-y#
dist#=sqrt((dx#*dx#)+(dz#*dz#)+(dy#*dy#))
brush=10
if dist#<brush
if GetRawMouseLeftState()
rr=GetobjectColorRed(2)
gg=getobjectcolorgreen(2)
bb=getobjectcolorblue(2)
SetMeshMemblockVertexColor(mesh,i,rr,gg,bb,255)
endif
endif
next i
DeleteMemblock(1)
SetObjectMeshFromMemblock(1,1,mesh)
`getting start camera coords
lx#=getcamerax(1)
ly#=getcameray(1)
lz#=getcameraz(1)
MoveCameraLocalZ(1,2000)
`getting end camera coords
nx#=getcamerax(1)
ny#=getcameray(1)
nz#=getcameraz(1)
MoveCameraLocalZ (1,-2000) `camera back to it's place
if ObjectRayCast(1,lx#,ly#,lz#,nx#,ny#,nz#) = 1
fx# = GetObjectRayCastX(0)
fy# = GetObjectRayCastY(0)
fz# = GetObjectRayCastZ(0)
setobjectposition(2,fx#,fy#,fz#)
else
setobjectposition(2,0,0,0)
endif
Print( ScreenFPS() )
Sync()
loop
I'm not a grumpy grandpa