looking at the code, the function you probably want is this one:
bool ExportVRML_File( const wxString & aFullFileName, double aMMtoWRMLunit,
bool aExport3DFiles, bool aUseRelativePaths,
bool aUsePlainPCB, const wxString & a3D_Subdir,
double aXRef, double aYRef );
unfortunately, it’s a method on PCB_EDIT_FRAME (defined in kicad/include/wxPcbStruct.h). This is a large class that should probably only be exposed selectively. (it’s got lots of event handling stuff that even most other c++ should likely stay away from)
Probably, a good place to expose it is in pcbnew/swig/pcbnew_scripting_helpers.cpp.
compiling kicad is not hard (I have an entry about it on my blog).
The refresh command in the scripting helpers file would be a good model.
I don’t use the 3d stuff myself, so I wouldn’t know how to test such a change.