![]() |
| ||
|
|
Новости |
Поиск |
FAQ |
Статьи |
Книги |
Новости VCL
| | Форумы ЧАТ |
Орешник |
|
| |||
| |||
« предыдущая ветвь | форум | следующая ветвь »
GLScene - GLPortal и GLFreeForm [Delphi, Windows]
Conferno © (2005-11-13 22:03:00)Привет мастерам!
Вот, кое-что вычитал из GLSceneFaq'a про порталы.
Пробовал так, как написано, но желаемого результата не получил....
Может кто разберется в коде, портал - вещь незаменимая для модели
уровня(например, закрытого помещения).
Вот то, что я вычитал:
Essentially level rendering, there is a small demo on it that shows a (very)
small subset of what it can do. Lacks decent importers/level editors.
Eric
/////////////////
Can I use portals to render big scenes loaded from files? Loading from
file doesn't work because the loaders don't create the Sectors and Polys
instead of MeshObjects and FaceGroups. So I tought a convertion
function could do the trick. What I got is this:
procedure convert(mesh: TGLBaseMesh; portal: TGLPortal);
var
i, j: integer;
sector: TSectorMeshObject;
mo: TMeshObject;
poly: TFGPolygon;
fc: TFaceGroup;
begin
for i:= 0 to mesh.MeshObjects.Count -1 do begin
mo:= mesh.MeshObjects[i];
sector:= TSectorMeshObject.CreateOwned(Portal.MeshObjects);
sector.Vertices.assign(mo.Vertices);
sector.Normals.Assign(mo.Normals);
sector.Visible:= mo.Visible;
sector.TexCoords.Assign(mo.TexCoords);
sector.LighmapTexCoords.Assign(mo.LighmapTexCoords);
sector.Colors.Assign(mo.Colors);
sector.Mode:= mo.Mode;
sector.RenderingOptions:= mo.RenderingOptions;
//sector.FaceGroups.Assign(mo.FaceGroups);
for j:= 0 to mo.FaceGroups.Count -1 do begin
poly:= TFGPolygon.CreateOwned(sector.FaceGroups);
fc:= mo.FaceGroups[j];
poly.MaterialName:= fc.MaterialName;
if fc.InheritsFrom(TFGVertexIndexList) then with
TFGVertexIndexList(fc) do begin
poly.VertexIndices.Assign(VertexIndices);
poly.Mode:= Mode;
end;
if fc.InheritsFrom(TFGVertexNormalTexIndexList) then
with TFGVertexNormalTexIndexList(fc) do begin
poly.NormalIndices.Assign(NormalIndices);
poly.TexCoordIndices.Assign(TexCoordIndices);
end;
end;
end;
end;
Works all right, I load a mesh file on a freeForm and then convert this
to sectors and polies to the portal object. However, the portal doesn't
do the culling. The problem is at TPortalMeshObjectList.BuildList; the
camera position (if
Items[i].PointInObject(PAffineVector(@mrci.cameraPosition)^)) never
seems to be inside any sector. I'm thinking this is a coordinate
convertion problem, but so far I haven't been able to correct is.
У кого какие идеи?
Conferno (2005-11-17 18:18:00) [1]Прикольно работает....
Только не пойму как использоватьи увеличиватьQuad'ы...
Conferno (2005-11-15 22:19:00) [2]Большое спасибо! Посмотрю... :)
Da Stranger (2005-11-15 21:56:00) [3]Пример отправил
Conferno (2005-11-14 23:41:00) [4]
> есть демка GLScene\Demos\Meshes\Portal\
Ну, это я есессно знаю.......
> + на http://caperaven.co.za/раньше лежала очень старая
> демка portal, но я с ней не разбирался.
Я что-то искал-искал на сайте, но так и не нашел.... :(
Не подскажешь где именно?
Или, если ты ее скачивал, не кинешь на мыло?
Порталы - вещь интересная и нужная...
Da Stranger (2005-11-14 14:07:00) [5]есть демка GLScene\Demos\Meshes\Portal\
+ на http://caperaven.co.za/раньше лежала очень старая демка portal, но я с ней не разбирался.