Вверх ↑
Ответов: 2057
Рейтинг: 28
#1: 2007-02-10 22:17:57 ЛС | профиль | цитата
nesco, вот эту процедуру из (Viewer.pas)
procedure TViewerForm.Use3DSData(const Reader: TFile3DS);

похоже придёться переносить в наш компонент.
nesco писал(а):
Эдик, скажи -- внутри KOL'ов, которые ты дал есть ли функции отрисовки 3d моделей, или там только методы доступа к параметрам модели. Я посмотрел параметры фалов 3ds, там не один только текст, а куча текстур. Как их выводить на экран, какими методами?

на счёт этого сежу разбераюсь. Вот взгляни на это

#pas
procedure TViewerForm.FormPaint(Sender: TObject);

// This is the main paint routine. If there's no data assigned yet then an empty window is drawn else the data stored
// in the various lists. These lists must already be set up.

var Scale: Single;

begin
// Note: We don't need to activate the rendering context here, as we did this in the OnShow event
// handler and we have setup the window to use a private DC (which is therefore never reset).
ClearBuffersAndBackground;

if FCameraChanged then
begin
FCameraChanged := False;
// set up projection
glMatrixMode(GL_PROJECTION);
glLoadIdentity;
if NavPanel.Visible then
ApplyPerspective(FViewport, ClientWidth - NavPanel.Width, ClientHeight, FDPI)
else
ApplyPerspective(FViewport, Width, ClientHeight, FDPI);
end;

// initialize transformation pipeline
glMatrixMode(GL_MODELVIEW);
glLoadIdentity;

// lights
Scale := ScaleUpDown.Position / 1000;
if FLightSourcesChanged then
begin
glScalef(Scale, Scale, Scale);
SetupLights;
glLoadIdentity;
end;

// camera
gluLookAt(0, 0, 50,
0, 0, -10,
0, 1, 0);

// objects
if Abs(1 - Scale) > 0.1 then
begin
glEnable(GL_NORMALIZE); // this will half the frame rate but is necessary for changing overall
// scale on the fly and still get the correct lighting
glScalef(Scale, Scale, Scale);
end
else glDisable(GL_NORMALIZE);
glMultMatrixf(@FSceneMatrix);
if FMainList <> 0 then glCallList(FMainList);

// copy back buffer to front
SwapBuffers(Canvas.Handle);
end;

[size=-2]------ Добавлено в 22:17
Если верхний код упрастить то он будет выглядить примерно так:

#pas
procedure THIGl_3dsMax._work_doDraw;
var Scale: Single;
begin

glMatrixMode(GL_MODELVIEW);
glLoadIdentity;
glMultMatrixf(@FSceneMatrix);
if FMainList <> 0 then glCallList(FMainList);
_hi_CreateEvent(_Data,@_event_onDraw);
end;
карма: 1

0