簡體   English   中英

Java 3d映射

[英]Java 3d mapping

我正在基於《 用Java開發游戲 》一書創建3D游戲(您無需閱讀或知道該書即可回答)。 為了創建地圖,我使用了.map文件,該文件指定了牆壁,地板,天花板等。 我只是不明白如何創建牆。 他只使用一個x坐標和一個z坐標,而不是使用開始x(坐標)和最終x,開始z(坐標)和最終z。 這些命令是:

#    v [x] [y] [z]        - Define a vertex with floating-point 
#                           coords (x,y,z).
#    mtllib [filename]    - Load materials from an external .mtl 
#                           file.
#    usemtl [name]        - Use the named material (loaded from a 
#                           .mtl file) for the next floor, ceiling,
#                           or wall.
#    ambientLightIntensity 
#        [value]          - Defines the ambient light intensity
#                           for the next room, from 0 to 1.
#    pointlight [v]       - Defines a point light located at the  
#        [intensity]        specfied vector. Optionally, light
#        [falloff]          intesity and falloff distance can
#                           be specified.
#    player [v] [angle]   - Specifies the starting location of the
#                           player and optionally a starting 
#                           angle, in radians, around the y-axis.
#    obj [uniqueName]     - Defines an object from an external
#        [filename] [v]     OBJ file. The unique name allows this
#        [angle]            object to be uniquely identfied, but
#                           can be "null" if no unique name is 
#                           needed. The filename is an external
#                           OBJ file. Optionally, the starting 
#                           angle, in radians, around the y-axis 
#                           can be specified.
#    room [name]          - Defines a new room, optionally giving
#                           the room a name. A room consists of
#                           vertical walls, a horizontal floor
#                           and a horizontal ceiling. Concave rooms
#                           are currently not supported, but can be
#                           simulated by adjacent convex rooms.
#    floor [height]       - Defines the height of the floor of 
#                           the current room, using the current
#                           material. The current material can
#                           be null, in which case no floor 
#                           polygon is created. The floor can be
#                           above the ceiling, in which case a 
#                           "pillar" or "block" structure is 
#                           created, rather than a "room".
#    ceil [height]        - Defines the height of the ceiling of 
#                           the current room, using the current
#                           material. The current material can
#                           be null, in which case no ceiling
#                           polygon is created. The ceiling can be
#                           below the floor, in which case a 
#                           "pillar" or "block" structure is 
#                           created, rather than a "room".
#    wall [x] [z]         - Defines a wall vertex in a room using
#         [bottom] [top]    the specified x and z coordinates.
#                           Walls should be defined in clockwise 
#                           order. If "bottom" and "top" is not
#                           defined, the floor and ceiling height
#                           are used. If the current material is
#                           null, or bottom is equal to top, no
#                           wall polygon is created.

也許您可以理解“牆面說明”並進行詳細說明? 我花了大約2天的時間測試一些“理論”,但我還是聽不懂。 我沒有得到的另一件事:“ v”命令的作用是什么?

PS:有沒有辦法從外部程序(例如構造此類.map文件的程序)創建.map文件? 什么是頂點?

非常感謝

wall命令的作用是定義一個牆頂點 這意味着它定義了牆的拐角或端點。 您需要提供多個牆頂點以定義牆。 例如:

wall 0 0
wall 0 2
wall 2 2

這將定義一個在90度角處由兩個直塊組成的牆。

牆的高度由最后兩個可選參數定義。 我不確定您將如何創建單獨的牆,但是也許您可以找到一個這樣做的迷宮的例子。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM