So I am tinkering with a simple flag mesh to see how the positions of the vertices can be manipulated.
www.orbiter-forum.com
So I am trying to prepare the group edit spec to do this. I need to set flags to replace the X, Y, Z coordinates of the vertices, and maybe the normals.
This is what I have so far, but I am not sure of the syntax to set multiple flags. There are some C++ API examples, but that doesn't really help with Lua syntax issues:
EDIT: The above syntax fails, with an error stating GRP_EDIT is an undefined global, but that is how the type is presented in the Orbiter Lua script interface documentation?
If I can get this to work I think I can then manipulate the coordinates using something like this:
I think I might also have to manually update the normals as well (ges.Vtx.nx, ges.Vtx.ny, ges.Vtx.nz), but one thing at a time.
So how do I set multiple GRP_EDIT flags?
Thunder Chicken
www.orbiter-forum.com
So I am trying to prepare the group edit spec to do this. I need to set flags to replace the X, Y, Z coordinates of the vertices, and maybe the normals.
This is what I have so far, but I am not sure of the syntax to set multiple flags. There are some C++ API examples, but that doesn't really help with Lua syntax issues:
Code:
function clbk_visualcreated(vis, refcount)
hdevmesh0 = vi:get_devmesh(vis,0)
local nvtx = 56
local vtx = oapi.create_ntvertexarray(nvtx)
local index_array = {}
for i = 1, nvtx do
index_array[i]=i-1
end
local vidx = oapi.create_indexarray(index_array)
--create group edit spec (ges)
ges = {}
ges.flags = GRP_EDIT.VTXCRDX, GRP_EDIT.VTXCRDY, GRP_EDIT.VTXCRDZ --??
ges.vIdx = vidx
ges.Vtx = vtx
end
EDIT: The above syntax fails, with an error stating GRP_EDIT is an undefined global, but that is how the type is presented in the Orbiter Lua script interface documentation?
The only two examples of GRP_EDIT usage in the code base are in the documentation in types.lua and Interpreter.cpp. [/EDIT]GRP_EDIT Mesh group edit flags
If I can get this to work I think I can then manipulate the coordinates using something like this:
Code:
if ges ~= nil then
for i = 1, #index_array do
ges.Vtx[i].x = *some wacky function*
ges.Vtx[i].y = *some wacky function*
ges.Vtx[i].z = *some wacky function*
end
oapi.edit_meshgroup(hdevmesh0, 0, ges)
oapi.edit_meshgroup(hdevmesh0, 1, ges)
end
I think I might also have to manually update the normals as well (ges.Vtx.nx, ges.Vtx.ny, ges.Vtx.nz), but one thing at a time.
So how do I set multiple GRP_EDIT flags?
Last edited:

