Hi all,
After playing around with all this this morning i have something working but the result is not correct. 
For the rendering i use the code below.
This gives me rendering of the current view for the moment so i can control the camera rotations.
Later i’ll have to use other rendering method because this one renders with a camera dependant lighting.
(i mean that the ligthing/shadows change when camera position changes)
// Render current view
bool CCommandIVisit::RenderCurrentView(int view, int resolution, CString folderPath)
{
// Test command for rendering view port to a file :
// _-ViewCaptureToFile C:\Users\Georges\Desktop\image1.jpg _Height=800 _Width=800 _enter
// Prepare data
WCHAR r[256];
CString ifile = L"";
ifile = folderPath + L"\\image";
wsprintf(r, L"%d", view);
ifile += r;
ifile += ".jpg";
wsprintf(r, L"%d", resolution);
// Build the Rhino command
CString cmd = L"!_-ViewCaptureToFile\n\"" + ifile + L"\"\n";
cmd += L"_Width=";
cmd += r;
cmd += L"\n";
cmd += L"_Height=";
cmd += r;
cmd += L"\n";
cmd += L"_enter";
// Run the command
return RhinoApp().RunScript(cmd);
}
For the camera rotation i have tried out a lot of things but none is correct for me.
Here is the code i use (this is the most simple implementation i have found…doing the same as more complex camera position and target calculations).
void CCommandIVisit::RotateCamera(int view)
{
ON_3dPoint direction;
switch(view)
{
case 1: // Front
direction = ON_3dPoint(-1,0,0);
mFrontViewDirection = direction;
break;
case 2: // Left
direction = ON_3dPoint(0,-1,0);
break;
case 3: // Back
direction = ON_3dPoint(1,0,0);
break;
case 4: // Right
direction = ON_3dPoint(0,1,0);
break;
case 5: // Up
direction = ON_3dPoint(0,0,1);
break;
case 6: // Down
direction = ON_3dPoint(0,0,-1);
break;
default:
break;
}
RhinoApp().ActiveView()->ActiveViewport().SetCameraDirection(direction);
RhinoApp().ActiveView()->Redraw();
}
The up and down views are not correct because i have to roll the camera to have a correct orientation.
I didn’t find out how to roll the camera.
Another problem i have is that i don’t know how to set the “field of view” correctly.
I need a FOV of 90° to have correct frames that i can assemble.
(i have tried SetCameraAngle with no success)
I have also tried the LeftRightRotate and UpDownRotate but these commands seem to rotate position and target of camera wich is not correct for what i need.
Maybe someone can tell me where i am wrong. Sorry if these questions seem a bit basic to you…i am total beginner in Rhino. (and also…english is not my native language as you have probably discovered
)
Thanks a lot.