gpt4 book ai didi

Java 3D 映射

转载 作者:行者123 更新时间:2023-12-01 12:55:40 25 4
gpt4 key购买 nike

我正在根据这本书 Developing Games in Java 创建一个 3D 游戏(你不需要阅读或了解这本书来回答)。为了创建 map ,我使用了指定墙壁、地板、天花板等的 .map 文件。我只是不明白墙壁是如何 build 的。他没有使用开始 x(坐标)和最终 x、开始 z(坐标)和最终 z,而是只使用一个 x 坐标和一个 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.

也许你能理解“墙上的说明”并解释得更详细?我大约花了两天时间测试一些“理论”,但我仍然无法理解。我不明白的另一件事是:“v”命令的用途是什么?

PS:有没有办法从外部程序(例如构建此类 .map 文件的程序)创建 .map 文件?顶点是什么?

非常感谢

最佳答案

wall 命令的作用是定义墙顶点。这意味着它定义了墙的拐角或端点。您需要给出多个墙顶点来定义墙。例如:

wall 0 0
wall 0 2
wall 2 2

这将定义一堵由两个直角部分组成的 90 度角的墙。

墙的高度由最后两个可选参数定义。我不确定您将如何创建单独的墙,但也许您可以找到一个可以做到这一点的迷宫示例。

关于Java 3D 映射,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23922555/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com