我使用线渲染器创建了两条线。除了 Y 值外,它们的长度和位置相同。第 1 行位置:起始:(constStartX,0.005f,constStartZ)结束:(constEndX,0.001f,
我使用线条渲染器创建了两条线条。除 Y 值外,它们的长度和位置相同。
第 1 行位置:开始:(constStartX,0.005f,constStartZ)结束:(constEndX,0.001f,constEndZ)
第 2 行位置:开始:(constStartX,0.001f,constStartZ)结束:(constEndX,0.005f,constEndZ)
我希望的结果是,当从顶部的相机观察线条时,我们只能看到每条线的一半(高于另一条线的那一半)。
这对于透视相机很有效,但对于正交相机则不行。它会将一条线完全渲染到另一条线上,即使在 3D 空间中该线较低的一半。
有没有办法用正交相机获得所需的行为(在每个点渲染具有最大 y 值的线)?谢谢!
我是 cmake 和 sfml 的新手,我想学习 cpp 游戏开发。在我的 Linux 机器上,我收到此错误:[1/1] 链接 CXX 可执行文件 SFMLAppFAILED:SFMLApp:&& /usr/bin/c++ -g CMake...
我是 cmake 和 sfml 的新手,我想学习 cpp 游戏开发。在我的 Linux 机器上我收到此错误:
[1/1] Linking CXX executable SFMLApp
FAILED: SFMLApp
: && /usr/bin/c++ -g CMakeFiles/SFMLApp.dir/main.cpp.o -o SFMLApp -L/home/issa/CLionProjects/Graphics_demo/SFML_LIBRARY_DIR -Wl,-rpath,/home/issa/CLionProjects/Graphics_demo/SFML_LIBRARY_DIR:/home/issa/Cpp-libs/SFML-2.6.1/lib /home/issa/Cpp-libs/SFML-2.6.1/lib/libsfml-graphics-d.so.2.6.1 /home/issa/Cpp-libs/SFML-2.6.1/lib/libsfml-window-d.so.2.6.1 /home/issa/Cpp-libs/SFML-2.6.1/lib/libsfml-audio-d.so.2.6.1 /home/issa/Cpp-libs/SFML-2.6.1/lib/libsfml-system-d.so.2.6.1 && :
/usr/bin/ld: warning: libFLAC.so.12, needed by /home/issa/Cpp-libs/SFML-2.6.1/lib/libsfml-audio-d.so.2.6.1, not found (try using -rpath or -rpath-link)
/usr/bin/ld: /home/issa/Cpp-libs/SFML-2.6.1/lib/libsfml-audio-d.so.2.6.1: undefined reference to `FLAC__stream_decoder_skip_single_frame'
/usr/bin/ld: /home/issa/Cpp-libs/SFML-2.6.1/lib/libsfml-audio-d.so.2.6.1: undefined reference to `FLAC__stream_decoder_process_until_end_of_metadata'
/usr/bin/ld: /home/issa/Cpp-libs/SFML-2.6.1/lib/libsfml-audio-d.so.2.6.1: undefined reference to `FLAC__stream_decoder_seek_absolute'
/usr/bin/ld: /home/issa/Cpp-libs/SFML-2.6.1/lib/libsfml-audio-d.so.2.6.1: undefined reference to `FLAC__stream_encoder_init_file'
/usr/bin/ld: /home/issa/Cpp-libs/SFML-2.6.1/lib/libsfml-audio-d.so.2.6.1: undefined reference to `FLAC__stream_encoder_finish'
/usr/bin/ld: /home/issa/Cpp-libs/SFML-2.6.1/lib/libsfml-audio-d.so.2.6.1: undefined reference to `FLAC__stream_decoder_finish'
/usr/bin/ld: /home/issa/Cpp-libs/SFML-2.6.1/lib/libsfml-audio-d.so.2.6.1: undefined reference to `FLAC__stream_encoder_process_interleaved'
/usr/bin/ld: /home/issa/Cpp-libs/SFML-2.6.1/lib/libsfml-audio-d.so.2.6.1: undefined reference to `FLAC__stream_encoder_set_channels'
/usr/bin/ld: /home/issa/Cpp-libs/SFML-2.6.1/lib/libsfml-audio-d.so.2.6.1: undefined reference to `FLAC__stream_encoder_new'
/usr/bin/ld: /home/issa/Cpp-libs/SFML-2.6.1/lib/libsfml-audio-d.so.2.6.1: undefined reference to `FLAC__stream_decoder_new'
/usr/bin/ld: /home/issa/Cpp-libs/SFML-2.6.1/lib/libsfml-audio-d.so.2.6.1: undefined reference to `FLAC__stream_decoder_delete'
/usr/bin/ld: /home/issa/Cpp-libs/SFML-2.6.1/lib/libsfml-audio-d.so.2.6.1: undefined reference to `FLAC__stream_encoder_set_sample_rate'
/usr/bin/ld: /home/issa/Cpp-libs/SFML-2.6.1/lib/libsfml-audio-d.so.2.6.1: undefined reference to `FLAC__stream_decoder_process_single'
/usr/bin/ld: /home/issa/Cpp-libs/SFML-2.6.1/lib/libsfml-audio-d.so.2.6.1: undefined reference to `FLAC__stream_decoder_get_state'
/usr/bin/ld: /home/issa/Cpp-libs/SFML-2.6.1/lib/libsfml-audio-d.so.2.6.1: undefined reference to `FLAC__stream_decoder_init_stream'
/usr/bin/ld: /home/issa/Cpp-libs/SFML-2.6.1/lib/libsfml-audio-d.so.2.6.1: undefined reference to `FLAC__stream_encoder_delete'
/usr/bin/ld: /home/issa/Cpp-libs/SFML-2.6.1/lib/libsfml-audio-d.so.2.6.1: undefined reference to `FLAC__stream_encoder_set_bits_per_sample'
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
我已经安装了 libflac-dev:
$ sudo find /* -name libFLAC.so.*
...
/usr/lib/x86_64-linux-gnu/libFLAC.so.8
/usr/lib/x86_64-linux-gnu/libFLAC.so.8.3.0
...
我应该做什么更改才能在 CMakeLists.txt 中链接 libflac-dev:
cmake_minimum_required(VERSION 3.25)
project(Graphics_demo)
set(CMAKE_CXX_STANDARD 17)
add_executable(Graphics_demo main.cpp)
set(EXECUTABLE_NAME "SFMLApp")
set(SFML_INCLUDE_DIR "/home/issa/Cpp-libs/SFML-2.6.1/include")
set(SFML_LIBRARY_DIR "/home/issa/Cpp-libs/SFML-2.6.1/lib")
set(SFML_DIR "/home/issa/Cpp-libs/SFML-2.6.1/lib/cmake/SFML")
link_directories(SFML_LIBRARY_DIR)
include_directories(SFML_INCLUDE_DIR)
find_package(SFML 2.6.1 COMPONENTS system window graphics audio network)
if (SFML_FOUND)
message(STATUS "SFML_INCLUDE_DIR: ${SFML_INCLUDE_DIR}")
message(STATUS "SFML_LIBRARIES: ${SFML_LIBRARIES}")
message(STATUS "SFML_VERSION: ${SFML_VERSION}")
endif ()
add_executable(SFMLApp main.cpp)
target_link_libraries(SFMLApp sfml-graphics sfml-window sfml-system sfml-audio)
为什么这个命令可以正常工作而 cmake 却不工作?
g++ main.cpp -o main -lsfml-system -lsfml-graphics -lsfml-audio -lsfml-window