forked from Kolyah35/minecraft-pe-0.6.1
Compare commits
21 Commits
ios-suppor
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f8e7c0f80f | ||
|
|
9ba3fabfb6 | ||
|
|
1effcd1e6d | ||
|
|
bc82f5c091 | ||
| 8d7a1973e7 | |||
| 3a0f4c3647 | |||
|
|
d6a3e477c1 | ||
|
|
4d68c4dff8 | ||
|
|
e1c2210621 | ||
|
|
c188fa0ce2 | ||
|
|
9db9f469cc | ||
|
|
db7a889962 | ||
|
|
95a193323c | ||
|
|
f19c2d24a3 | ||
|
|
e1b81a7cc3 | ||
|
|
baeefae94d | ||
|
|
aa9fa659df | ||
|
|
6049239303 | ||
|
|
55d06f0590 | ||
|
|
58b7724ba2 | ||
| 6ae787b90d |
31
.github/workflows/build.yml
vendored
31
.github/workflows/build.yml
vendored
@@ -216,16 +216,6 @@ jobs:
|
|||||||
distribution: temurin
|
distribution: temurin
|
||||||
java-version: 25
|
java-version: 25
|
||||||
|
|
||||||
- name: Validate environment
|
|
||||||
run: |
|
|
||||||
echo "ANDROID_SDK_ROOT=$ANDROID_SDK_ROOT"
|
|
||||||
echo "ANDROID_NDK_PATH=$ANDROID_NDK_PATH"
|
|
||||||
echo "JAVA_HOME=$JAVA_HOME"
|
|
||||||
echo "MATRIX_ABI=$MATRIX_ABI"
|
|
||||||
$ANDROID_SDK_ROOT/platform-tools/adb version || true
|
|
||||||
java -version
|
|
||||||
javac -version
|
|
||||||
|
|
||||||
- name: Run Android build script
|
- name: Run Android build script
|
||||||
run: |
|
run: |
|
||||||
chmod +x ./build.sh
|
chmod +x ./build.sh
|
||||||
@@ -322,17 +312,10 @@ jobs:
|
|||||||
files: mcpe-linux/MinecraftPE-server
|
files: mcpe-linux/MinecraftPE-server
|
||||||
dest: minecraftpe-server-${{ steps.ref.outputs.hash }}.zip
|
dest: minecraftpe-server-${{ steps.ref.outputs.hash }}.zip
|
||||||
|
|
||||||
- name: Zip Android arm64-v8a Artifact
|
- name: Rename Android Artifacts
|
||||||
uses: vimtor/action-zip@v1.2
|
run: |
|
||||||
with:
|
mv minecraftpe-apk-arm64-v8a/minecraftpe-v8a-debug.apk minecraftpe-${{ steps.ref.outputs.hash }}-android-arm64-v8a.apk
|
||||||
files: minecraftpe-apk-arm64-v8a/minecraftpe-v8a-debug.apk
|
mv minecraftpe-apk-armeabi-v7a/minecraftpe-v7a-debug.apk minecraftpe-${{ steps.ref.outputs.hash }}-android-armeabi-v7a.apk
|
||||||
dest: minecraftpe-${{ steps.ref.outputs.hash }}-android-arm64-v8a.zip
|
|
||||||
|
|
||||||
- name: Zip Android armeabi-v7a Artifact
|
|
||||||
uses: vimtor/action-zip@v1.2
|
|
||||||
with:
|
|
||||||
files: minecraftpe-apk-armeabi-v7a/minecraftpe-v7a-debug.apk
|
|
||||||
dest: minecraftpe-${{ steps.ref.outputs.hash }}-android-armeabi-v7a.zip
|
|
||||||
|
|
||||||
- name: Zip Web Artifact
|
- name: Zip Web Artifact
|
||||||
uses: vimtor/action-zip@v1.2
|
uses: vimtor/action-zip@v1.2
|
||||||
@@ -358,9 +341,9 @@ jobs:
|
|||||||
MinecraftPE development release for commit ${{ github.sha }}.
|
MinecraftPE development release for commit ${{ github.sha }}.
|
||||||
files: |
|
files: |
|
||||||
./data.zip
|
./data.zip
|
||||||
|
./minecraftpe-server-${{ steps.ref.outputs.hash }}.zip
|
||||||
./minecraftpe-${{ steps.ref.outputs.hash }}-windows.zip
|
./minecraftpe-${{ steps.ref.outputs.hash }}-windows.zip
|
||||||
./minecraftpe-${{ steps.ref.outputs.hash }}-linux.zip
|
./minecraftpe-${{ steps.ref.outputs.hash }}-linux.zip
|
||||||
./minecraftpe-server-${{ steps.ref.outputs.hash }}.zip
|
./minecraftpe-${{ steps.ref.outputs.hash }}-android-arm64-v8a.apk
|
||||||
./minecraftpe-${{ steps.ref.outputs.hash }}-android-arm64-v8a.zip
|
./minecraftpe-${{ steps.ref.outputs.hash }}-android-armeabi-v7a.apk
|
||||||
./minecraftpe-${{ steps.ref.outputs.hash }}-android-armeabi-v7a.zip
|
|
||||||
./minecraftpe-${{ steps.ref.outputs.hash }}-web.zip
|
./minecraftpe-${{ steps.ref.outputs.hash }}-web.zip
|
||||||
|
|||||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -4,6 +4,7 @@ out/
|
|||||||
bin/
|
bin/
|
||||||
lib/
|
lib/
|
||||||
build-apk/
|
build-apk/
|
||||||
|
build-haiku/
|
||||||
cmake-build-*/
|
cmake-build-*/
|
||||||
CMakeFiles/
|
CMakeFiles/
|
||||||
CMakeCache.txt
|
CMakeCache.txt
|
||||||
|
|||||||
157
CMakeLists.txt
157
CMakeLists.txt
@@ -1,6 +1,10 @@
|
|||||||
cmake_minimum_required(VERSION 3.21)
|
cmake_minimum_required(VERSION 3.21)
|
||||||
project(MinecraftPE)
|
project(MinecraftPE)
|
||||||
|
|
||||||
|
if(CMAKE_SYSTEM_NAME STREQUAL "Haiku")
|
||||||
|
set(HAIKU, 1)
|
||||||
|
endif()
|
||||||
|
|
||||||
include(cmake/CPM.cmake)
|
include(cmake/CPM.cmake)
|
||||||
|
|
||||||
set(CMAKE_CXX_STANDARD 14)
|
set(CMAKE_CXX_STANDARD 14)
|
||||||
@@ -26,6 +30,10 @@ if (${PLATFORM} STREQUAL "Desktop")
|
|||||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libstdc++ -static-libgcc")
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libstdc++ -static-libgcc")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(HAIKU)
|
||||||
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libstdc++ -static-libgcc -static")
|
||||||
|
endif()
|
||||||
|
|
||||||
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-c++11-narrowing -Wno-narrowing -Wno-invalid-source-encoding -Wno-reserved-user-defined-literal")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-c++11-narrowing -Wno-narrowing -Wno-invalid-source-encoding -Wno-reserved-user-defined-literal")
|
||||||
endif()
|
endif()
|
||||||
@@ -34,6 +42,10 @@ if (${PLATFORM} STREQUAL "Desktop")
|
|||||||
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
|
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
|
||||||
include_directories(misc/windows)
|
include_directories(misc/windows)
|
||||||
set(EXTRA_LIBS ws2_32 winhttp)
|
set(EXTRA_LIBS ws2_32 winhttp)
|
||||||
|
elseif(HAIKU)
|
||||||
|
find_library(pthread NAMES pthread)
|
||||||
|
find_library(network NAMES network)
|
||||||
|
set(EXTRA_LIBS pthread m network)
|
||||||
elseif(UNIX)
|
elseif(UNIX)
|
||||||
find_library(pthread NAMES pthread)
|
find_library(pthread NAMES pthread)
|
||||||
set(EXTRA_LIBS pthread m)
|
set(EXTRA_LIBS pthread m)
|
||||||
@@ -44,73 +56,88 @@ elseif (${PLATFORM} STREQUAL "Web")
|
|||||||
set(EXTRA_LIBS "idbfs.js")
|
set(EXTRA_LIBS "idbfs.js")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# I totally shocked
|
if(!HAIKU)
|
||||||
if(${PLATFORM} MATCHES "Web")
|
if(${PLATFORM} MATCHES "Web")
|
||||||
set(PNG_LIB png)
|
set(PNG_LIB png)
|
||||||
set(AL_LIBTYPE "STATIC")
|
set(ZLIB_LIB zlib)
|
||||||
|
set(AL_LIBTYPE "STATIC")
|
||||||
|
|
||||||
add_library(zlib INTERFACE IMPORTED)
|
add_library(zlib INTERFACE IMPORTED)
|
||||||
set_target_properties(zlib PROPERTIES
|
set_target_properties(zlib PROPERTIES
|
||||||
INTERFACE_LINK_OPTIONS "-sUSE_ZLIB=1"
|
INTERFACE_LINK_OPTIONS "-sUSE_ZLIB=1"
|
||||||
)
|
)
|
||||||
|
|
||||||
add_library(png INTERFACE IMPORTED)
|
add_library(png INTERFACE IMPORTED)
|
||||||
set_target_properties(png PROPERTIES
|
set_target_properties(png PROPERTIES
|
||||||
INTERFACE_COMPILE_OPTIONS "-sUSE_LIBPNG=1"
|
INTERFACE_COMPILE_OPTIONS "-sUSE_LIBPNG=1"
|
||||||
INTERFACE_LINK_OPTIONS "-sUSE_LIBPNG=1"
|
INTERFACE_LINK_OPTIONS "-sUSE_LIBPNG=1"
|
||||||
)
|
)
|
||||||
|
|
||||||
add_library(glfw INTERFACE IMPORTED)
|
add_library(glfw INTERFACE IMPORTED)
|
||||||
set_target_properties(glfw PROPERTIES
|
set_target_properties(glfw PROPERTIES
|
||||||
INTERFACE_LINK_OPTIONS "-sUSE_GLFW=3"
|
INTERFACE_LINK_OPTIONS "-sUSE_GLFW=3"
|
||||||
|
)
|
||||||
|
|
||||||
|
else()
|
||||||
|
set(PNG_LIB png_shared)
|
||||||
|
set(ZLIB_LIB zlib)
|
||||||
|
set(AL_LIB "OpenAL::OpenAL")
|
||||||
|
set(AL_LIBTYPE "SHARED")
|
||||||
|
|
||||||
|
CPMAddPackage(
|
||||||
|
NAME "zlib"
|
||||||
|
GIT_REPOSITORY "https://github.com/madler/zlib"
|
||||||
|
GIT_TAG "v1.3.2"
|
||||||
|
)
|
||||||
|
|
||||||
|
CPMAddPackage(
|
||||||
|
NAME "libpng"
|
||||||
|
GIT_REPOSITORY "https://github.com/pnggroup/libpng.git"
|
||||||
|
GIT_TAG "v1.6.55"
|
||||||
|
OPTIONS
|
||||||
|
"ZLIB_ROOT ${zlib_SOURCE_DIR}"
|
||||||
|
"ZLIB_INCLUDE_DIRS ${zlib_SOURCE_DIR}"
|
||||||
|
"PNG_TOOLS OFF"
|
||||||
|
"PNG_TESTS OFF"
|
||||||
|
)
|
||||||
|
CPMAddPackage(
|
||||||
|
NAME "glfw"
|
||||||
|
GIT_REPOSITORY "https://github.com/glfw/glfw.git"
|
||||||
|
GIT_TAG "3.4"
|
||||||
|
EXCLUDE_FROM_ALL TRUE
|
||||||
|
OPTIONS
|
||||||
|
"GLFW_BUILD_EXAMPLES OFF"
|
||||||
|
"GLFW_BUILD_TESTS OFF"
|
||||||
|
"GLFW_BUILD_DOCS OFF"
|
||||||
|
)
|
||||||
|
|
||||||
|
endif()
|
||||||
|
|
||||||
|
CPMAddPackage(
|
||||||
|
NAME "openal"
|
||||||
|
GIT_REPOSITORY "https://github.com/kcat/openal-soft.git"
|
||||||
|
GIT_TAG "1.25.1"
|
||||||
|
OPTIONS
|
||||||
|
"ALSOFT_EXAMPLES OFF"
|
||||||
|
"ALSOFT_TESTS OFF"
|
||||||
|
"ALSOFT_UTILS OFF"
|
||||||
|
"LIBTYPE ${AL_LIBTYPE}"
|
||||||
|
"ALSOFT_ENABLE_MODULES OFF"
|
||||||
|
"ALSOFT_STATIC_STDCXX ON"
|
||||||
|
"ALSOFT_STATIC_LIBGCC ON"
|
||||||
)
|
)
|
||||||
else()
|
else()
|
||||||
set(PNG_LIB png_shared)
|
# alot of these have haikuports specific versions,
|
||||||
set(AL_LIBTYPE "SHARED")
|
find_library(glfw NAMES glfw)
|
||||||
|
find_library(openal NAMES openal)
|
||||||
|
find_library(png NAMES png)
|
||||||
|
find_library(zlib NAMES zlib)
|
||||||
|
|
||||||
CPMAddPackage(
|
set(PNG_LIB png)
|
||||||
NAME "zlib"
|
set(ZLIB_LIB z)
|
||||||
GIT_REPOSITORY "https://github.com/madler/zlib"
|
set(AL_LIB openal)
|
||||||
GIT_TAG "v1.3.2"
|
|
||||||
)
|
|
||||||
|
|
||||||
CPMAddPackage(
|
|
||||||
NAME "libpng"
|
|
||||||
GIT_REPOSITORY "https://github.com/pnggroup/libpng.git"
|
|
||||||
GIT_TAG "v1.6.55"
|
|
||||||
OPTIONS
|
|
||||||
"ZLIB_ROOT ${zlib_SOURCE_DIR}"
|
|
||||||
"ZLIB_INCLUDE_DIRS ${zlib_SOURCE_DIR}"
|
|
||||||
"PNG_TOOLS OFF"
|
|
||||||
"PNG_TESTS OFF"
|
|
||||||
)
|
|
||||||
|
|
||||||
CPMAddPackage(
|
|
||||||
NAME "glfw"
|
|
||||||
GIT_REPOSITORY "https://github.com/glfw/glfw.git"
|
|
||||||
GIT_TAG "3.4"
|
|
||||||
EXCLUDE_FROM_ALL TRUE
|
|
||||||
OPTIONS
|
|
||||||
"GLFW_BUILD_EXAMPLES OFF"
|
|
||||||
"GLFW_BUILD_TESTS OFF"
|
|
||||||
"GLFW_BUILD_DOCS OFF"
|
|
||||||
)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
CPMAddPackage(
|
|
||||||
NAME "openal"
|
|
||||||
GIT_REPOSITORY "https://github.com/kcat/openal-soft.git"
|
|
||||||
GIT_TAG "1.25.1"
|
|
||||||
OPTIONS
|
|
||||||
"ALSOFT_EXAMPLES OFF"
|
|
||||||
"ALSOFT_TESTS OFF"
|
|
||||||
"ALSOFT_UTILS OFF"
|
|
||||||
"LIBTYPE ${AL_LIBTYPE}"
|
|
||||||
"ALSOFT_ENABLE_MODULES OFF"
|
|
||||||
"ALSOFT_STATIC_STDCXX ON"
|
|
||||||
"ALSOFT_STATIC_LIBGCC ON"
|
|
||||||
)
|
|
||||||
|
|
||||||
# TODO: Clear this paths with *
|
# TODO: Clear this paths with *
|
||||||
file(GLOB SERVER_SOURCES
|
file(GLOB SERVER_SOURCES
|
||||||
"project/lib_projects/raknet/jni/RaknetSources/*.cpp"
|
"project/lib_projects/raknet/jni/RaknetSources/*.cpp"
|
||||||
@@ -316,7 +343,8 @@ if(UNIX)
|
|||||||
"project/lib_projects/raknet/jni/RaknetSources"
|
"project/lib_projects/raknet/jni/RaknetSources"
|
||||||
)
|
)
|
||||||
|
|
||||||
target_link_libraries("${PROJECT_NAME}-server" ${CMAKE_THREAD_LIBS_INIT})
|
target_link_libraries("${PROJECT_NAME}-server" ${EXTRA_LIBS})
|
||||||
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_executable(${PROJECT_NAME} ${CLIENT_SOURCES})
|
add_executable(${PROJECT_NAME} ${CLIENT_SOURCES})
|
||||||
@@ -372,11 +400,16 @@ if(${PLATFORM} MATCHES "Web")
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
target_compile_definitions(${PROJECT_NAME} PUBLIC "__EMSCRIPTEN__" "NO_SOUND" "NO_NETWORK")
|
target_compile_definitions(${PROJECT_NAME} PUBLIC "__EMSCRIPTEN__" "NO_SOUND" "NO_NETWORK")
|
||||||
|
else()
|
||||||
|
target_compile_options(${PROJECT_NAME} PUBLIC
|
||||||
|
"-O3"
|
||||||
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Client
|
# Client
|
||||||
target_compile_definitions(${PROJECT_NAME} PUBLIC "OPENGL_ES" "NO_EGL" ${PLATFORM})
|
target_compile_definitions(${PROJECT_NAME} PUBLIC "OPENGL_ES" "NO_EGL" ${PLATFORM})
|
||||||
target_link_libraries(${PROJECT_NAME} zlib ${PNG_LIB} OpenAL::OpenAL glfw ${EXTRA_LIBS})
|
|
||||||
|
target_link_libraries(${PROJECT_NAME} ${ZLIB_LIB} ${PNG_LIB} ${AL_LIB} glfw ${EXTRA_LIBS})
|
||||||
|
|
||||||
if (OpenSSL_FOUND)
|
if (OpenSSL_FOUND)
|
||||||
target_link_libraries(${PROJECT_NAME} OpenSSL::SSL OpenSSL::Crypto)
|
target_link_libraries(${PROJECT_NAME} OpenSSL::SSL OpenSSL::Crypto)
|
||||||
@@ -407,4 +440,4 @@ else()
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
message(STATUS "Compiling with the flags:")
|
message(STATUS "Compiling with the flags:")
|
||||||
message(STATUS " PLATFORM=" ${PLATFORM_CPP})
|
message(STATUS " PLATFORM=" ${PLATFORM_CPP})
|
||||||
|
|||||||
@@ -153,7 +153,20 @@ options.group.tweaks=Tweaks
|
|||||||
options.allowSprint=Allow sprint
|
options.allowSprint=Allow sprint
|
||||||
options.barOnTop=HUD above inventory
|
options.barOnTop=HUD above inventory
|
||||||
options.rpiCursor=Show Raspberry PI cursor
|
options.rpiCursor=Show Raspberry PI cursor
|
||||||
options.foliageTint=Tint Grass and Leaves
|
options.foliagetint=Foliage Tinting
|
||||||
|
options.javaHud=Beta Java hotbar tweaks
|
||||||
|
options.blockOutline=Block Outline Selection
|
||||||
|
options.fogType=Fog/Sky Color
|
||||||
|
options.fogType.vanilla=Vanilla
|
||||||
|
options.fogType.java=Beta Java
|
||||||
|
options.fogType.unused=Unused
|
||||||
|
|
||||||
|
options.restoredAnims=Restored Animations
|
||||||
|
|
||||||
|
options.normalLighting=Java Beta/Normals Shading
|
||||||
|
|
||||||
|
options.isJoyTouchArea=Use Split Controls
|
||||||
|
|
||||||
options.autoJump=Auto Jump
|
options.autoJump=Auto Jump
|
||||||
options.thirdperson=Third Person
|
options.thirdperson=Third Person
|
||||||
options.servervisible=Server Visible
|
options.servervisible=Server Visible
|
||||||
|
|||||||
@@ -98,6 +98,7 @@ LOCAL_SRC_FILES := ../../../src/main.cpp \
|
|||||||
../../../src/client/player/RemotePlayer.cpp \
|
../../../src/client/player/RemotePlayer.cpp \
|
||||||
../../../src/client/player/input/KeyboardInput.cpp \
|
../../../src/client/player/input/KeyboardInput.cpp \
|
||||||
../../../src/client/player/input/touchscreen/TouchscreenInput.cpp \
|
../../../src/client/player/input/touchscreen/TouchscreenInput.cpp \
|
||||||
|
../../../src/client/renderer/Lighting.cpp \
|
||||||
../../../src/client/renderer/Chunk.cpp \
|
../../../src/client/renderer/Chunk.cpp \
|
||||||
../../../src/client/renderer/EntityTileRenderer.cpp \
|
../../../src/client/renderer/EntityTileRenderer.cpp \
|
||||||
../../../src/client/renderer/GameRenderer.cpp \
|
../../../src/client/renderer/GameRenderer.cpp \
|
||||||
|
|||||||
@@ -75,6 +75,7 @@ LOCAL_SRC_FILES := ../../../src/main.cpp \
|
|||||||
../../../src/client/player/RemotePlayer.cpp \
|
../../../src/client/player/RemotePlayer.cpp \
|
||||||
../../../src/client/player/input/KeyboardInput.cpp \
|
../../../src/client/player/input/KeyboardInput.cpp \
|
||||||
../../../src/client/player/input/touchscreen/TouchscreenInput.cpp \
|
../../../src/client/player/input/touchscreen/TouchscreenInput.cpp \
|
||||||
|
../../../src/client/renderer/Lighting.cpp \
|
||||||
../../../src/client/renderer/Chunk.cpp \
|
../../../src/client/renderer/Chunk.cpp \
|
||||||
../../../src/client/renderer/EntityTileRenderer.cpp \
|
../../../src/client/renderer/EntityTileRenderer.cpp \
|
||||||
../../../src/client/renderer/GameRenderer.cpp \
|
../../../src/client/renderer/GameRenderer.cpp \
|
||||||
|
|||||||
26
project/haiku/createpkg.sh
Executable file
26
project/haiku/createpkg.sh
Executable file
@@ -0,0 +1,26 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
mkdir build-haiku
|
||||||
|
cd build-haiku
|
||||||
|
cmake ..
|
||||||
|
make -j10
|
||||||
|
|
||||||
|
rm -rf pkg
|
||||||
|
|
||||||
|
mkdir pkg
|
||||||
|
mkdir -p ./pkg/apps/
|
||||||
|
mkdir -p ./pkg/data/minecraftpe
|
||||||
|
mkdir -p ./pkg/settings/minecraftpe
|
||||||
|
mkdir -p ./pkg/data/deskbar/menu/Applications/
|
||||||
|
mkdir -p ./pkg/data/deskbar/menu/Games/
|
||||||
|
|
||||||
|
cp -rv ../project/haiku/pkg ./
|
||||||
|
cp -v MinecraftPE ./pkg/apps/minecraftpe
|
||||||
|
cp -v MinecraftPE-server ./pkg/apps/minecraftpe-server
|
||||||
|
cp -rv data ./pkg/data/minecraftpe
|
||||||
|
|
||||||
|
ln -s ../../../../apps/minecraftpe ./pkg/data/deskbar/menu/Applications/minecraftpe
|
||||||
|
ln -s ../../../../apps/minecraftpe ./pkg/data/deskbar/menu/Games/minecraftpe
|
||||||
|
|
||||||
|
|
||||||
|
package create -C pkg minecraftpe-0.6.1-x86_64.hpkg
|
||||||
27
project/haiku/pkg/.PackageInfo
Normal file
27
project/haiku/pkg/.PackageInfo
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
name minecraftpe
|
||||||
|
version 0.6.1-1
|
||||||
|
architecture x86_64
|
||||||
|
summary "Minecraft Pocket Edition"
|
||||||
|
description "A port of minecraft pocket edition to Haiku"
|
||||||
|
packager "Li <li@silica.codes>"
|
||||||
|
vendor "Mojang"
|
||||||
|
copyrights {
|
||||||
|
"Copyright (C) 2026 by Mojang"
|
||||||
|
}
|
||||||
|
licenses {
|
||||||
|
"MIT"
|
||||||
|
}
|
||||||
|
provides {
|
||||||
|
minecraftpe = 0.6.1-1
|
||||||
|
app:minecraftpe = 0.6.1-1
|
||||||
|
}
|
||||||
|
requires {
|
||||||
|
glfw >= 3.3.7-1
|
||||||
|
openal >= 1.21.1-5
|
||||||
|
}
|
||||||
|
global-writable-files {
|
||||||
|
"settings/minecraftpe" directory keep-old
|
||||||
|
}
|
||||||
|
urls {
|
||||||
|
"https://gitea.sffempire.ru/Kolyah35/minecraft-pe-0.6.1/"
|
||||||
|
}
|
||||||
@@ -1179,6 +1179,8 @@
|
|||||||
F99F0FAD2F8436CE00F2B29A /* FoliageColor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F99F0FAB2F8436CE00F2B29A /* FoliageColor.cpp */; };
|
F99F0FAD2F8436CE00F2B29A /* FoliageColor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F99F0FAB2F8436CE00F2B29A /* FoliageColor.cpp */; };
|
||||||
F99F0FAF2F8436EB00F2B29A /* Color.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F99F0FAE2F8436EB00F2B29A /* Color.cpp */; };
|
F99F0FAF2F8436EB00F2B29A /* Color.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F99F0FAE2F8436EB00F2B29A /* Color.cpp */; };
|
||||||
F99F0FB02F8436EB00F2B29A /* Color.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F99F0FAE2F8436EB00F2B29A /* Color.cpp */; };
|
F99F0FB02F8436EB00F2B29A /* Color.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F99F0FAE2F8436EB00F2B29A /* Color.cpp */; };
|
||||||
|
BEEF202614CFF670005F0002 /* Lighting.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BEEF202614CFF670005F0001 /* Lighting.cpp */; };
|
||||||
|
BEEF202614CFF670005F0003 /* Lighting.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BEEF202614CFF670005F0001 /* Lighting.cpp */; };
|
||||||
/* End PBXBuildFile section */
|
/* End PBXBuildFile section */
|
||||||
|
|
||||||
/* Begin PBXFileReference section */
|
/* Begin PBXFileReference section */
|
||||||
@@ -2466,6 +2468,7 @@
|
|||||||
F99F0FA82F84369F00F2B29A /* GrassColor.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = GrassColor.cpp; sourceTree = "<group>"; };
|
F99F0FA82F84369F00F2B29A /* GrassColor.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = GrassColor.cpp; sourceTree = "<group>"; };
|
||||||
F99F0FAB2F8436CE00F2B29A /* FoliageColor.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = FoliageColor.cpp; sourceTree = "<group>"; };
|
F99F0FAB2F8436CE00F2B29A /* FoliageColor.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = FoliageColor.cpp; sourceTree = "<group>"; };
|
||||||
F99F0FAE2F8436EB00F2B29A /* Color.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = Color.cpp; sourceTree = "<group>"; };
|
F99F0FAE2F8436EB00F2B29A /* Color.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = Color.cpp; sourceTree = "<group>"; };
|
||||||
|
BEEF202614CFF670005F0001 /* Lighting.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Lighting.cpp; path = Lighting.cpp; sourceTree = "<group>"; };
|
||||||
/* End PBXFileReference section */
|
/* End PBXFileReference section */
|
||||||
|
|
||||||
/* Begin PBXFrameworksBuildPhase section */
|
/* Begin PBXFrameworksBuildPhase section */
|
||||||
@@ -3533,6 +3536,7 @@
|
|||||||
D5B50CF114CFF66F005F7284 /* TileRenderer.cpp */,
|
D5B50CF114CFF66F005F7284 /* TileRenderer.cpp */,
|
||||||
D5B50CF214CFF66F005F7284 /* TileRenderer.h */,
|
D5B50CF214CFF66F005F7284 /* TileRenderer.h */,
|
||||||
D5B50CF314CFF66F005F7284 /* VertecDecl.h */,
|
D5B50CF314CFF66F005F7284 /* VertecDecl.h */,
|
||||||
|
BEEF202614CFF670005F0001 /* Lighting.cpp */,
|
||||||
);
|
);
|
||||||
path = renderer;
|
path = renderer;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
@@ -5439,6 +5443,7 @@
|
|||||||
D5D8C4C41639341100FD35F0 /* Motive.cpp in Sources */,
|
D5D8C4C41639341100FD35F0 /* Motive.cpp in Sources */,
|
||||||
D5D8C4C8163934BB00FD35F0 /* HangingEntityItem.cpp in Sources */,
|
D5D8C4C8163934BB00FD35F0 /* HangingEntityItem.cpp in Sources */,
|
||||||
D5D8C4CC1639362F00FD35F0 /* NetherReactorPattern.cpp in Sources */,
|
D5D8C4CC1639362F00FD35F0 /* NetherReactorPattern.cpp in Sources */,
|
||||||
|
BEEF202614CFF670005F0002 /* Lighting.cpp in Sources */,
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
};
|
};
|
||||||
@@ -5821,6 +5826,7 @@
|
|||||||
042A91AF16B17517007ABBC6 /* NinePatch.cpp in Sources */,
|
042A91AF16B17517007ABBC6 /* NinePatch.cpp in Sources */,
|
||||||
042A91B016B17517007ABBC6 /* OptionsGroup.cpp in Sources */,
|
042A91B016B17517007ABBC6 /* OptionsGroup.cpp in Sources */,
|
||||||
042A91B216B17517007ABBC6 /* TextBox.cpp in Sources */,
|
042A91B216B17517007ABBC6 /* TextBox.cpp in Sources */,
|
||||||
|
BEEF202614CFF670005F0003 /* Lighting.cpp in Sources */,
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -351,7 +351,8 @@ StartupResult RakPeer::Startup( unsigned short maxConnections, SocketDescriptor
|
|||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
threadPriority=0;
|
threadPriority=0;
|
||||||
|
|
||||||
|
#elif defined(__HAIKU__)
|
||||||
|
threadPriority=40;
|
||||||
#else
|
#else
|
||||||
threadPriority=1000;
|
threadPriority=1000;
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -17,8 +17,8 @@ using namespace RakNet;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#elif defined(__HAIKU__)
|
||||||
|
#include <kernel/OS.h>
|
||||||
#else
|
#else
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#endif
|
#endif
|
||||||
@@ -93,9 +93,10 @@ int RakThread::Create( void* start_address( void* ), void *arglist, int priority
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#elif defined(__HAIKU__)
|
||||||
|
thread_id threadHandle = spawn_thread((thread_func)start_address, "RakThread", priority, arglist);
|
||||||
|
int res = resume_thread(threadHandle);
|
||||||
|
return res == B_OK ? 0 : 1;
|
||||||
#else
|
#else
|
||||||
pthread_t threadHandle;
|
pthread_t threadHandle;
|
||||||
// Create thread linux
|
// Create thread linux
|
||||||
|
|||||||
@@ -42,10 +42,10 @@ SocketLayerOverride *SocketLayer::slo=0;
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(__HAIKU__)
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <ifaddrs.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1436,8 +1436,25 @@ RakNet::RakString SocketLayer::GetSubNetForSocketAndIp(SOCKET inSock, RakNet::Ra
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return "";
|
return "";
|
||||||
#else
|
#elif defined(__HAIKU__)
|
||||||
|
struct ifaddrs *ifap, *ifa;
|
||||||
|
getifaddrs (&ifap);
|
||||||
|
for (ifa = ifap; ifa; ifa = ifa->ifa_next) {
|
||||||
|
if (ifa->ifa_addr && ifa->ifa_addr->sa_family==AF_INET) {
|
||||||
|
sockaddr_in* sa = (sockaddr_in*)ifa->ifa_addr;
|
||||||
|
char* ip_addr = inet_ntoa(sa->sin_addr);
|
||||||
|
if (inIpString == ip_addr) {
|
||||||
|
sockaddr_in* sa = (sockaddr_in*)ifa->ifa_netmask;
|
||||||
|
char* netmask = inet_ntoa(sa->sin_addr);
|
||||||
|
|
||||||
|
freeifaddrs(ifap);
|
||||||
|
return netmask;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
freeifaddrs(ifap);
|
||||||
|
return "";
|
||||||
|
#else
|
||||||
int fd,fd2;
|
int fd,fd2;
|
||||||
fd2 = socket__(AF_INET, SOCK_DGRAM, 0);
|
fd2 = socket__(AF_INET, SOCK_DGRAM, 0);
|
||||||
|
|
||||||
@@ -1648,7 +1665,7 @@ void GetMyIP_Win32( SystemAddress addresses[MAXIMUM_NUMBER_OF_INTERNAL_IDS] )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// #else
|
// #else
|
||||||
/*
|
|
||||||
void GetMyIP_Linux( SystemAddress addresses[MAXIMUM_NUMBER_OF_INTERNAL_IDS] )
|
void GetMyIP_Linux( SystemAddress addresses[MAXIMUM_NUMBER_OF_INTERNAL_IDS] )
|
||||||
{
|
{
|
||||||
struct ifaddrs *ifaddr, *ifa;
|
struct ifaddrs *ifaddr, *ifa;
|
||||||
@@ -1699,7 +1716,7 @@ void GetMyIP_Linux( SystemAddress addresses[MAXIMUM_NUMBER_OF_INTERNAL_IDS] )
|
|||||||
|
|
||||||
freeifaddrs(ifaddr);
|
freeifaddrs(ifaddr);
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1707,10 +1724,10 @@ void SocketLayer::GetMyIP( SystemAddress addresses[MAXIMUM_NUMBER_OF_INTERNAL_ID
|
|||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
GetMyIP_Win32(addresses);
|
GetMyIP_Win32(addresses);
|
||||||
|
#elif defined(__HAIKU__)
|
||||||
|
GetMyIP_Linux(addresses);
|
||||||
#else
|
#else
|
||||||
// GetMyIP_Linux(addresses);
|
// GetMyIP_Linux(addresses);
|
||||||
GetMyIP_Win32(addresses);
|
GetMyIP_Win32(addresses);
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
#include "UDPForwarder.h"
|
#include "UDPForwarder.h"
|
||||||
|
|
||||||
|
#if defined(__HAIKU__)
|
||||||
|
#include <sys/select.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#if _RAKNET_SUPPORT_UDPForwarder==1
|
#if _RAKNET_SUPPORT_UDPForwarder==1
|
||||||
|
|
||||||
#include "GetTime.h"
|
#include "GetTime.h"
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
#include <shellapi.h>
|
#include <shellapi.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifdef __EMSCRIPTEN__
|
#ifdef __EMSCRIPTEN__
|
||||||
#include <emscripten/html5.h>
|
#include <emscripten/html5.h>
|
||||||
#endif
|
#endif
|
||||||
@@ -31,12 +32,19 @@ static void png_funcReadFile(png_structp pngPtr, png_bytep data, png_size_t leng
|
|||||||
class AppPlatform_glfw: public AppPlatform
|
class AppPlatform_glfw: public AppPlatform
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
AppPlatform_glfw()
|
|
||||||
|
#ifdef __HAIKU__
|
||||||
|
std::string game_directory = "/system/data/minecraftpe/";
|
||||||
|
#else
|
||||||
|
std::string game_directory = "";
|
||||||
|
#endif
|
||||||
|
|
||||||
|
AppPlatform_glfw()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
BinaryBlob readAssetFile(const std::string& filename) override {
|
BinaryBlob readAssetFile(const std::string& filename) override {
|
||||||
FILE* fp = fopen(("data/" + filename).c_str(), "r");
|
FILE* fp = fopen((game_directory + "data/" + filename).c_str(), "r");
|
||||||
if (!fp)
|
if (!fp)
|
||||||
return BinaryBlob();
|
return BinaryBlob();
|
||||||
|
|
||||||
@@ -73,7 +81,7 @@ public:
|
|||||||
|
|
||||||
TextureData out;
|
TextureData out;
|
||||||
|
|
||||||
std::string filename = textureFolder? "data/images/" + filename_
|
std::string filename = textureFolder? (game_directory + "data/images/") + filename_
|
||||||
: filename_;
|
: filename_;
|
||||||
std::ifstream source(filename.c_str(), std::ios::binary);
|
std::ifstream source(filename.c_str(), std::ios::binary);
|
||||||
|
|
||||||
|
|||||||
@@ -745,6 +745,7 @@ void Minecraft::tickInput() {
|
|||||||
int dst = options.getIntValue(OPTIONS_VIEW_DISTANCE);
|
int dst = options.getIntValue(OPTIONS_VIEW_DISTANCE);
|
||||||
options.set(OPTIONS_VIEW_DISTANCE, (dst + 1) % 4);
|
options.set(OPTIONS_VIEW_DISTANCE, (dst + 1) % 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CHEATS
|
#ifdef CHEATS
|
||||||
if (key == Keyboard::KEY_U) {
|
if (key == Keyboard::KEY_U) {
|
||||||
onGraphicsReset();
|
onGraphicsReset();
|
||||||
@@ -1128,6 +1129,8 @@ void Minecraft::init()
|
|||||||
textures = new Textures(&options, platform());
|
textures = new Textures(&options, platform());
|
||||||
textures->addDynamicTexture(new WaterTexture());
|
textures->addDynamicTexture(new WaterTexture());
|
||||||
textures->addDynamicTexture(new WaterSideTexture());
|
textures->addDynamicTexture(new WaterSideTexture());
|
||||||
|
textures->addDynamicTexture(new LavaTexture());
|
||||||
|
textures->addDynamicTexture(new LavaSideTexture());
|
||||||
textures->addDynamicTexture(new FireTexture());
|
textures->addDynamicTexture(new FireTexture());
|
||||||
gui.texturesLoaded(textures);
|
gui.texturesLoaded(textures);
|
||||||
|
|
||||||
|
|||||||
@@ -54,18 +54,24 @@ OptionBool limitFramerate("limitFramerate", false);
|
|||||||
OptionBool vsync("vsync", true);
|
OptionBool vsync("vsync", true);
|
||||||
OptionBool fancyGraphics("fancyGraphics", true);
|
OptionBool fancyGraphics("fancyGraphics", true);
|
||||||
OptionBool viewBobbing("viewBobbing", true);
|
OptionBool viewBobbing("viewBobbing", true);
|
||||||
OptionBool ambientOcclusion("ao", false);
|
OptionBool ambientOcclusion("ao", true);
|
||||||
|
|
||||||
|
OptionBool useNormalLighting("normalLighting", true);
|
||||||
|
|
||||||
OptionBool useTouchscreen("useTouchscreen", true);
|
OptionBool useTouchscreen("useTouchscreen", true);
|
||||||
|
|
||||||
OptionBool serverVisible("servervisible", true);
|
OptionBool serverVisible("servervisible", true);
|
||||||
|
|
||||||
OptionBool foliageTint("foliagetint", false);
|
OptionBool foliageTint("foliagetint", true);
|
||||||
|
|
||||||
OptionInt fogType("fogType", 0, 0, 2);
|
OptionInt fogType("fogType", 0, 0, 2);
|
||||||
|
|
||||||
OptionBool javaHud("javaHud", false);
|
OptionBool javaHud("javaHud", false);
|
||||||
|
|
||||||
|
OptionBool blockOutline("blockOutline", false);
|
||||||
|
|
||||||
|
OptionBool restoredAnims("restoredAnims", true);
|
||||||
|
|
||||||
OptionInt keyForward("key.forward", Keyboard::KEY_W);
|
OptionInt keyForward("key.forward", Keyboard::KEY_W);
|
||||||
OptionInt keyLeft("key.left", Keyboard::KEY_A);
|
OptionInt keyLeft("key.left", Keyboard::KEY_A);
|
||||||
OptionInt keyBack("key.back", Keyboard::KEY_S);
|
OptionInt keyBack("key.back", Keyboard::KEY_S);
|
||||||
@@ -142,7 +148,11 @@ void Options::initTable() {
|
|||||||
|
|
||||||
m_options[OPTIONS_USE_TOUCHSCREEN] = &useTouchscreen;
|
m_options[OPTIONS_USE_TOUCHSCREEN] = &useTouchscreen;
|
||||||
|
|
||||||
|
m_options[OPTIONS_BLOCK_OUTLINE] = &blockOutline;
|
||||||
|
|
||||||
|
m_options[OPTIONS_NORMAL_LIGHTING] = &useNormalLighting;
|
||||||
|
|
||||||
|
m_options[OPTIONS_RESTORED_ANIMS] = &restoredAnims;
|
||||||
|
|
||||||
m_options[OPTIONS_SERVER_VISIBLE] = &serverVisible;
|
m_options[OPTIONS_SERVER_VISIBLE] = &serverVisible;
|
||||||
|
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ enum OptionId {
|
|||||||
OPTIONS_LIMIT_FRAMERATE,
|
OPTIONS_LIMIT_FRAMERATE,
|
||||||
OPTIONS_VSYNC,
|
OPTIONS_VSYNC,
|
||||||
OPTIONS_FANCY_GRAPHICS,
|
OPTIONS_FANCY_GRAPHICS,
|
||||||
|
OPTIONS_NORMAL_LIGHTING,
|
||||||
|
|
||||||
// Cheats / debug
|
// Cheats / debug
|
||||||
OPTIONS_FLY_SPEED,
|
OPTIONS_FLY_SPEED,
|
||||||
@@ -56,6 +57,7 @@ enum OptionId {
|
|||||||
OPTIONS_IS_FLYING,
|
OPTIONS_IS_FLYING,
|
||||||
|
|
||||||
// Control
|
// Control
|
||||||
|
OPTIONS_BLOCK_OUTLINE,
|
||||||
OPTIONS_USE_MOUSE_FOR_DIGGING,
|
OPTIONS_USE_MOUSE_FOR_DIGGING,
|
||||||
OPTIONS_IS_LEFT_HANDED,
|
OPTIONS_IS_LEFT_HANDED,
|
||||||
OPTIONS_IS_JOY_TOUCH_AREA,
|
OPTIONS_IS_JOY_TOUCH_AREA,
|
||||||
@@ -87,6 +89,7 @@ enum OptionId {
|
|||||||
OPTIONS_FOLIAGE_TINT,
|
OPTIONS_FOLIAGE_TINT,
|
||||||
OPTIONS_FOG_TYPE,
|
OPTIONS_FOG_TYPE,
|
||||||
OPTIONS_JAVA_HUD,
|
OPTIONS_JAVA_HUD,
|
||||||
|
OPTIONS_RESTORED_ANIMS,
|
||||||
// Should be last!
|
// Should be last!
|
||||||
OPTIONS_COUNT
|
OPTIONS_COUNT
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -18,6 +18,8 @@ OptionsFile::OptionsFile() {
|
|||||||
settingsPath = "options.txt";
|
settingsPath = "options.txt";
|
||||||
#elif defined(__EMSCRIPTEN__)
|
#elif defined(__EMSCRIPTEN__)
|
||||||
settingsPath = "/games/com.mojang/options.txt";
|
settingsPath = "/games/com.mojang/options.txt";
|
||||||
|
#elif defined(__HAIKU__)
|
||||||
|
settingsPath = "/system/settings/minecraftpe/options.txt";
|
||||||
#else
|
#else
|
||||||
settingsPath = "options.txt";
|
settingsPath = "options.txt";
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -596,7 +596,8 @@ void Gui::renderProgressIndicator( const bool isTouchInterface, const int screen
|
|||||||
bool bowEquipped = currentItem != NULL ? currentItem->getItem() == Item::bow : false;
|
bool bowEquipped = currentItem != NULL ? currentItem->getItem() == Item::bow : false;
|
||||||
bool itemInUse = currentItem != NULL ? currentItem->getItem() == minecraft->player->getUseItem()->getItem() : false;
|
bool itemInUse = currentItem != NULL ? currentItem->getItem() == minecraft->player->getUseItem()->getItem() : false;
|
||||||
if ((!isTouchInterface || minecraft->options.getBooleanValue(OPTIONS_IS_JOY_TOUCH_AREA)
|
if ((!isTouchInterface || minecraft->options.getBooleanValue(OPTIONS_IS_JOY_TOUCH_AREA)
|
||||||
|| (bowEquipped && itemInUse)) && !minecraft->options.getBooleanValue(OPTIONS_HIDEGUI)) {
|
|| (bowEquipped && itemInUse)) && !minecraft->options.getBooleanValue(OPTIONS_HIDEGUI))
|
||||||
|
{
|
||||||
minecraft->textures->loadAndBindTexture("gui/icons.png");
|
minecraft->textures->loadAndBindTexture("gui/icons.png");
|
||||||
glEnable(GL_BLEND);
|
glEnable(GL_BLEND);
|
||||||
glBlendFunc2(GL_ONE_MINUS_DST_COLOR, GL_ONE_MINUS_SRC_COLOR);
|
glBlendFunc2(GL_ONE_MINUS_DST_COLOR, GL_ONE_MINUS_SRC_COLOR);
|
||||||
@@ -620,7 +621,7 @@ void Gui::renderProgressIndicator( const bool isTouchInterface, const int screen
|
|||||||
const float x = InvGuiScale * minecraft->inputHolder->mousex;
|
const float x = InvGuiScale * minecraft->inputHolder->mousex;
|
||||||
const float y = InvGuiScale * minecraft->inputHolder->mousey;
|
const float y = InvGuiScale * minecraft->inputHolder->mousey;
|
||||||
glTranslatef2(x, y, 0);
|
glTranslatef2(x, y, 0);
|
||||||
drawArrayVT(rcFeedbackOuter.vboId, rcFeedbackOuter.vertexCount, 24);
|
drawArrayVT(rcFeedbackOuter.vboId, rcFeedbackOuter.vertexCount, 36);
|
||||||
glTranslatef2(-x, -y, 0);
|
glTranslatef2(-x, -y, 0);
|
||||||
|
|
||||||
glEnable2(GL_TEXTURE_2D);
|
glEnable2(GL_TEXTURE_2D);
|
||||||
@@ -641,12 +642,12 @@ void Gui::renderProgressIndicator( const bool isTouchInterface, const int screen
|
|||||||
const float y = InvGuiScale * minecraft->inputHolder->mousey;
|
const float y = InvGuiScale * minecraft->inputHolder->mousey;
|
||||||
glPushMatrix2();
|
glPushMatrix2();
|
||||||
glTranslatef2(x, y, 0);
|
glTranslatef2(x, y, 0);
|
||||||
drawArrayVT(rcFeedbackOuter.vboId, rcFeedbackOuter.vertexCount, 24);
|
drawArrayVT(rcFeedbackOuter.vboId, rcFeedbackOuter.vertexCount, 36);
|
||||||
glScalef2(0.5f + progress, 0.5f + progress, 1);
|
glScalef2(0.5f + progress, 0.5f + progress, 1);
|
||||||
//glDisable2(GL_CULL_FACE);
|
//glDisable2(GL_CULL_FACE);
|
||||||
glColor4f2(1, 1, 1, 1);
|
glColor4f2(1, 1, 1, 1);
|
||||||
glBlendFunc2(GL_ONE_MINUS_DST_COLOR, GL_ONE_MINUS_SRC_COLOR);
|
glBlendFunc2(GL_ONE_MINUS_DST_COLOR, GL_ONE_MINUS_SRC_COLOR);
|
||||||
drawArrayVT(rcFeedbackInner.vboId, rcFeedbackInner.vertexCount, 24, GL_TRIANGLE_FAN);
|
drawArrayVT(rcFeedbackInner.vboId, rcFeedbackInner.vertexCount, 36, GL_TRIANGLE_FAN);
|
||||||
glPopMatrix2();
|
glPopMatrix2();
|
||||||
|
|
||||||
glDisable(GL_BLEND);
|
glDisable(GL_BLEND);
|
||||||
@@ -1035,7 +1036,10 @@ void Gui::renderChatMessages( const int screenHeight, unsigned int max, bool isC
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Gui::renderToolBar( float a, int ySlot, const int screenWidth ) {
|
void Gui::renderToolBar( float a, int ySlot, const int screenWidth ) {
|
||||||
glColor4f2(1, 1, 1, .5);
|
glColor4f2(1, 1, 1, 1);
|
||||||
|
glEnable(GL_BLEND);
|
||||||
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
|
|
||||||
minecraft->textures->loadAndBindTexture("gui/gui.png");
|
minecraft->textures->loadAndBindTexture("gui/gui.png");
|
||||||
|
|
||||||
Inventory* inventory = minecraft->player->inventory;
|
Inventory* inventory = minecraft->player->inventory;
|
||||||
|
|||||||
@@ -36,6 +36,16 @@ void OptionsItem::render( Minecraft* minecraft, int xm, int ym ) {
|
|||||||
}
|
}
|
||||||
text += ": " + scaleText;
|
text += ": " + scaleText;
|
||||||
}
|
}
|
||||||
|
if (m_optionId == OPTIONS_FOG_TYPE) {
|
||||||
|
int value = minecraft->options.getIntValue(OPTIONS_FOG_TYPE);
|
||||||
|
std::string scaleText;
|
||||||
|
switch (value) {
|
||||||
|
case 0: scaleText = I18n::get("options.fogType.vanilla"); break;
|
||||||
|
case 1: scaleText = I18n::get("options.fogType.java"); break;
|
||||||
|
case 2: scaleText = I18n::get("options.fogType.unused"); break;
|
||||||
|
}
|
||||||
|
text += ": " + scaleText;
|
||||||
|
}
|
||||||
|
|
||||||
minecraft->font->draw(text, (float)x, (float)y + yOffset, 0x909090, false);
|
minecraft->font->draw(text, (float)x, (float)y + yOffset, 0x909090, false);
|
||||||
super::render(minecraft, xm, ym);
|
super::render(minecraft, xm, ym);
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ void CreditsScreen::init() {
|
|||||||
_lines.push_back("karson");
|
_lines.push_back("karson");
|
||||||
_lines.push_back("deepfriedwaffles");
|
_lines.push_back("deepfriedwaffles");
|
||||||
_lines.push_back("EpikIzCool");
|
_lines.push_back("EpikIzCool");
|
||||||
|
_lines.push_back("fileshredder");
|
||||||
_lines.push_back("");
|
_lines.push_back("");
|
||||||
// avoid color tags around the URL so it isn't mangled by the parser please
|
// avoid color tags around the URL so it isn't mangled by the parser please
|
||||||
_lines.push_back("Join our Discord server: https://discord.gg/c58YesBxve");
|
_lines.push_back("Join our Discord server: https://discord.gg/c58YesBxve");
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
#include "IngameBlockSelectionScreen.h"
|
#include "IngameBlockSelectionScreen.h"
|
||||||
#include "../../renderer/TileRenderer.h"
|
#include "../../renderer/TileRenderer.h"
|
||||||
|
#include "../../renderer/Lighting.h"
|
||||||
#include "../../player/LocalPlayer.h"
|
#include "../../player/LocalPlayer.h"
|
||||||
#include "../../renderer/gles.h"
|
#include "../../renderer/gles.h"
|
||||||
#include "../../Minecraft.h"
|
#include "../../Minecraft.h"
|
||||||
@@ -80,10 +81,10 @@ void IngameBlockSelectionScreen::renderSlots()
|
|||||||
|
|
||||||
blitOffset = -90;
|
blitOffset = -90;
|
||||||
|
|
||||||
//glEnable2(GL_RESCALE_NORMAL);
|
glEnable2(GL_RESCALE_NORMAL);
|
||||||
//glPushMatrix2();
|
//glPushMatrix2();
|
||||||
//glRotatef2(180, 1, 0, 0);
|
//glRotatef2(180, 1, 0, 0);
|
||||||
//Lighting::turnOn();
|
Lighting::turnOn(minecraft);
|
||||||
//glPopMatrix2();
|
//glPopMatrix2();
|
||||||
|
|
||||||
minecraft->textures->loadAndBindTexture("gui/gui.png");
|
minecraft->textures->loadAndBindTexture("gui/gui.png");
|
||||||
@@ -122,8 +123,8 @@ void IngameBlockSelectionScreen::renderSlots()
|
|||||||
//w.stop();
|
//w.stop();
|
||||||
//w.printEvery(1000, "render-blocksel");
|
//w.printEvery(1000, "render-blocksel");
|
||||||
|
|
||||||
//glDisable2(GL_RESCALE_NORMAL);
|
glDisable2(GL_RESCALE_NORMAL);
|
||||||
//Lighting::turnOn();
|
Lighting::turnOn(minecraft);
|
||||||
}
|
}
|
||||||
|
|
||||||
int IngameBlockSelectionScreen::getSlotPosX(int slotX) {
|
int IngameBlockSelectionScreen::getSlotPosX(int slotX) {
|
||||||
|
|||||||
@@ -208,7 +208,9 @@ void OptionsScreen::generateOptionScreens() {
|
|||||||
// // Controls Pane
|
// // Controls Pane
|
||||||
optionPanes[2]->addOptionItem(OPTIONS_INVERT_Y_MOUSE, minecraft)
|
optionPanes[2]->addOptionItem(OPTIONS_INVERT_Y_MOUSE, minecraft)
|
||||||
.addOptionItem(OPTIONS_USE_TOUCHSCREEN, minecraft)
|
.addOptionItem(OPTIONS_USE_TOUCHSCREEN, minecraft)
|
||||||
.addOptionItem(OPTIONS_AUTOJUMP, minecraft);
|
.addOptionItem(OPTIONS_AUTOJUMP, minecraft)
|
||||||
|
.addOptionItem(OPTIONS_BLOCK_OUTLINE, minecraft)
|
||||||
|
.addOptionItem(OPTIONS_IS_JOY_TOUCH_AREA, minecraft);
|
||||||
|
|
||||||
for (int i = OPTIONS_KEY_FORWARD; i <= OPTIONS_KEY_USE; i++) {
|
for (int i = OPTIONS_KEY_FORWARD; i <= OPTIONS_KEY_USE; i++) {
|
||||||
optionPanes[2]->addOptionItem((OptionId)i, minecraft);
|
optionPanes[2]->addOptionItem((OptionId)i, minecraft);
|
||||||
@@ -224,14 +226,16 @@ void OptionsScreen::generateOptionScreens() {
|
|||||||
.addOptionItem(OPTIONS_RENDER_DEBUG, minecraft)
|
.addOptionItem(OPTIONS_RENDER_DEBUG, minecraft)
|
||||||
.addOptionItem(OPTIONS_ANAGLYPH_3D, minecraft)
|
.addOptionItem(OPTIONS_ANAGLYPH_3D, minecraft)
|
||||||
.addOptionItem(OPTIONS_VIEW_BOBBING, minecraft)
|
.addOptionItem(OPTIONS_VIEW_BOBBING, minecraft)
|
||||||
.addOptionItem(OPTIONS_AMBIENT_OCCLUSION, minecraft);
|
.addOptionItem(OPTIONS_AMBIENT_OCCLUSION, minecraft)
|
||||||
|
.addOptionItem(OPTIONS_NORMAL_LIGHTING, minecraft);
|
||||||
|
|
||||||
optionPanes[4]->addOptionItem(OPTIONS_ALLOW_SPRINT, minecraft)
|
optionPanes[4]->addOptionItem(OPTIONS_ALLOW_SPRINT, minecraft)
|
||||||
.addOptionItem(OPTIONS_BAR_ON_TOP, minecraft)
|
.addOptionItem(OPTIONS_BAR_ON_TOP, minecraft)
|
||||||
.addOptionItem(OPTIONS_RPI_CURSOR, minecraft)
|
.addOptionItem(OPTIONS_RPI_CURSOR, minecraft)
|
||||||
.addOptionItem(OPTIONS_FOLIAGE_TINT, minecraft)
|
.addOptionItem(OPTIONS_FOLIAGE_TINT, minecraft)
|
||||||
.addOptionItem(OPTIONS_JAVA_HUD, minecraft)
|
.addOptionItem(OPTIONS_JAVA_HUD, minecraft)
|
||||||
.addOptionItem(OPTIONS_FOG_TYPE, minecraft);
|
.addOptionItem(OPTIONS_FOG_TYPE, minecraft)
|
||||||
|
.addOptionItem(OPTIONS_RESTORED_ANIMS, minecraft);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -203,7 +203,7 @@ void ModelPart::compile( float scale )
|
|||||||
void ModelPart::draw()
|
void ModelPart::draw()
|
||||||
{
|
{
|
||||||
#ifdef OPENGL_ES
|
#ifdef OPENGL_ES
|
||||||
drawArrayVT_NoState(vboId, cubes.size() * 2 * 3 * 6, 24);
|
drawArrayVTN_NoState(vboId, cubes.size() * 2 * 3 * 6, 36);
|
||||||
#else
|
#else
|
||||||
glCallList(list);
|
glCallList(list);
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -43,6 +43,18 @@ void PolygonQuad::mirror() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void PolygonQuad::render(Tesselator& t, float scale, int vboId /* = -1 */) {
|
void PolygonQuad::render(Tesselator& t, float scale, int vboId /* = -1 */) {
|
||||||
|
Vec3 v0 = vertices[0].pos - vertices[1].pos;
|
||||||
|
Vec3 v1 = vertices[2].pos - vertices[1].pos;
|
||||||
|
Vec3 n = v1.cross(v0).normalized();
|
||||||
|
if (_flipNormal == true)
|
||||||
|
{
|
||||||
|
t.normal(-n.x , -n.y , -n.z );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
t.normal(n.x , n.y , n.z );
|
||||||
|
}
|
||||||
|
|
||||||
for (int i = 0; i < 4; i++) {
|
for (int i = 0; i < 4; i++) {
|
||||||
VertexPT& v = vertices[i];
|
VertexPT& v = vertices[i];
|
||||||
t.vertexUV(v.pos.x * scale, v.pos.y * scale, v.pos.z * scale, v.u, v.v);
|
t.vertexUV(v.pos.x * scale, v.pos.y * scale, v.pos.z * scale, v.u, v.v);
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -21,11 +21,12 @@
|
|||||||
#include "../../world/item/BowItem.h"
|
#include "../../world/item/BowItem.h"
|
||||||
#include "../../world/level/tile/LeafTile.h"
|
#include "../../world/level/tile/LeafTile.h"
|
||||||
#include "entity/HumanoidMobRenderer.h"
|
#include "entity/HumanoidMobRenderer.h"
|
||||||
|
#include "Lighting.h"
|
||||||
|
|
||||||
//static StopwatchHandler handler;
|
//static StopwatchHandler handler;
|
||||||
|
|
||||||
ItemInHandRenderer::ItemInHandRenderer( Minecraft* mc )
|
ItemInHandRenderer::ItemInHandRenderer( Minecraft* mc )
|
||||||
: mc(mc),
|
: mc(mc),
|
||||||
lastSlot(-1),
|
lastSlot(-1),
|
||||||
height(0),
|
height(0),
|
||||||
oHeight(0),
|
oHeight(0),
|
||||||
@@ -49,21 +50,47 @@ ItemInHandRenderer::ItemInHandRenderer( Minecraft* mc )
|
|||||||
void ItemInHandRenderer::tick()
|
void ItemInHandRenderer::tick()
|
||||||
{
|
{
|
||||||
oHeight = height;
|
oHeight = height;
|
||||||
item.id = 0;
|
//item.id = 0;
|
||||||
|
|
||||||
ItemInstance* itemInHand = mc->player->inventory->getSelected();
|
ItemInstance* itemInHand = mc->player->inventory->getSelected();
|
||||||
if (itemInHand && itemInHand->count > 0) {
|
bool sameItem = (itemInHand && item.id == itemInHand->id && item.getAuxValue() == itemInHand->getAuxValue());
|
||||||
item.id = itemInHand->id;
|
|
||||||
item.setAuxValue(itemInHand->getAuxValue());
|
|
||||||
|
|
||||||
|
if (mc->options.getBooleanValue(OPTIONS_RESTORED_ANIMS)) // if enabled, restores and fixes item switching animation
|
||||||
|
{
|
||||||
|
if (!itemInHand && item.id == 0) sameItem = true;
|
||||||
|
float max = 0.4f;
|
||||||
|
float tHeight = sameItem ? 1 : 0;
|
||||||
|
float dd = tHeight - height;
|
||||||
|
if (dd < -max) dd = -max;
|
||||||
|
if (dd > max) dd = max;
|
||||||
|
|
||||||
|
height += dd;
|
||||||
|
|
||||||
|
if (height < 0.1){
|
||||||
|
if (itemInHand && itemInHand->count > 0) {
|
||||||
|
item.id = itemInHand->id;
|
||||||
|
item.setAuxValue(itemInHand->getAuxValue());
|
||||||
|
} else {
|
||||||
|
item.id = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else // otherwise use vanilla broken behaviour where it instantly switches items/blocks
|
||||||
|
{
|
||||||
|
if (itemInHand && itemInHand->count > 0) {
|
||||||
|
item.id = itemInHand->id;
|
||||||
|
item.setAuxValue(itemInHand->getAuxValue());
|
||||||
|
}
|
||||||
|
|
||||||
|
float max = 0.4f;
|
||||||
|
float tHeight = 1;//matches ? 1 : 0;
|
||||||
|
float dd = tHeight - height;
|
||||||
|
if (dd < -max) dd = -max;
|
||||||
|
if (dd > max) dd = max;
|
||||||
|
|
||||||
|
height += dd;
|
||||||
}
|
}
|
||||||
|
|
||||||
float max = 0.4f;
|
|
||||||
float tHeight = 1;//matches ? 1 : 0;
|
|
||||||
float dd = tHeight - height;
|
|
||||||
if (dd < -max) dd = -max;
|
|
||||||
if (dd > max) dd = max;
|
|
||||||
|
|
||||||
height += dd;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ItemInHandRenderer::renderItem(Mob* mob, ItemInstance* item )
|
void ItemInHandRenderer::renderItem(Mob* mob, ItemInstance* item )
|
||||||
@@ -92,7 +119,7 @@ void ItemInHandRenderer::renderItem(Mob* mob, ItemInstance* item )
|
|||||||
if(mob != NULL) {
|
if(mob != NULL) {
|
||||||
itemIcon = mob->getItemInHandIcon(item, 0);
|
itemIcon = mob->getItemInHandIcon(item, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool reTesselate(false);
|
bool reTesselate(false);
|
||||||
if(itemIcon != lastIconRendered && lastItemRendered == itemId)
|
if(itemIcon != lastIconRendered && lastItemRendered == itemId)
|
||||||
reTesselate = true;
|
reTesselate = true;
|
||||||
@@ -139,9 +166,9 @@ void ItemInHandRenderer::renderItem(Mob* mob, ItemInstance* item )
|
|||||||
float v1 = (vp * 16 + 15.99f) / 256.0f;
|
float v1 = (vp * 16 + 15.99f) / 256.0f;
|
||||||
|
|
||||||
float r = 1.0f;
|
float r = 1.0f;
|
||||||
// float xo = 0.0f;
|
// float xo = 0.0f;
|
||||||
// float yo = 0.3f;
|
// float yo = 0.3f;
|
||||||
/*
|
/*
|
||||||
//glEnable2(GL_RESCALE_NORMAL);
|
//glEnable2(GL_RESCALE_NORMAL);
|
||||||
glTranslatef2(-xo, -yo, 0);
|
glTranslatef2(-xo, -yo, 0);
|
||||||
float s = 1.5f;
|
float s = 1.5f;
|
||||||
@@ -150,19 +177,28 @@ void ItemInHandRenderer::renderItem(Mob* mob, ItemInstance* item )
|
|||||||
glRotatef2(50, 0, 1, 0);
|
glRotatef2(50, 0, 1, 0);
|
||||||
glRotatef2(45 + 290, 0, 0, 1);
|
glRotatef2(45 + 290, 0, 0, 1);
|
||||||
glTranslatef2(-15 / 16.0f, -1 / 16.0f, 0);
|
glTranslatef2(-15 / 16.0f, -1 / 16.0f, 0);
|
||||||
*/
|
*/
|
||||||
float dd = 1 / 16.0f;
|
float dd = 1 / 16.0f;
|
||||||
|
float col = 1.0f;
|
||||||
|
float br = mc->player->getBrightness(0);
|
||||||
|
|
||||||
|
|
||||||
|
t.color(col*br,col*br,col*br,1.0f);
|
||||||
|
t.normal(0.0f, 0.0f, 1.0f);
|
||||||
t.vertexUV(0, 0, 0, u0, v1);
|
t.vertexUV(0, 0, 0, u0, v1);
|
||||||
t.vertexUV(r, 0, 0, u1, v1);
|
t.vertexUV(r, 0, 0, u1, v1);
|
||||||
t.vertexUV(r, 1, 0, u1, v0);
|
t.vertexUV(r, 1, 0, u1, v0);
|
||||||
t.vertexUV(0, 1, 0, u0, v0);
|
t.vertexUV(0, 1, 0, u0, v0);
|
||||||
|
|
||||||
|
t.normal(0.0f, 0.0f, -1.0f);
|
||||||
t.vertexUV(0, 1, 0 - dd, u0, v0);
|
t.vertexUV(0, 1, 0 - dd, u0, v0);
|
||||||
t.vertexUV(r, 1, 0 - dd, u1, v0);
|
t.vertexUV(r, 1, 0 - dd, u1, v0);
|
||||||
t.vertexUV(r, 0, 0 - dd, u1, v1);
|
t.vertexUV(r, 0, 0 - dd, u1, v1);
|
||||||
t.vertexUV(0, 0, 0 - dd, u0, v1);
|
t.vertexUV(0, 0, 0 - dd, u0, v1);
|
||||||
|
|
||||||
|
col = 0.8f;
|
||||||
|
t.color(col*br,col*br,col*br,1.0f);
|
||||||
|
t.normal(-1.0f, 0.0f, 0.0f);
|
||||||
for (int i = 0; i < 16; i++) {
|
for (int i = 0; i < 16; i++) {
|
||||||
float p = i / 16.0f;
|
float p = i / 16.0f;
|
||||||
float uu = u0 + (u1 - u0) * p - 0.5f / 256.0f;
|
float uu = u0 + (u1 - u0) * p - 0.5f / 256.0f;
|
||||||
@@ -172,6 +208,7 @@ void ItemInHandRenderer::renderItem(Mob* mob, ItemInstance* item )
|
|||||||
t.vertexUV(xx, 1, 0, uu, v0);
|
t.vertexUV(xx, 1, 0, uu, v0);
|
||||||
t.vertexUV(xx, 1, 0 - dd, uu, v0);
|
t.vertexUV(xx, 1, 0 - dd, uu, v0);
|
||||||
}
|
}
|
||||||
|
t.normal(1.0f, 0.0f, 0.0f);
|
||||||
for (int i = 0; i < 16; i++) {
|
for (int i = 0; i < 16; i++) {
|
||||||
float p = i / 16.0f;
|
float p = i / 16.0f;
|
||||||
float uu = u0 + (u1 - u0) * p - 0.5f / 256.0f;
|
float uu = u0 + (u1 - u0) * p - 0.5f / 256.0f;
|
||||||
@@ -181,6 +218,10 @@ void ItemInHandRenderer::renderItem(Mob* mob, ItemInstance* item )
|
|||||||
t.vertexUV(xx, 0, 0, uu, v1);
|
t.vertexUV(xx, 0, 0, uu, v1);
|
||||||
t.vertexUV(xx, 0, 0 - dd, uu, v1);
|
t.vertexUV(xx, 0, 0 - dd, uu, v1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
col = 0.6f;
|
||||||
|
t.color(col*br,col*br,col*br,1.0f);
|
||||||
|
t.normal(0.0f, 1.0f, 0.0f);
|
||||||
for (int i = 0; i < 16; i++) {
|
for (int i = 0; i < 16; i++) {
|
||||||
float p = i / 16.0f;
|
float p = i / 16.0f;
|
||||||
float vv = v1 + (v0 - v1) * p - 0.5f / 256.0f;
|
float vv = v1 + (v0 - v1) * p - 0.5f / 256.0f;
|
||||||
@@ -190,6 +231,7 @@ void ItemInHandRenderer::renderItem(Mob* mob, ItemInstance* item )
|
|||||||
t.vertexUV(r, yy, 0 - dd, u1, vv);
|
t.vertexUV(r, yy, 0 - dd, u1, vv);
|
||||||
t.vertexUV(0, yy, 0 - dd, u0, vv);
|
t.vertexUV(0, yy, 0 - dd, u0, vv);
|
||||||
}
|
}
|
||||||
|
t.normal(0.0f, -1.0f, 0.0f);
|
||||||
for (int i = 0; i < 16; i++) {
|
for (int i = 0; i < 16; i++) {
|
||||||
float p = i / 16.0f;
|
float p = i / 16.0f;
|
||||||
float vv = v1 + (v0 - v1) * p - 0.5f / 256.0f;
|
float vv = v1 + (v0 - v1) * p - 0.5f / 256.0f;
|
||||||
@@ -219,7 +261,7 @@ void ItemInHandRenderer::renderItem(Mob* mob, ItemInstance* item )
|
|||||||
}
|
}
|
||||||
mc->textures->loadAndBindTexture(renderObject.texture);
|
mc->textures->loadAndBindTexture(renderObject.texture);
|
||||||
|
|
||||||
drawArrayVT_NoState(renderObject.chunk.vboId, renderObject.chunk.vertexCount);
|
drawArrayVTN_NoState(renderObject.chunk.vboId, renderObject.chunk.vertexCount);
|
||||||
if (renderObject.isFlat)
|
if (renderObject.isFlat)
|
||||||
glPopMatrix2();
|
glPopMatrix2();
|
||||||
}
|
}
|
||||||
@@ -227,6 +269,7 @@ void ItemInHandRenderer::renderItem(Mob* mob, ItemInstance* item )
|
|||||||
//handler.printEvery(100);
|
//handler.printEvery(100);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ItemInHandRenderer::render( float a )
|
void ItemInHandRenderer::render( float a )
|
||||||
{
|
{
|
||||||
//return;
|
//return;
|
||||||
@@ -241,6 +284,8 @@ void ItemInHandRenderer::render( float a )
|
|||||||
glPushMatrix2();
|
glPushMatrix2();
|
||||||
glRotatef2(player->xRotO + (player->xRot - player->xRotO) * a, 1, 0, 0);
|
glRotatef2(player->xRotO + (player->xRot - player->xRotO) * a, 1, 0, 0);
|
||||||
glRotatef2(player->yRotO + (player->yRot - player->yRotO) * a, 0, 1, 0);
|
glRotatef2(player->yRotO + (player->yRot - player->yRotO) * a, 0, 1, 0);
|
||||||
|
glEnable(GL_RESCALE_NORMAL);
|
||||||
|
Lighting::turnOn(mc);
|
||||||
glPopMatrix2();
|
glPopMatrix2();
|
||||||
|
|
||||||
float br = mc->level->getBrightness(Mth::floor(player->x), Mth::floor(player->y), Mth::floor(player->z));
|
float br = mc->level->getBrightness(Mth::floor(player->x), Mth::floor(player->y), Mth::floor(player->z));
|
||||||
@@ -293,7 +338,7 @@ void ItemInHandRenderer::render( float a )
|
|||||||
glTranslatef2(0.7f * d, -0.65f * d - (1 - h) * 0.6f, -0.9f * d);
|
glTranslatef2(0.7f * d, -0.65f * d - (1 - h) * 0.6f, -0.9f * d);
|
||||||
|
|
||||||
glRotatef2(45, 0, 1, 0);
|
glRotatef2(45, 0, 1, 0);
|
||||||
//glEnable2(GL_RESCALE_NORMAL);
|
glEnable2(GL_RESCALE_NORMAL);
|
||||||
glRotatef2(-swing3 * 20, 0, 1, 0);
|
glRotatef2(-swing3 * 20, 0, 1, 0);
|
||||||
glRotatef2(-swing2 * 20, 0, 0, 1);
|
glRotatef2(-swing2 * 20, 0, 0, 1);
|
||||||
glRotatef2(-swing2 * 80, 1, 0, 0);
|
glRotatef2(-swing2 * 80, 1, 0, 0);
|
||||||
@@ -330,7 +375,9 @@ void ItemInHandRenderer::render( float a )
|
|||||||
}
|
}
|
||||||
glEnableClientState2(GL_VERTEX_ARRAY);
|
glEnableClientState2(GL_VERTEX_ARRAY);
|
||||||
glEnableClientState2(GL_TEXTURE_COORD_ARRAY);
|
glEnableClientState2(GL_TEXTURE_COORD_ARRAY);
|
||||||
|
glEnableClientState2(GL_NORMAL_ARRAY);
|
||||||
renderItem(player, item);
|
renderItem(player, item);
|
||||||
|
glDisableClientState2(GL_NORMAL_ARRAY);
|
||||||
glDisableClientState2(GL_VERTEX_ARRAY);
|
glDisableClientState2(GL_VERTEX_ARRAY);
|
||||||
glDisableClientState2(GL_TEXTURE_COORD_ARRAY);
|
glDisableClientState2(GL_TEXTURE_COORD_ARRAY);
|
||||||
glPopMatrix2();
|
glPopMatrix2();
|
||||||
@@ -349,14 +396,15 @@ void ItemInHandRenderer::render( float a )
|
|||||||
glTranslatef2(0.8f * d, -0.75f * d - (1 - h) * 0.6f, -0.9f * d);
|
glTranslatef2(0.8f * d, -0.75f * d - (1 - h) * 0.6f, -0.9f * d);
|
||||||
|
|
||||||
glRotatef2(45, 0, 1, 0);
|
glRotatef2(45, 0, 1, 0);
|
||||||
//glEnable2(GL_RESCALE_NORMAL);
|
// glEnable2(GL_RESCALE_NORMAL);
|
||||||
|
glEnable(GL_NORMALIZE);
|
||||||
glRotatef2(swing2 * 70, 0, 1, 0);
|
glRotatef2(swing2 * 70, 0, 1, 0);
|
||||||
glRotatef2(-swing3 * 20, 0, 0, 1);
|
glRotatef2(-swing3 * 20, 0, 0, 1);
|
||||||
// glRotatef2(-swing2 * 80, 1, 0, 0);
|
// glRotatef2(-swing2 * 80, 1, 0, 0);
|
||||||
|
|
||||||
mc->textures->loadAndBindTexture(player->getTexture());
|
mc->textures->loadAndBindTexture(player->getTexture());
|
||||||
glTranslatef2(-1.0f, +3.6f, +3.5f);
|
glTranslatef2(-1.0f, +3.6f, +3.5f);
|
||||||
glRotatef2(120, 0, 0, 1);
|
glRotatef2(120, 0, 0, 1);
|
||||||
glRotatef2(180 + 20, 1, 0, 0);
|
glRotatef2(180 + 20, 1, 0, 0);
|
||||||
glRotatef2(-90 - 45, 0, 1, 0);
|
glRotatef2(-90 - 45, 0, 1, 0);
|
||||||
glScalef2(1.5f / 24.0f * 16, 1.5f / 24.0f * 16, 1.5f / 24.0f * 16);
|
glScalef2(1.5f / 24.0f * 16, 1.5f / 24.0f * 16, 1.5f / 24.0f * 16);
|
||||||
@@ -369,8 +417,8 @@ void ItemInHandRenderer::render( float a )
|
|||||||
playerRenderer->renderHand();
|
playerRenderer->renderHand();
|
||||||
glPopMatrix2();
|
glPopMatrix2();
|
||||||
}
|
}
|
||||||
//glDisable2(GL_RESCALE_NORMAL);
|
glDisable2(GL_RESCALE_NORMAL);
|
||||||
//Lighting.turnOff();
|
Lighting::turnOff();
|
||||||
//w.stop();
|
//w.stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -513,14 +513,14 @@ void LevelRenderer::render(const AABB& b) const
|
|||||||
{
|
{
|
||||||
Tesselator& t = Tesselator::instance;
|
Tesselator& t = Tesselator::instance;
|
||||||
|
|
||||||
glColor4f2(1, 1, 1, 1);
|
// glColor4f2(1, 1, 1, 1);
|
||||||
|
|
||||||
textures->loadAndBindTexture("terrain.png");
|
// textures->loadAndBindTexture("terrain.png"); // uh need to check java - shredder
|
||||||
|
|
||||||
//t.begin();
|
//t.begin();
|
||||||
t.color(255, 255, 255, 255);
|
// t.color(255, 255, 255, 255); // again not needed, for some reason the vanilla source code tints it... white? maybe this was used for something else in MCPE's dev at one point? - shredder
|
||||||
|
|
||||||
t.offset(((Mob*)mc->player)->getPos(0).negated());
|
// t.offset(((Mob*)mc->player)->getPos(0).negated()); // why does this even exist normally, it just makes the thing... not render
|
||||||
|
|
||||||
t.begin(GL_LINE_STRIP);
|
t.begin(GL_LINE_STRIP);
|
||||||
t.vertex(b.x0, b.y0, b.z0);
|
t.vertex(b.x0, b.y0, b.z0);
|
||||||
|
|||||||
49
src/client/renderer/Lighting.cpp
Normal file
49
src/client/renderer/Lighting.cpp
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
#include "Lighting.h"
|
||||||
|
#include "gles.h"
|
||||||
|
#include "../Minecraft.h"
|
||||||
|
|
||||||
|
void Lighting::turnOff() {
|
||||||
|
glDisable(GL_LIGHTING);
|
||||||
|
glDisable(GL_LIGHT0);
|
||||||
|
glDisable(GL_LIGHT1);
|
||||||
|
glDisable(GL_COLOR_MATERIAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Lighting::turnOn(Minecraft* minecraft) {
|
||||||
|
if (!minecraft->options.getBooleanValue(OPTIONS_NORMAL_LIGHTING)){ // if normal lighting is false, then just dont use the lighting system at all like in vanilla - shredder
|
||||||
|
turnOff();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
glEnable(GL_NORMALIZE);
|
||||||
|
// if normal lighting is true then enable GLES/OpenGL states to setup lighting
|
||||||
|
glEnable(GL_LIGHTING);
|
||||||
|
glEnable(GL_LIGHT0);
|
||||||
|
glEnable(GL_LIGHT1);
|
||||||
|
glEnable(GL_COLOR_MATERIAL);
|
||||||
|
// glColorMaterial(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE);
|
||||||
|
|
||||||
|
constexpr float a = 0.4f;
|
||||||
|
constexpr float d = 0.6f;
|
||||||
|
constexpr float s = 0.0f;
|
||||||
|
|
||||||
|
|
||||||
|
//Vec3 l = world::phys::Vec3{0.2, 1.0, -0.7}.normalize();
|
||||||
|
constexpr float lightmodel_ambient[] = {a, a, a, 1.0f};
|
||||||
|
constexpr float diffuse[] = {d, d, d, 1.0f};
|
||||||
|
constexpr float ambient[] = {0.0f, 0.0f, 0.0f, 1.0f};
|
||||||
|
constexpr float specular[] = {s, s, s, 1.0f};
|
||||||
|
|
||||||
|
constexpr float pos0[] = {(float)(0.16169041989141428), (float)(0.8084520874101966), (float)(-0.5659164515496377), 0.0f};
|
||||||
|
glLightfv(GL_LIGHT0, GL_POSITION, pos0);
|
||||||
|
glLightfv(GL_LIGHT0, GL_DIFFUSE, diffuse);
|
||||||
|
glLightfv(GL_LIGHT0, GL_AMBIENT, ambient);
|
||||||
|
glLightfv(GL_LIGHT0, GL_SPECULAR, specular);
|
||||||
|
|
||||||
|
constexpr float pos1[] = {(float)(-0.16169041989141428), (float)(0.8084520874101966), (float)(0.5659164515496377), 0.0f};
|
||||||
|
glLightfv(GL_LIGHT1, GL_POSITION, pos1);
|
||||||
|
glLightfv(GL_LIGHT1, GL_DIFFUSE, diffuse);
|
||||||
|
glLightfv(GL_LIGHT1, GL_AMBIENT, ambient);
|
||||||
|
glLightfv(GL_LIGHT1, GL_SPECULAR, specular);
|
||||||
|
glShadeModel(GL_FLAT);
|
||||||
|
glLightModelfv(GL_LIGHT_MODEL_AMBIENT, lightmodel_ambient);
|
||||||
|
}
|
||||||
12
src/client/renderer/Lighting.h
Normal file
12
src/client/renderer/Lighting.h
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
#ifndef NET_MINECRAFT_CLIENT_RENDERER__Lighting_H__
|
||||||
|
#define NET_MINECRAFT_CLIENT_RENDERER__Lighting_H__
|
||||||
|
|
||||||
|
class Minecraft;
|
||||||
|
class Lighting
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
static void turnOff();
|
||||||
|
static void turnOn(Minecraft* minecraft);
|
||||||
|
|
||||||
|
};
|
||||||
|
#endif /*NET_MINECRAFT_CLIENT_RENDERER__Lighting_H__*/
|
||||||
@@ -8,7 +8,7 @@ Tesselator Tesselator::instance(sizeof(GLfloat) * MAX_FLOATS); // max size in by
|
|||||||
const int VertexSizeBytes = sizeof(VERTEX);
|
const int VertexSizeBytes = sizeof(VERTEX);
|
||||||
|
|
||||||
Tesselator::Tesselator( int size )
|
Tesselator::Tesselator( int size )
|
||||||
: size(size),
|
: size(size),
|
||||||
vertices(0),
|
vertices(0),
|
||||||
u(0), v(0),
|
u(0), v(0),
|
||||||
_color(0),
|
_color(0),
|
||||||
@@ -20,7 +20,7 @@ Tesselator::Tesselator( int size )
|
|||||||
_noColor(false),
|
_noColor(false),
|
||||||
mode(0),
|
mode(0),
|
||||||
xo(0), yo(0), zo(0),
|
xo(0), yo(0), zo(0),
|
||||||
_normal(0),
|
_nx(0), _ny(0), _nz(0),
|
||||||
_sx(1), _sy(1),
|
_sx(1), _sy(1),
|
||||||
|
|
||||||
tesselating(false),
|
tesselating(false),
|
||||||
@@ -97,9 +97,9 @@ RenderChunk Tesselator::end( bool useMine, int bufferId )
|
|||||||
int access = GL_STATIC_DRAW;//(accessMode==ACCESS_DYNAMIC) ? GL_DYNAMIC_DRAW : GL_STATIC_DRAW;
|
int access = GL_STATIC_DRAW;//(accessMode==ACCESS_DYNAMIC) ? GL_DYNAMIC_DRAW : GL_STATIC_DRAW;
|
||||||
glBindBuffer2(GL_ARRAY_BUFFER, bufferId);
|
glBindBuffer2(GL_ARRAY_BUFFER, bufferId);
|
||||||
glBufferData2(GL_ARRAY_BUFFER, bytes, _varray, access); // GL_STREAM_DRAW
|
glBufferData2(GL_ARRAY_BUFFER, bytes, _varray, access); // GL_STREAM_DRAW
|
||||||
|
|
||||||
totalSize += bytes;
|
totalSize += bytes;
|
||||||
|
|
||||||
#ifndef USE_VBO
|
#ifndef USE_VBO
|
||||||
// 0 1 2 3 4 5 6 7
|
// 0 1 2 3 4 5 6 7
|
||||||
// x y z u v c
|
// x y z u v c
|
||||||
@@ -112,7 +112,7 @@ RenderChunk Tesselator::end( bool useMine, int bufferId )
|
|||||||
glEnableClientState2(GL_COLOR_ARRAY);
|
glEnableClientState2(GL_COLOR_ARRAY);
|
||||||
}
|
}
|
||||||
if (hasNormal) {
|
if (hasNormal) {
|
||||||
glNormalPointer(GL_BYTE, VertexSizeBytes, (GLvoid*) (6 * 4));
|
glNormalPointer(GL_FLOAT, VertexSizeBytes, (GLvoid*) (6 * 4));
|
||||||
glEnableClientState2(GL_NORMAL_ARRAY);
|
glEnableClientState2(GL_NORMAL_ARRAY);
|
||||||
}
|
}
|
||||||
glVertexPointer2(3, GL_FLOAT, VertexSizeBytes, 0);
|
glVertexPointer2(3, GL_FLOAT, VertexSizeBytes, 0);
|
||||||
@@ -278,9 +278,11 @@ void Tesselator::vertex( float x, float y, float z )
|
|||||||
if (hasColor) {
|
if (hasColor) {
|
||||||
dst.color = src.color;
|
dst.color = src.color;
|
||||||
}
|
}
|
||||||
//if (hasNormal) {
|
if (hasNormal) {
|
||||||
// dst.normal = src.normal;
|
dst.nx = src.nx;
|
||||||
//}
|
dst.ny = src.ny;
|
||||||
|
dst.nz = src.nz;
|
||||||
|
}
|
||||||
|
|
||||||
dst.x = src.x;
|
dst.x = src.x;
|
||||||
dst.y = src.y;
|
dst.y = src.y;
|
||||||
@@ -301,9 +303,11 @@ void Tesselator::vertex( float x, float y, float z )
|
|||||||
if (hasColor) {
|
if (hasColor) {
|
||||||
vertex.color = _color;
|
vertex.color = _color;
|
||||||
}
|
}
|
||||||
//if (hasNormal) {
|
if (hasNormal) {
|
||||||
// vertex.normal = _normal;
|
vertex.nx = _nx;
|
||||||
//}
|
vertex.ny = _ny;
|
||||||
|
vertex.nz = _nz;
|
||||||
|
}
|
||||||
|
|
||||||
vertex.x = _sx * (x + xo);
|
vertex.x = _sx * (x + xo);
|
||||||
vertex.y = _sy * (y + yo);
|
vertex.y = _sy * (y + yo);
|
||||||
@@ -332,18 +336,22 @@ void Tesselator::setAccessMode(int mode)
|
|||||||
|
|
||||||
void Tesselator::normal( float x, float y, float z )
|
void Tesselator::normal( float x, float y, float z )
|
||||||
{
|
{
|
||||||
static int _warn_t = 0;
|
//static int _warn_t = 0;
|
||||||
if ((++_warn_t & 32767) == 1)
|
//if ((++_warn_t & 32767) == 1)
|
||||||
LOGI("WARNING: Can't use normals (Tesselator::normal)\n");
|
// LOGI("WARNING: Can't use normals (Tesselator::normal)\n");
|
||||||
return;
|
//return;
|
||||||
|
|
||||||
if (!tesselating) printf("But..");
|
if (!tesselating) printf("But..");
|
||||||
hasNormal = true;
|
hasNormal = true;
|
||||||
char xx = (char) (x * 128);
|
//char xx = (char) (x * 128);
|
||||||
char yy = (char) (y * 127);
|
//char yy = (char) (y * 127);
|
||||||
char zz = (char) (z * 127);
|
//char zz = (char) (z * 127);
|
||||||
|
|
||||||
_normal = xx | (yy << 8) | (zz << 16);
|
//_normal = xx | (yy << 8) | (zz << 16);
|
||||||
|
// trying a new thing hopefully works
|
||||||
|
this->_nx = x;
|
||||||
|
this->_ny = y;
|
||||||
|
this->_nz = z;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Tesselator::offset( float xo, float yo, float zo ) {
|
void Tesselator::offset( float xo, float yo, float zo ) {
|
||||||
@@ -389,7 +397,7 @@ void Tesselator::draw()
|
|||||||
vboId = 0;
|
vboId = 0;
|
||||||
|
|
||||||
int bufferId = vboIds[vboId];
|
int bufferId = vboIds[vboId];
|
||||||
|
|
||||||
int access = GL_DYNAMIC_DRAW;//(accessMode==ACCESS_DYNAMIC) ? GL_DYNAMIC_DRAW : GL_STATIC_DRAW;
|
int access = GL_DYNAMIC_DRAW;//(accessMode==ACCESS_DYNAMIC) ? GL_DYNAMIC_DRAW : GL_STATIC_DRAW;
|
||||||
glBindBuffer2(GL_ARRAY_BUFFER, bufferId);
|
glBindBuffer2(GL_ARRAY_BUFFER, bufferId);
|
||||||
glBufferData2(GL_ARRAY_BUFFER, bytes, _varray, access); // GL_STREAM_DRAW
|
glBufferData2(GL_ARRAY_BUFFER, bytes, _varray, access); // GL_STREAM_DRAW
|
||||||
@@ -404,10 +412,10 @@ void Tesselator::draw()
|
|||||||
//glColorPointer2(4, GL_UNSIGNED_BYTE, VertexSizeBytes, (GLvoid*) &_varray->color);
|
//glColorPointer2(4, GL_UNSIGNED_BYTE, VertexSizeBytes, (GLvoid*) &_varray->color);
|
||||||
glEnableClientState2(GL_COLOR_ARRAY);
|
glEnableClientState2(GL_COLOR_ARRAY);
|
||||||
}
|
}
|
||||||
//if (hasNormal) {
|
if (hasNormal) {
|
||||||
// glNormalPointer(GL_BYTE, VertexSizeBytes, (GLvoid*) (6 * 4));
|
glNormalPointer(GL_FLOAT, VertexSizeBytes, (GLvoid*) (6 * 4));
|
||||||
// glEnableClientState2(GL_NORMAL_ARRAY);
|
glEnableClientState2(GL_NORMAL_ARRAY);
|
||||||
//}
|
}
|
||||||
//glVertexPointer2(3, GL_FLOAT, VertexSizeBytes, (GLvoid*)&_varray);
|
//glVertexPointer2(3, GL_FLOAT, VertexSizeBytes, (GLvoid*)&_varray);
|
||||||
glVertexPointer2(3, GL_FLOAT, VertexSizeBytes, 0);
|
glVertexPointer2(3, GL_FLOAT, VertexSizeBytes, 0);
|
||||||
glEnableClientState2(GL_VERTEX_ARRAY);
|
glEnableClientState2(GL_VERTEX_ARRAY);
|
||||||
@@ -421,7 +429,7 @@ void Tesselator::draw()
|
|||||||
glDisableClientState2(GL_VERTEX_ARRAY);
|
glDisableClientState2(GL_VERTEX_ARRAY);
|
||||||
if (hasTexture) glDisableClientState2(GL_TEXTURE_COORD_ARRAY);
|
if (hasTexture) glDisableClientState2(GL_TEXTURE_COORD_ARRAY);
|
||||||
if (hasColor) glDisableClientState2(GL_COLOR_ARRAY);
|
if (hasColor) glDisableClientState2(GL_COLOR_ARRAY);
|
||||||
//if (hasNormal) glDisableClientState2(GL_NORMAL_ARRAY);
|
if (hasNormal) glDisableClientState2(GL_NORMAL_ARRAY);
|
||||||
}
|
}
|
||||||
|
|
||||||
clear();
|
clear();
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
extern const int VertexSizeBytes;
|
extern const int VertexSizeBytes;
|
||||||
|
|
||||||
typedef VertexDeclPTC VERTEX;
|
typedef VertexDeclPTCN VERTEX;
|
||||||
typedef std::map<GLuint, GLsizei> IntGLMap;
|
typedef std::map<GLuint, GLsizei> IntGLMap;
|
||||||
|
|
||||||
|
|
||||||
@@ -98,7 +98,9 @@ private:
|
|||||||
float xo, yo, zo;
|
float xo, yo, zo;
|
||||||
float u, v;
|
float u, v;
|
||||||
unsigned int _color;
|
unsigned int _color;
|
||||||
int _normal;
|
// int _normal; // trying a new thing
|
||||||
|
float _nx, _ny, _nz;
|
||||||
|
|
||||||
float _sx, _sy;
|
float _sx, _sy;
|
||||||
|
|
||||||
bool hasColor;
|
bool hasColor;
|
||||||
|
|||||||
@@ -225,7 +225,7 @@ bool TileRenderer::tesselateTorchInWorld( Tile* tt, int x, int y, int z )
|
|||||||
|
|
||||||
bool TileRenderer::tesselateFireInWorld( Tile* tt, int x, int y, int z )
|
bool TileRenderer::tesselateFireInWorld( Tile* tt, int x, int y, int z )
|
||||||
{
|
{
|
||||||
// @todo: fire alpha transparency seems to be scuffed, also it seems i might have messed up the second layer while porting from lce/java , need to look into it - shredder
|
// fire transparency has been fixed - shredder
|
||||||
|
|
||||||
Tesselator& t = Tesselator::instance;
|
Tesselator& t = Tesselator::instance;
|
||||||
|
|
||||||
@@ -2308,30 +2308,54 @@ void TileRenderer::renderEast( Tile* tt, float x, float y, float z, int tex )
|
|||||||
void TileRenderer::renderTile( Tile* tile, int data )
|
void TileRenderer::renderTile( Tile* tile, int data )
|
||||||
{
|
{
|
||||||
Tesselator& t = Tesselator::instance;
|
Tesselator& t = Tesselator::instance;
|
||||||
|
|
||||||
t.color(0xff, 0xff, 0xff);
|
t.color(0xff, 0xff, 0xff); // i disabled this, this is normally enabled in normal mcpe see if this fits OPTION_NORMAL_LIGHTING - shredder
|
||||||
int shape = tile->getRenderShape();
|
int shape = tile->getRenderShape();
|
||||||
|
|
||||||
if (shape == Tile::SHAPE_BLOCK) {
|
if (shape == Tile::SHAPE_BLOCK) {
|
||||||
tile->updateDefaultShape();
|
tile->updateDefaultShape();
|
||||||
t.addOffset(-0.5f, -0.5f, -0.5f);
|
t.addOffset(-0.5f, -0.5f, -0.5f);
|
||||||
t.begin();
|
t.begin();
|
||||||
|
|
||||||
|
t.normal(0.0f, -1.0f, 0.0f);// most normal calls in this file has been added me since they existed in java - shredder
|
||||||
|
|
||||||
renderFaceDown(tile, 0, 0, 0, tile->getTexture(0, data));
|
renderFaceDown(tile, 0, 0, 0, tile->getTexture(0, data));
|
||||||
|
|
||||||
|
t.normal(0.0f, 1.0f, 0.0f);
|
||||||
|
|
||||||
renderFaceUp(tile, 0, 0, 0, tile->getTexture(1, data));
|
renderFaceUp(tile, 0, 0, 0, tile->getTexture(1, data));
|
||||||
|
|
||||||
|
t.normal(0.0f, 0.0f, -1.0f);
|
||||||
|
|
||||||
renderNorth(tile, 0, 0, 0, tile->getTexture(2, data));
|
renderNorth(tile, 0, 0, 0, tile->getTexture(2, data));
|
||||||
|
|
||||||
|
t.normal(0.0f, 0.0f, 1.0f);
|
||||||
|
|
||||||
renderSouth(tile, 0, 0, 0, tile->getTexture(3, data));
|
renderSouth(tile, 0, 0, 0, tile->getTexture(3, data));
|
||||||
|
|
||||||
|
t.normal(-1.0f, 0.0f, 0.0f);
|
||||||
|
|
||||||
renderWest(tile, 0, 0, 0, tile->getTexture(4, data));
|
renderWest(tile, 0, 0, 0, tile->getTexture(4, data));
|
||||||
|
|
||||||
|
t.normal(1.0f, 0.0f, 0.0f);
|
||||||
|
|
||||||
renderEast(tile, 0, 0, 0, tile->getTexture(5, data));
|
renderEast(tile, 0, 0, 0, tile->getTexture(5, data));
|
||||||
t.draw();
|
t.draw();
|
||||||
|
|
||||||
t.addOffset(0.5f, 0.5f, 0.5f);
|
t.addOffset(0.5f, 0.5f, 0.5f);
|
||||||
|
|
||||||
} else if (shape == Tile::SHAPE_CROSS_TEXTURE) {
|
} else if (shape == Tile::SHAPE_CROSS_TEXTURE) { // uhh java has this but is this even ever used??? - shredder
|
||||||
t.begin();
|
t.begin();
|
||||||
|
|
||||||
|
t.normal(0.0f, -1.0f, 0.0f);
|
||||||
|
|
||||||
tesselateCrossTexture(tile, data, -0.5f, -0.5f, -0.5f);
|
tesselateCrossTexture(tile, data, -0.5f, -0.5f, -0.5f);
|
||||||
t.draw();
|
t.draw();
|
||||||
} else if(shape == Tile::SHAPE_STEM) {
|
} else if(shape == Tile::SHAPE_STEM) {
|
||||||
t.begin();
|
t.begin();
|
||||||
|
|
||||||
|
t.normal(0.0f, -1.0f, 0.0f);
|
||||||
|
|
||||||
tile->updateDefaultShape();
|
tile->updateDefaultShape();
|
||||||
tesselateStemTexture(tile, data, tile->yy1, -0.5f, -0.5f, -0.5f);
|
tesselateStemTexture(tile, data, tile->yy1, -0.5f, -0.5f, -0.5f);
|
||||||
t.draw();
|
t.draw();
|
||||||
@@ -2340,16 +2364,39 @@ void TileRenderer::renderTile( Tile* tile, int data )
|
|||||||
t.offset(-0.5f, -0.5f, -0.5f);
|
t.offset(-0.5f, -0.5f, -0.5f);
|
||||||
float s = 1 / 16.0f;
|
float s = 1 / 16.0f;
|
||||||
t.begin();
|
t.begin();
|
||||||
|
|
||||||
|
t.normal(0.0f, -1.0f, 0.0f);
|
||||||
|
|
||||||
renderFaceDown(tile, 0, 0, 0, tile->getTexture(0));
|
renderFaceDown(tile, 0, 0, 0, tile->getTexture(0));
|
||||||
|
|
||||||
|
t.normal(0.0f, 1.0f, 0.0f);
|
||||||
|
|
||||||
renderFaceUp(tile, 0, 0, 0, tile->getTexture(1));
|
renderFaceUp(tile, 0, 0, 0, tile->getTexture(1));
|
||||||
|
|
||||||
|
t.normal(0.0f, 0.0f, -1.0f);
|
||||||
|
|
||||||
t.addOffset(0, 0, s);
|
t.addOffset(0, 0, s);
|
||||||
|
|
||||||
|
|
||||||
renderNorth(tile, 0, 0, 0, tile->getTexture(2));
|
renderNorth(tile, 0, 0, 0, tile->getTexture(2));
|
||||||
|
|
||||||
|
t.normal(0.0f, 0.0f, 1.0f);
|
||||||
|
|
||||||
t.addOffset(0, 0, -s);
|
t.addOffset(0, 0, -s);
|
||||||
t.addOffset(0, 0, -s);
|
t.addOffset(0, 0, -s);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
renderSouth(tile, 0, 0, 0, tile->getTexture(3));
|
renderSouth(tile, 0, 0, 0, tile->getTexture(3));
|
||||||
|
|
||||||
|
t.normal(-1.0f, 0.0f, 0.0f);
|
||||||
|
|
||||||
t.addOffset(0, 0, s);
|
t.addOffset(0, 0, s);
|
||||||
t.addOffset(s, 0, 0);
|
t.addOffset(s, 0, 0);
|
||||||
renderWest(tile, 0, 0, 0, tile->getTexture(4));
|
renderWest(tile, 0, 0, 0, tile->getTexture(4));
|
||||||
|
|
||||||
|
t.normal(1.0f, 0.0f, 0.0f);
|
||||||
|
|
||||||
t.addOffset(-s, 0, 0);
|
t.addOffset(-s, 0, 0);
|
||||||
t.addOffset(-s, 0, 0);
|
t.addOffset(-s, 0, 0);
|
||||||
renderEast(tile, 0, 0, 0, tile->getTexture(5));
|
renderEast(tile, 0, 0, 0, tile->getTexture(5));
|
||||||
@@ -2363,7 +2410,7 @@ void TileRenderer::renderTile( Tile* tile, int data )
|
|||||||
//} else if (shape == Tile::SHAPE_TORCH) {
|
//} else if (shape == Tile::SHAPE_TORCH) {
|
||||||
//// t.begin();
|
//// t.begin();
|
||||||
//// t.normal(0, -1, 0);
|
//// t.normal(0, -1, 0);
|
||||||
//// tesselateTorch(tile, -0.5f, -0.5f, -0.5f, 0, 0);
|
/// tesselateTorch(tile, -0.5f, -0.5f, -0.5f, 0, 0);
|
||||||
//// t.end();
|
//// t.end();
|
||||||
} else if (shape == Tile::SHAPE_ENTITYTILE_ANIMATED) {
|
} else if (shape == Tile::SHAPE_ENTITYTILE_ANIMATED) {
|
||||||
EntityTileRenderer::instance->render(tile, data, 1.0f);
|
EntityTileRenderer::instance->render(tile, data, 1.0f);
|
||||||
@@ -2375,11 +2422,23 @@ void TileRenderer::renderTile( Tile* tile, int data )
|
|||||||
if (i == 0) tile->setShape(0, 0, 0, 1, 1, 0.5f);
|
if (i == 0) tile->setShape(0, 0, 0, 1, 1, 0.5f);
|
||||||
if (i == 1) tile->setShape(0, 0, 0.5f, 1, 0.5f, 1);
|
if (i == 1) tile->setShape(0, 0, 0.5f, 1, 0.5f, 1);
|
||||||
|
|
||||||
|
|
||||||
|
t.normal(0.0f, -1.0f, 0.0f);
|
||||||
renderFaceDown(tile, 0, 0, 0, tile->getTexture(0));
|
renderFaceDown(tile, 0, 0, 0, tile->getTexture(0));
|
||||||
|
|
||||||
|
t.normal(0.0f, 1.0f, 0.0f);
|
||||||
renderFaceUp(tile, 0, 0, 0, tile->getTexture(1));
|
renderFaceUp(tile, 0, 0, 0, tile->getTexture(1));
|
||||||
|
|
||||||
|
t.normal(0.0f, 0.0f, -1.0f);
|
||||||
renderNorth(tile, 0, 0, 0, tile->getTexture(2));
|
renderNorth(tile, 0, 0, 0, tile->getTexture(2));
|
||||||
|
|
||||||
|
t.normal(0.0f, 0.0f, 1.0f);
|
||||||
renderSouth(tile, 0, 0, 0, tile->getTexture(3));
|
renderSouth(tile, 0, 0, 0, tile->getTexture(3));
|
||||||
|
|
||||||
|
t.normal(-1.0f, 0.0f, 0.0f);
|
||||||
renderWest(tile, 0, 0, 0, tile->getTexture(4));
|
renderWest(tile, 0, 0, 0, tile->getTexture(4));
|
||||||
|
|
||||||
|
t.normal(1.0f, 0.0f, 0.0f);
|
||||||
renderEast(tile, 0, 0, 0, tile->getTexture(5));
|
renderEast(tile, 0, 0, 0, tile->getTexture(5));
|
||||||
}
|
}
|
||||||
t.draw();
|
t.draw();
|
||||||
@@ -2396,12 +2455,23 @@ void TileRenderer::renderTile( Tile* tile, int data )
|
|||||||
if (i == 2) tile->setShape(0.5f - w, 1 - w * 3, -w * 2, 0.5f + w, 1 - w, 1 + w * 2);
|
if (i == 2) tile->setShape(0.5f - w, 1 - w * 3, -w * 2, 0.5f + w, 1 - w, 1 + w * 2);
|
||||||
if (i == 3) tile->setShape(0.5f - w, 0.5f - w * 3, -w * 2, 0.5f + w, 0.5f - w, 1 + w * 2);
|
if (i == 3) tile->setShape(0.5f - w, 0.5f - w * 3, -w * 2, 0.5f + w, 0.5f - w, 1 + w * 2);
|
||||||
|
|
||||||
renderFaceDown(tile, 0, 0, 0, tile->getTexture(0));
|
t.normal(0.0f, -1.0f, 0.0f);
|
||||||
renderFaceUp(tile, 0, 0, 0, tile->getTexture(1));
|
renderFaceDown(tile, 0, 0, 0, tile->getTexture(0));
|
||||||
renderNorth(tile, 0, 0, 0, tile->getTexture(2));
|
|
||||||
renderSouth(tile, 0, 0, 0, tile->getTexture(3));
|
t.normal(0.0f, 1.0f, 0.0f);
|
||||||
renderWest(tile, 0, 0, 0, tile->getTexture(4));
|
renderFaceUp(tile, 0, 0, 0, tile->getTexture(1));
|
||||||
renderEast(tile, 0, 0, 0, tile->getTexture(5));
|
|
||||||
|
t.normal(0.0f, 0.0f, -1.0f);
|
||||||
|
renderNorth(tile, 0, 0, 0, tile->getTexture(2));
|
||||||
|
|
||||||
|
t.normal(0.0f, 0.0f, 1.0f);
|
||||||
|
renderSouth(tile, 0, 0, 0, tile->getTexture(3));
|
||||||
|
|
||||||
|
t.normal(-1.0f, 0.0f, 0.0f);
|
||||||
|
renderWest(tile, 0, 0, 0, tile->getTexture(4));
|
||||||
|
|
||||||
|
t.normal(1.0f, 0.0f, 0.0f);
|
||||||
|
renderEast(tile, 0, 0, 0, tile->getTexture(5));
|
||||||
}
|
}
|
||||||
t.draw();
|
t.draw();
|
||||||
t.addOffset(0.5f, 0.5f, 0.5f);
|
t.addOffset(0.5f, 0.5f, 0.5f);
|
||||||
@@ -2415,12 +2485,23 @@ void TileRenderer::renderTile( Tile* tile, int data )
|
|||||||
if (i == 1) tile->setShape(0.5f - w, .3f, 1 - w * 2, 0.5f + w, 1, 1);
|
if (i == 1) tile->setShape(0.5f - w, .3f, 1 - w * 2, 0.5f + w, 1, 1);
|
||||||
if (i == 2) tile->setShape(0.5f - w, .5f, w * 2, 0.5f + w, 1 - w, 1 - w * 2);
|
if (i == 2) tile->setShape(0.5f - w, .5f, w * 2, 0.5f + w, 1 - w, 1 - w * 2);
|
||||||
|
|
||||||
renderFaceUp(tile, 0, 0, 0, tile->getTexture(0));
|
t.normal(0.0f, -1.0f, 0.0f);
|
||||||
renderFaceDown(tile, 0, 0, 0, tile->getTexture(1));
|
renderFaceDown(tile, 0, 0, 0, tile->getTexture(0));
|
||||||
renderNorth(tile, 0, 0, 0, tile->getTexture(2));
|
|
||||||
renderSouth(tile, 0, 0, 0, tile->getTexture(3));
|
t.normal(0.0f, 1.0f, 0.0f);
|
||||||
renderWest(tile, 0, 0, 0, tile->getTexture(4));
|
renderFaceUp(tile, 0, 0, 0, tile->getTexture(1));
|
||||||
renderEast(tile, 0, 0, 0, tile->getTexture(5));
|
|
||||||
|
t.normal(0.0f, 0.0f, -1.0f);
|
||||||
|
renderNorth(tile, 0, 0, 0, tile->getTexture(2));
|
||||||
|
|
||||||
|
t.normal(0.0f, 0.0f, 1.0f);
|
||||||
|
renderSouth(tile, 0, 0, 0, tile->getTexture(3));
|
||||||
|
|
||||||
|
t.normal(-1.0f, 0.0f, 0.0f);
|
||||||
|
renderWest(tile, 0, 0, 0, tile->getTexture(4));
|
||||||
|
|
||||||
|
t.normal(1.0f, 0.0f, 0.0f);
|
||||||
|
renderEast(tile, 0, 0, 0, tile->getTexture(5));
|
||||||
}
|
}
|
||||||
t.draw();
|
t.draw();
|
||||||
t.addOffset(0.5f, 0.5f, 0.5f);
|
t.addOffset(0.5f, 0.5f, 0.5f);
|
||||||
@@ -2469,7 +2550,7 @@ void TileRenderer::renderGuiTile( Tile* tile, int data )
|
|||||||
|
|
||||||
} else if (shape == Tile::SHAPE_CROSS_TEXTURE) {
|
} else if (shape == Tile::SHAPE_CROSS_TEXTURE) {
|
||||||
t.begin();
|
t.begin();
|
||||||
//t.normal(0, -1, 0);
|
t.normal(0, -1, 0);
|
||||||
tesselateCrossTexture(tile, data, -0.5f, -0.5f, -0.5f);
|
tesselateCrossTexture(tile, data, -0.5f, -0.5f, -0.5f);
|
||||||
//t.end();
|
//t.end();
|
||||||
t.draw();
|
t.draw();
|
||||||
|
|||||||
@@ -14,7 +14,8 @@ typedef struct VertexDeclPTCN
|
|||||||
GLfloat x, y, z;
|
GLfloat x, y, z;
|
||||||
GLfloat u, v;
|
GLfloat u, v;
|
||||||
GLuint color;
|
GLuint color;
|
||||||
GLuint normal;
|
// GLuint normal; // trying a new thing
|
||||||
|
GLfloat nx, ny, nz;
|
||||||
|
|
||||||
} VertexDeclPTCN;
|
} VertexDeclPTCN;
|
||||||
|
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
#include "../../Minecraft.h"
|
#include "../../Minecraft.h"
|
||||||
#include "../../Option.h"
|
#include "../../Option.h"
|
||||||
|
|
||||||
|
#include "../Lighting.h"
|
||||||
EntityRenderDispatcher* EntityRenderer::entityRenderDispatcher = NULL;
|
EntityRenderDispatcher* EntityRenderer::entityRenderDispatcher = NULL;
|
||||||
|
|
||||||
EntityRenderer::EntityRenderer()
|
EntityRenderer::EntityRenderer()
|
||||||
@@ -134,7 +135,7 @@ void EntityRenderer::postRender(Entity* entity, float x, float y, float z, float
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
void EntityRenderer::renderFlame(Entity* e, float x, float y, float z, float a) {
|
void EntityRenderer::renderFlame(Entity* e, float x, float y, float z, float a) {
|
||||||
|
glDisable(GL_LIGHTING);
|
||||||
int tex = ((Tile*)Tile::fire)->tex;
|
int tex = ((Tile*)Tile::fire)->tex;
|
||||||
|
|
||||||
int xt = (tex & 0xf) << 4;
|
int xt = (tex & 0xf) << 4;
|
||||||
@@ -176,7 +177,7 @@ void EntityRenderer::renderFlame(Entity* e, float x, float y, float z, float a)
|
|||||||
}
|
}
|
||||||
t.draw();
|
t.draw();
|
||||||
glPopMatrix2();
|
glPopMatrix2();
|
||||||
// glEnable2(GL_LIGHTING);
|
glEnable2(GL_LIGHTING);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EntityRenderer::renderShadow(Entity* e, float x, float y, float z, float pow, float a) { //
|
void EntityRenderer::renderShadow(Entity* e, float x, float y, float z, float pow, float a) { //
|
||||||
@@ -186,10 +187,9 @@ void EntityRenderer::renderShadow(Entity* e, float x, float y, float z, float po
|
|||||||
//Textures* textures = entityRenderDispatcher->textures;
|
//Textures* textures = entityRenderDispatcher->textures;
|
||||||
//textures->bind(textures->loadTexture("%clamp%/environment/shadow.png"));
|
//textures->bind(textures->loadTexture("%clamp%/environment/shadow.png"));
|
||||||
Textures* textures = entityRenderDispatcher->textures;
|
Textures* textures = entityRenderDispatcher->textures;
|
||||||
textures->bind(textures->loadTexture("/misc/shadow.png"));
|
|
||||||
|
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
|
||||||
|
|
||||||
Level* level = getLevel();
|
Level* level = getLevel();
|
||||||
|
|
||||||
@@ -221,6 +221,9 @@ void EntityRenderer::renderShadow(Entity* e, float x, float y, float z, float po
|
|||||||
renderTileShadow(Tile::tiles[t], x, y + e->getShadowHeightOffs(), z, xt, yt, zt, pow, r, xo, yo + e->getShadowHeightOffs(), zo);
|
renderTileShadow(Tile::tiles[t], x, y + e->getShadowHeightOffs(), z, xt, yt, zt, pow, r, xo, yo + e->getShadowHeightOffs(), zo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
textures->loadAndBindTexture(("/misc/shadow.png"));
|
||||||
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||||
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||||
tt.draw();
|
tt.draw();
|
||||||
|
|
||||||
glColor4f2(1, 1, 1, 1);
|
glColor4f2(1, 1, 1, 1);
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ void ItemRenderer::render(Entity* itemEntity_, float x, float y, float z, float
|
|||||||
else if (item->count > 1) count = 2;
|
else if (item->count > 1) count = 2;
|
||||||
|
|
||||||
glTranslatef2((float) x, (float) y + bob, (float) z);
|
glTranslatef2((float) x, (float) y + bob, (float) z);
|
||||||
//glEnable2(GL_RESCALE_NORMAL);
|
glEnable2(GL_RESCALE_NORMAL);
|
||||||
if (item->id < 256 && TileRenderer::canRender(Tile::tiles[item->id]->getRenderShape())) {
|
if (item->id < 256 && TileRenderer::canRender(Tile::tiles[item->id]->getRenderShape())) {
|
||||||
glRotatef2(spin, 0, 1, 0);
|
glRotatef2(spin, 0, 1, 0);
|
||||||
|
|
||||||
@@ -107,7 +107,7 @@ void ItemRenderer::render(Entity* itemEntity_, float x, float y, float z, float
|
|||||||
}
|
}
|
||||||
glRotatef2(180 - entityRenderDispatcher->playerRotY, 0, 1, 0);
|
glRotatef2(180 - entityRenderDispatcher->playerRotY, 0, 1, 0);
|
||||||
t.begin();
|
t.begin();
|
||||||
//t.normal(0, 1, 0);
|
t.normal(0, 1, 0);
|
||||||
t.vertexUV(0 - xo, 0 - yo, 0, u0, v1);
|
t.vertexUV(0 - xo, 0 - yo, 0, u0, v1);
|
||||||
t.vertexUV(r - xo, 0 - yo, 0, u1, v1);
|
t.vertexUV(r - xo, 0 - yo, 0, u1, v1);
|
||||||
t.vertexUV(r - xo, 1 - yo, 0, u1, v0);
|
t.vertexUV(r - xo, 1 - yo, 0, u1, v0);
|
||||||
@@ -118,7 +118,7 @@ void ItemRenderer::render(Entity* itemEntity_, float x, float y, float z, float
|
|||||||
glPopMatrix2();
|
glPopMatrix2();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//glDisable2(GL_RESCALE_NORMAL);
|
glDisable2(GL_RESCALE_NORMAL);
|
||||||
glPopMatrix2();
|
glPopMatrix2();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ void PaintingRenderer::render( Entity* entity, float x, float y, float z, float
|
|||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
glTranslatef(float(x), float(y), float(z));
|
glTranslatef(float(x), float(y), float(z));
|
||||||
glRotatef(rot, 0, 1.0f, 0);
|
glRotatef(rot, 0, 1.0f, 0);
|
||||||
//glEnable(GL_RESCALE_NORMAL);
|
glEnable(GL_RESCALE_NORMAL);
|
||||||
bindTexture("art/kz.png");
|
bindTexture("art/kz.png");
|
||||||
Painting* painting = (Painting*)entity;
|
Painting* painting = (Painting*)entity;
|
||||||
const Motive* motive = painting->motive;
|
const Motive* motive = painting->motive;
|
||||||
@@ -17,7 +17,7 @@ void PaintingRenderer::render( Entity* entity, float x, float y, float z, float
|
|||||||
float s = 1.0f / 16.0f;
|
float s = 1.0f / 16.0f;
|
||||||
glScalef(s, s, s);
|
glScalef(s, s, s);
|
||||||
renderPainting(painting, motive->w, motive->h, motive->uo, motive->vo, a);
|
renderPainting(painting, motive->w, motive->h, motive->uo, motive->vo, a);
|
||||||
//glDisable(GL_RESCALE_NORMAL);
|
glDisable(GL_RESCALE_NORMAL);
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -77,10 +77,10 @@ void PlayerRenderer::render(Entity* mob_, float x, float y, float z, float rot,
|
|||||||
model = desired;
|
model = desired;
|
||||||
humanoidModel = desired;
|
humanoidModel = desired;
|
||||||
}
|
}
|
||||||
LOGI("[PlayerRenderer] %s: skin=%s, modelTex=%dx%d, desired=%s\n",
|
// LOGI("[PlayerRenderer] %s: skin=%s, modelTex=%dx%d, desired=%s\n", // don't log it always, only for debug - shredder
|
||||||
((Player*)mob)->name.c_str(), mob->getTexture().c_str(),
|
// ((Player*)mob)->name.c_str(), mob->getTexture().c_str(),
|
||||||
humanoidModel->texWidth, humanoidModel->texHeight,
|
// humanoidModel->texWidth, humanoidModel->texHeight,
|
||||||
(desired == playerModel64 ? "64" : "32"));
|
// (desired == playerModel64 ? "64" : "32"));
|
||||||
HumanoidMobRenderer::render(mob_, x, y, z, rot, a);
|
HumanoidMobRenderer::render(mob_, x, y, z, rot, a);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -115,6 +115,41 @@ void drawArrayVTC_NoState(int bufferId, int vertices, int vertexSize /* = 24 */)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
void drawArrayVTN(int bufferId, int vertices, int vertexSize /* = 24 */) {
|
||||||
|
//if (Options::debugGl) LOGI("drawArray\n");
|
||||||
|
//LOGI("draw-vtc: %d, %d, %d\n", bufferId, vertices, vertexSize);
|
||||||
|
glEnableClientState2(GL_VERTEX_ARRAY);
|
||||||
|
glEnableClientState2(GL_TEXTURE_COORD_ARRAY);
|
||||||
|
//glEnableClientState2(GL_COLOR_ARRAY);
|
||||||
|
glEnableClientState2(GL_NORMAL_ARRAY);
|
||||||
|
|
||||||
|
glBindBuffer2(GL_ARRAY_BUFFER, bufferId);
|
||||||
|
|
||||||
|
glVertexPointer2( 3, GL_FLOAT, vertexSize, 0);
|
||||||
|
glTexCoordPointer2(2, GL_FLOAT, vertexSize, (GLvoid*) (3 * 4));
|
||||||
|
//glColorPointer2(4, GL_UNSIGNED_BYTE, vertexSize, (GLvoid*) (5*4));
|
||||||
|
glNormalPointer(GL_FLOAT, vertexSize, (GLvoid*) (6 * 4));
|
||||||
|
|
||||||
|
glDrawArrays2(GL_TRIANGLES, 0, vertices);
|
||||||
|
|
||||||
|
glDisableClientState2(GL_VERTEX_ARRAY);
|
||||||
|
glDisableClientState2(GL_TEXTURE_COORD_ARRAY);
|
||||||
|
//glDisableClientState2(GL_COLOR_ARRAY);
|
||||||
|
glDisableClientState2(GL_NORMAL_ARRAY);
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifndef drawArrayVTN_NoState
|
||||||
|
void drawArrayVTCN_NoState(int bufferId, int vertices, int vertexSize /* = 24 */) {
|
||||||
|
glBindBuffer2(GL_ARRAY_BUFFER, bufferId);
|
||||||
|
|
||||||
|
glVertexPointer2( 3, GL_FLOAT, vertexSize, 0);
|
||||||
|
glTexCoordPointer2(2, GL_FLOAT, vertexSize, (GLvoid*) (3 * 4));
|
||||||
|
//glColorPointer2(4, GL_UNSIGNED_BYTE, vertexSize, (GLvoid*) (5*4));
|
||||||
|
glNormalPointer(GL_FLOAT, vertexSize, (GLvoid*) (6 * 4));
|
||||||
|
|
||||||
|
glDrawArrays2(GL_TRIANGLES, 0, vertices);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -4,11 +4,15 @@
|
|||||||
#include "../../platform/log.h"
|
#include "../../platform/log.h"
|
||||||
#include "../Options.h"
|
#include "../Options.h"
|
||||||
|
|
||||||
|
#if defined(__APPLE__)
|
||||||
|
#define GLES_SILENCE_DEPRECATION
|
||||||
|
#endif
|
||||||
|
|
||||||
// Android should always run OPENGL_ES
|
// Android should always run OPENGL_ES
|
||||||
#if defined(ANDROID) || defined(__APPLE__) || defined(RPI)
|
#if defined(ANDROID) || defined(__APPLE__) || defined(RPI)
|
||||||
#define OPENGL_ES
|
#define OPENGL_ES
|
||||||
#endif
|
#endif
|
||||||
|
#define GLES_SILENCE_DEPRECATION
|
||||||
// Other systems might run it, if they #define OPENGL_ES
|
// Other systems might run it, if they #define OPENGL_ES
|
||||||
// #if defined(OPENGL_ES) // || defined(ANDROID)
|
// #if defined(OPENGL_ES) // || defined(ANDROID)
|
||||||
#define USE_VBO
|
#define USE_VBO
|
||||||
@@ -55,13 +59,18 @@ void anGenBuffers(GLsizei n, GLuint* buffer);
|
|||||||
#ifdef USE_VBO
|
#ifdef USE_VBO
|
||||||
#define drawArrayVT_NoState drawArrayVT
|
#define drawArrayVT_NoState drawArrayVT
|
||||||
#define drawArrayVTC_NoState drawArrayVTC
|
#define drawArrayVTC_NoState drawArrayVTC
|
||||||
void drawArrayVT(int bufferId, int vertices, int vertexSize = 24, unsigned int mode = GL_TRIANGLES);
|
#define drawArrayVTN_NoState drawArrayVTN
|
||||||
|
void drawArrayVT(int bufferId, int vertices, int vertexSize = 36, unsigned int mode = GL_TRIANGLES);
|
||||||
#ifndef drawArrayVT_NoState
|
#ifndef drawArrayVT_NoState
|
||||||
//void drawArrayVT_NoState(int bufferId, int vertices, int vertexSize = 24);
|
//void drawArrayVT_NoState(int bufferId, int vertices, int vertexSize = 36);
|
||||||
#endif
|
#endif
|
||||||
void drawArrayVTC(int bufferId, int vertices, int vertexSize = 24);
|
void drawArrayVTC(int bufferId, int vertices, int vertexSize = 36);
|
||||||
#ifndef drawArrayVTC_NoState
|
#ifndef drawArrayVTC_NoState
|
||||||
void drawArrayVTC_NoState(int bufferId, int vertices, int vertexSize = 24);
|
void drawArrayVTC_NoState(int bufferId, int vertices, int vertexSize = 36);
|
||||||
|
#endif
|
||||||
|
void drawArrayVTN(int bufferId, int vertices, int vertexSize = 36);
|
||||||
|
#ifndef drawArrayVTN_NoState
|
||||||
|
void drawArrayVTCN_NoState(int bufferId, int vertices, int vertexSize = 36);
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -114,6 +123,7 @@ int glhUnProjectf( float winx, float winy, float winz,
|
|||||||
#define glVertexPointer2 glVertexPointer
|
#define glVertexPointer2 glVertexPointer
|
||||||
#define glColorPointer2 glColorPointer
|
#define glColorPointer2 glColorPointer
|
||||||
#define glTexCoordPointer2 glTexCoordPointer
|
#define glTexCoordPointer2 glTexCoordPointer
|
||||||
|
#define glNormalPointer2 glNormalPointer
|
||||||
#define glEnableClientState2 glEnableClientState
|
#define glEnableClientState2 glEnableClientState
|
||||||
#define glDisableClientState2 glDisableClientState
|
#define glDisableClientState2 glDisableClientState
|
||||||
#define glDrawArrays2 glDrawArrays
|
#define glDrawArrays2 glDrawArrays
|
||||||
@@ -137,7 +147,7 @@ int glhUnProjectf( float winx, float winy, float winz,
|
|||||||
//
|
//
|
||||||
// Extensions
|
// Extensions
|
||||||
//
|
//
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
#define glGetProcAddress(a) wglGetProcAddress(a)
|
#define glGetProcAddress(a) wglGetProcAddress(a)
|
||||||
#else
|
#else
|
||||||
#define glGetProcAddress(a) (void*(0))
|
#define glGetProcAddress(a) (void*(0))
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
// DynamicTexture
|
// DynamicTexture
|
||||||
//
|
//
|
||||||
DynamicTexture::DynamicTexture(int tex_)
|
DynamicTexture::DynamicTexture(int tex_)
|
||||||
: tex(tex_),
|
: tex(tex_),
|
||||||
replicate(1)
|
replicate(1)
|
||||||
{
|
{
|
||||||
memset(pixels, 0, 16*16*4);
|
memset(pixels, 0, 16*16*4);
|
||||||
@@ -29,8 +29,8 @@ void DynamicTexture::bindTexture(Textures* tex) {
|
|||||||
/*
|
/*
|
||||||
WaterTexture::WaterTexture()
|
WaterTexture::WaterTexture()
|
||||||
: super(Tile::water->tex),
|
: super(Tile::water->tex),
|
||||||
_tick(0),
|
_tick(0),
|
||||||
_frame(0)
|
_frame(0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -39,7 +39,7 @@ void WaterTexture::tick() {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
WaterTexture::WaterTexture()
|
WaterTexture::WaterTexture()
|
||||||
: super(Tile::water->tex),
|
: super(Tile::water->tex),
|
||||||
_tick(0),
|
_tick(0),
|
||||||
_frame(0)
|
_frame(0)
|
||||||
{
|
{
|
||||||
@@ -76,55 +76,55 @@ void WaterTexture::tick()
|
|||||||
next[x + y * 16] = pow / 3.3f + heat[x + y * 16] * 0.8f;
|
next[x + y * 16] = pow / 3.3f + heat[x + y * 16] * 0.8f;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int x = 0; x < 16; x++)
|
for (int x = 0; x < 16; x++)
|
||||||
for (int y = 0; y < 16; y++) {
|
for (int y = 0; y < 16; y++) {
|
||||||
heat[x + y * 16] += heata[x + y * 16] * 0.05f;
|
heat[x + y * 16] += heata[x + y * 16] * 0.05f;
|
||||||
|
|
||||||
if (heat[x + y * 16] < 0) heat[x + y * 16] = 0;
|
if (heat[x + y * 16] < 0) heat[x + y * 16] = 0;
|
||||||
heata[x + y * 16] -= 0.1f;
|
heata[x + y * 16] -= 0.1f;
|
||||||
if (Mth::random() < 0.05f) {
|
if (Mth::random() < 0.05f) {
|
||||||
heata[x + y * 16] = 0.5f;
|
heata[x + y * 16] = 0.5f;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
float* tmp = next;
|
float* tmp = next;
|
||||||
next = current;
|
next = current;
|
||||||
current = tmp;
|
current = tmp;
|
||||||
|
|
||||||
for (int i = 0; i < 256; i++) {
|
for (int i = 0; i < 256; i++) {
|
||||||
float pow = current[i];
|
float pow = current[i];
|
||||||
if (pow > 1) pow = 1;
|
if (pow > 1) pow = 1;
|
||||||
if (pow < 0) pow = 0;
|
if (pow < 0) pow = 0;
|
||||||
|
|
||||||
float pp = pow * pow;
|
float pp = pow * pow;
|
||||||
|
|
||||||
int r = (int) (32 + pp * 32);
|
int r = (int) (32 + pp * 32);
|
||||||
int g = (int) (50 + pp * 64);
|
int g = (int) (50 + pp * 64);
|
||||||
int b = (int) (255);
|
int b = (int) (255);
|
||||||
int a = (int) (146 + pp * 50);
|
int a = (int) (146 + pp * 50);
|
||||||
|
|
||||||
//if (anaglyph3d) {
|
//if (anaglyph3d) {
|
||||||
// int rr = (r * 30 + g * 59 + b * 11) / 100;
|
// int rr = (r * 30 + g * 59 + b * 11) / 100;
|
||||||
// int gg = (r * 30 + g * 70) / (100);
|
// int gg = (r * 30 + g * 70) / (100);
|
||||||
// int bb = (r * 30 + b * 70) / (100);
|
// int bb = (r * 30 + b * 70) / (100);
|
||||||
|
|
||||||
// r = rr;
|
// r = rr;
|
||||||
// g = gg;
|
// g = gg;
|
||||||
// b = bb;
|
// b = bb;
|
||||||
//}
|
//}
|
||||||
|
|
||||||
pixels[i * 4 + 0] = r;
|
pixels[i * 4 + 0] = r;
|
||||||
pixels[i * 4 + 1] = g;
|
pixels[i * 4 + 1] = g;
|
||||||
pixels[i * 4 + 2] = b;
|
pixels[i * 4 + 2] = b;
|
||||||
pixels[i * 4 + 3] = a;
|
pixels[i * 4 + 3] = a;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// WaterSideTexture
|
// WaterSideTexture
|
||||||
//
|
//
|
||||||
WaterSideTexture::WaterSideTexture()
|
WaterSideTexture::WaterSideTexture()
|
||||||
: super(Tile::water->tex + 1),
|
: super(Tile::water->tex + 1),
|
||||||
_tick(0),
|
_tick(0),
|
||||||
_frame(0),
|
_frame(0),
|
||||||
_tickCount(0)
|
_tickCount(0)
|
||||||
@@ -164,51 +164,237 @@ void WaterSideTexture::tick() {
|
|||||||
next[x + y * 16] = pow / 3.2f + heat[x + y * 16] * 0.8f;
|
next[x + y * 16] = pow / 3.2f + heat[x + y * 16] * 0.8f;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int x = 0; x < 16; x++)
|
for (int x = 0; x < 16; x++)
|
||||||
for (int y = 0; y < 16; y++) {
|
for (int y = 0; y < 16; y++) {
|
||||||
heat[x + y * 16] += heata[x + y * 16] * 0.05f;
|
heat[x + y * 16] += heata[x + y * 16] * 0.05f;
|
||||||
|
|
||||||
if (heat[x + y * 16] < 0) heat[x + y * 16] = 0;
|
if (heat[x + y * 16] < 0) heat[x + y * 16] = 0;
|
||||||
heata[x + y * 16] -= 0.3f;
|
heata[x + y * 16] -= 0.3f;
|
||||||
if (Mth::random() < 0.2) {
|
if (Mth::random() < 0.2) {
|
||||||
heata[x + y * 16] = 0.5f;
|
heata[x + y * 16] = 0.5f;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
float* tmp = next;
|
||||||
float* tmp = next;
|
next = current;
|
||||||
next = current;
|
current = tmp;
|
||||||
current = tmp;
|
|
||||||
|
|
||||||
for (int i = 0; i < 256; i++) {
|
for (int i = 0; i < 256; i++) {
|
||||||
float pow = current[(i - _tickCount * 16) & 255];
|
float pow = current[(i - _tickCount * 16) & 255];
|
||||||
if (pow > 1) pow = 1;
|
if (pow > 1) pow = 1;
|
||||||
if (pow < 0) pow = 0;
|
if (pow < 0) pow = 0;
|
||||||
|
|
||||||
float pp = pow * pow;
|
float pp = pow * pow;
|
||||||
|
|
||||||
int r = (int) (32 + pp * 32);
|
int r = (int) (32 + pp * 32);
|
||||||
int g = (int) (50 + pp * 64);
|
int g = (int) (50 + pp * 64);
|
||||||
int b = (int) (255);
|
int b = (int) (255);
|
||||||
int a = (int) (146 + pp * 50);
|
int a = (int) (146 + pp * 50);
|
||||||
|
|
||||||
//if (anaglyph3d) {
|
//if (anaglyph3d) {
|
||||||
// int rr = (r * 30 + g * 59 + b * 11) / 100;
|
// int rr = (r * 30 + g * 59 + b * 11) / 100;
|
||||||
// int gg = (r * 30 + g * 70) / (100);
|
// int gg = (r * 30 + g * 70) / (100);
|
||||||
// int bb = (r * 30 + b * 70) / (100);
|
// int bb = (r * 30 + b * 70) / (100);
|
||||||
|
|
||||||
// r = rr;
|
// r = rr;
|
||||||
// g = gg;
|
// g = gg;
|
||||||
// b = bb;
|
// b = bb;
|
||||||
//}
|
//}
|
||||||
|
|
||||||
pixels[i * 4 + 0] = r;
|
pixels[i * 4 + 0] = r;
|
||||||
pixels[i * 4 + 1] = g;
|
pixels[i * 4 + 1] = g;
|
||||||
pixels[i * 4 + 2] = b;
|
pixels[i * 4 + 2] = b;
|
||||||
pixels[i * 4 + 3] = a;
|
pixels[i * 4 + 3] = a;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Lava Texture
|
||||||
|
///
|
||||||
|
|
||||||
|
LavaTexture::LavaTexture()
|
||||||
|
: super(Tile::lava->tex),
|
||||||
|
_tick(0),
|
||||||
|
_frame(0)
|
||||||
|
{
|
||||||
|
current = new float[16*16];
|
||||||
|
next = new float[16*16];
|
||||||
|
heat = new float[16*16];
|
||||||
|
heata = new float[16*16];
|
||||||
|
|
||||||
|
for (int i = 0; i < 256; ++i) {
|
||||||
|
current[i] = 0;
|
||||||
|
next[i] = 0;
|
||||||
|
heat[i] = 0;
|
||||||
|
heata[i] = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LavaTexture::~LavaTexture() {
|
||||||
|
delete[] current;
|
||||||
|
delete[] next;
|
||||||
|
delete[] heat;
|
||||||
|
delete[] heata;
|
||||||
|
}
|
||||||
|
|
||||||
|
void LavaTexture::tick()
|
||||||
|
{
|
||||||
|
for (int x = 0; x < 16; x++)
|
||||||
|
for (int y = 0; y < 16; y++) {
|
||||||
|
float pow = 0;
|
||||||
|
int xxo = (int)(Mth::sin((float)(y) * (float)(Mth::PI) * 2.0f / 16.0f) * 1.2f);
|
||||||
|
int yyo = (int)(Mth::sin((float)(x) * (float)(Mth::PI) * 2.0f / 16.0f) * 1.2f);
|
||||||
|
for (int xx = x - 1; xx <= x + 1; xx++) {
|
||||||
|
for (int yy = y - 1; yy <= y + 1; yy++) {
|
||||||
|
int xi = xx + xxo & 15;
|
||||||
|
int yi = yy + yyo & 15;
|
||||||
|
pow += current[xi + yi * 16];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
next[x + y * 16] = pow / 10.0f + (heat[(x + 0 & 15) + (y + 0 & 15) * 16] + heat[(x + 1 & 15) + (y + 0 & 15) * 16] + heat[(x + 1 & 15) + (y + 1 & 15) * 16] + heat[(x + 0 & 15) + (y + 1 & 15) * 16]) / 4.0f * 0.8f;
|
||||||
|
heat[x + y * 16] = heat[x + y * 16] + heata[x + y * 16] * 0.01f;
|
||||||
|
if (heat[x + y * 16] < 0.0f) {
|
||||||
|
heat[x + y * 16] = 0.0f;
|
||||||
|
}
|
||||||
|
heata[x + y * 16] = heata[x + y * 16] - 0.06f;
|
||||||
|
if (Mth::random() < 0.005) {
|
||||||
|
heata[x + y * 16] = 1.5f;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
float* tmp = next;
|
||||||
|
next = current;
|
||||||
|
current = tmp;
|
||||||
|
|
||||||
|
for (int i = 0; i < 256; i++) {
|
||||||
|
float pow = current[i] * 2.0f;
|
||||||
|
if (pow > 1) pow = 1;
|
||||||
|
if (pow < 0) pow = 0;
|
||||||
|
|
||||||
|
float pp = pow * pow;
|
||||||
|
|
||||||
|
int r = (int) (pow * 100.0f + 155.0f);
|
||||||
|
int g = (int) (pp * 255.0f);
|
||||||
|
int b = (int) (pp * pp * 128.0f);
|
||||||
|
|
||||||
|
//if (anaglyph3d) {
|
||||||
|
// int rr = (r * 30 + g * 59 + b * 11) / 100;
|
||||||
|
// int gg = (r * 30 + g * 70) / (100);
|
||||||
|
// int bb = (r * 30 + b * 70) / (100);
|
||||||
|
|
||||||
|
// r = rr;
|
||||||
|
// g = gg;
|
||||||
|
// b = bb;
|
||||||
|
//}
|
||||||
|
|
||||||
|
pixels[i * 4 + 0] = r;
|
||||||
|
pixels[i * 4 + 1] = g;
|
||||||
|
pixels[i * 4 + 2] = b;
|
||||||
|
pixels[i * 4 + 3] = -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Lava Side Texture
|
||||||
|
///
|
||||||
|
|
||||||
|
LavaSideTexture::LavaSideTexture()
|
||||||
|
: super(Tile::lava->tex + 1),
|
||||||
|
_tick(0),
|
||||||
|
_frame(0),
|
||||||
|
_tickCount(0)
|
||||||
|
{
|
||||||
|
replicate = 2;
|
||||||
|
|
||||||
|
current = new float[16*16];
|
||||||
|
next = new float[16*16];
|
||||||
|
heat = new float[16*16];
|
||||||
|
heata = new float[16*16];
|
||||||
|
|
||||||
|
for (int i = 0; i < 256; ++i) {
|
||||||
|
current[i] = 0;
|
||||||
|
next[i] = 0;
|
||||||
|
heat[i] = 0;
|
||||||
|
heata[i] = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
LavaSideTexture::~LavaSideTexture() {
|
||||||
|
delete[] current;
|
||||||
|
delete[] next;
|
||||||
|
delete[] heat;
|
||||||
|
delete[] heata;
|
||||||
|
}
|
||||||
|
|
||||||
|
void LavaSideTexture::tick() {
|
||||||
|
++_tickCount;
|
||||||
|
for (int x = 0; x < 16; x++)
|
||||||
|
for (int y = 0; y < 16; y++) {
|
||||||
|
float pow = 0;
|
||||||
|
int yl = (int)(Mth::sin((float)(y) * (float)(Mth::PI)* 2.0f / 16.0f) * 1.2f); // var2 is y
|
||||||
|
int xl = (int)(Mth::sin((float)(x) * (float)(Mth::PI)* 2.0f / 16.0f) * 1.2f); // var1 is x
|
||||||
|
for (int yy = x - 1; yy <= x + 1; yy++) {
|
||||||
|
for (int xx = y - 1; xx <= y + 1; xx++) {
|
||||||
|
int xi = (yy + yl) & 15; // var8
|
||||||
|
int yi = (xx + xl) & 15; //var9
|
||||||
|
pow += current[xi + yi * 16];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
next[x + y * 16] =
|
||||||
|
next[x + y * 16] =
|
||||||
|
pow / 10.0f + (
|
||||||
|
heat[(x + 0 & 15) + (y + 0 & 15) *
|
||||||
|
16] + heat[
|
||||||
|
(x + 1 & 15) + (y + 0 & 15) * 16] + heat[(x + 1 & 15) + (y + 1 & 15) *
|
||||||
|
16] + heat[
|
||||||
|
(x + 0 & 15) + (y + 1 & 15) * 16]) / 4.0f
|
||||||
|
* 0.8f;
|
||||||
|
heat[x + y * 16] = heat[x + y * 16] + heata[x + y * 16] * 0.01f;
|
||||||
|
|
||||||
|
if (heat[x + y * 16] < 0.0f) {
|
||||||
|
heat[x + y * 16] = 0.0f;
|
||||||
|
}
|
||||||
|
heata[x + y * 16] = heata[x + y * 16] - 0.06f;
|
||||||
|
|
||||||
|
if (Mth::random() < 0.005) {
|
||||||
|
heata[x + y * 16] = 1.5f;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
float* tmp = next;
|
||||||
|
next = current;
|
||||||
|
current = tmp;
|
||||||
|
|
||||||
|
for (int i = 0; i < 256; i++) {
|
||||||
|
float pow = current[(i - _tickCount / 3 * 16) & 255] * 2.0f;
|
||||||
|
if (pow > 1) pow = 1;
|
||||||
|
if (pow < 0) pow = 0;
|
||||||
|
|
||||||
|
float pp = pow * pow;
|
||||||
|
|
||||||
|
int r = (int) (pow * 100.0f + 155.0f);
|
||||||
|
int g = (int) (pow * pow * 255.0f);
|
||||||
|
int b = (int) (pow * pow * pow * pow * 128.0f);
|
||||||
|
// int a = (int) (146 + pp * 50);
|
||||||
|
|
||||||
|
//if (anaglyph3d) {
|
||||||
|
// int rr = (r * 30 + g * 59 + b * 11) / 100;
|
||||||
|
// int gg = (r * 30 + g * 70) / (100);
|
||||||
|
// int bb = (r * 30 + b * 70) / (100);
|
||||||
|
|
||||||
|
// r = rr;
|
||||||
|
// g = gg;
|
||||||
|
// b = bb;
|
||||||
|
//}
|
||||||
|
|
||||||
|
pixels[i * 4 + 0] = r;
|
||||||
|
pixels[i * 4 + 1] = g;
|
||||||
|
pixels[i * 4 + 2] = b;
|
||||||
|
pixels[i * 4 + 3] = -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
FireTexture::FireTexture()
|
FireTexture::FireTexture()
|
||||||
: super(((Tile*)Tile::fire)->tex),
|
: super(((Tile*)Tile::fire)->tex),
|
||||||
_tick(0),
|
_tick(0),
|
||||||
_frame(0)
|
_frame(0)
|
||||||
{
|
{
|
||||||
@@ -236,63 +422,63 @@ FireTexture::~FireTexture() {
|
|||||||
// oh boy time to implement fire textures, i am so fucked - shredder
|
// oh boy time to implement fire textures, i am so fucked - shredder
|
||||||
|
|
||||||
void FireTexture::tick() {
|
void FireTexture::tick() {
|
||||||
// loop generates fire texture on the empty texture grid, hopefully shouldnt be too taxing on older hardware - shredder
|
// loop generates fire texture on the empty texture grid, hopefully shouldnt be too taxing on older hardware - shredder
|
||||||
for (int x = 0; x < 16; x++) {
|
for (int x = 0; x < 16; x++) {
|
||||||
for (int y = 0; y < 20; y++) {
|
for (int y = 0; y < 20; y++) {
|
||||||
int count = 18;
|
int count = 18;
|
||||||
float pow = this->current[x + (y + 1) % 20 * 16] * (float)(count);
|
float pow = this->current[x + (y + 1) % 20 * 16] * (float)(count);
|
||||||
for (int xx = x - 1; xx <= x + 1; xx++) {
|
for (int xx = x - 1; xx <= x + 1; xx++) {
|
||||||
for (int yy = y; yy <= y + 1; yy++) {
|
for (int yy = y; yy <= y + 1; yy++) {
|
||||||
if (xx >= 0 && yy >= 0 && xx < 16 && yy < 20) {
|
if (xx >= 0 && yy >= 0 && xx < 16 && yy < 20) {
|
||||||
pow += this->current[xx + yy * 16];
|
pow += this->current[xx + yy * 16];
|
||||||
}
|
}
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this->next[x + y * 16] = pow / (float(count) * 1.06f);
|
this->next[x + y * 16] = pow / (float(count) * 1.06f);
|
||||||
if (y >= 19) {
|
if (y >= 19) {
|
||||||
this->next[x + y * 16] = float(Mth::random() * Mth::random() * Mth::random() * 4.0 + Mth::random() * 0.1f + 0.2f);
|
this->next[x + y * 16] = float(Mth::random() * Mth::random() * Mth::random() * 4.0 + Mth::random() * 0.1f + 0.2f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// hopefully this doesn't cause any mysterious issues - shredder
|
// hopefully this doesn't cause any mysterious issues - shredder
|
||||||
float* tmp = next;
|
float* tmp = next;
|
||||||
next = current;
|
next = current;
|
||||||
current = tmp;
|
current = tmp;
|
||||||
|
|
||||||
for (int i = 0; i < 256; i++) {
|
for (int i = 0; i < 256; i++) {
|
||||||
float pow = this->current[i] * 1.8f;
|
float pow = this->current[i] * 1.8f;
|
||||||
if (pow > 1.0f) {
|
if (pow > 1.0f) {
|
||||||
pow = 1.0f;
|
pow = 1.0f;
|
||||||
}
|
}
|
||||||
if (pow < 0.0f) {
|
if (pow < 0.0f) {
|
||||||
pow = 0.0f;
|
pow = 0.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int r = (int) (pow * 155.0f + 100.0f);
|
int r = (int) (pow * 155.0f + 100.0f);
|
||||||
int g = (int)(pow * pow * 255.0f);
|
int g = (int)(pow * pow * 255.0f);
|
||||||
int b = (int)(pow * pow * pow * pow * pow * pow * pow * pow * pow * pow * 255.0f);
|
int b = (int)(pow * pow * pow * pow * pow * pow * pow * pow * pow * pow * 255.0f);
|
||||||
int a = 255;
|
int a = 255;
|
||||||
if (pow < 0.5f) {
|
if (pow < 0.5f) {
|
||||||
a = 0;
|
a = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// @TODO: cant be arsed rn to implement the anaglyph3d check would be nice to check if it does - shredder
|
// @TODO: cant be arsed rn to implement the anaglyph3d check would be nice to check if it does - shredder
|
||||||
//if (this->anaglyph3d) {
|
//if (this->anaglyph3d) {
|
||||||
// float rr = (r * 30 + g * 59 + b * 11) / 100;
|
// float rr = (r * 30 + g * 59 + b * 11) / 100;
|
||||||
// float gg = (r * 30 + g * 70) / 100;
|
// float gg = (r * 30 + g * 70) / 100;
|
||||||
// float bb = (r * 30 + b * 70) / 100;
|
// float bb = (r * 30 + b * 70) / 100;
|
||||||
// r = rr;
|
// r = rr;
|
||||||
// g = gg;
|
// g = gg;
|
||||||
// b = bb;
|
// b = bb;
|
||||||
//}
|
//}
|
||||||
|
|
||||||
pixels[i * 4 + 0] = r;
|
pixels[i * 4 + 0] = r;
|
||||||
pixels[i * 4 + 1] = g;
|
pixels[i * 4 + 1] = g;
|
||||||
pixels[i * 4 + 2] = b;
|
pixels[i * 4 + 2] = b;
|
||||||
pixels[i * 4 + 3] = a;
|
pixels[i * 4 + 3] = a;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -56,6 +56,44 @@ public:
|
|||||||
void tick();
|
void tick();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class LavaTexture: public DynamicTexture
|
||||||
|
{
|
||||||
|
typedef DynamicTexture super;
|
||||||
|
int _tick;
|
||||||
|
int _frame;
|
||||||
|
|
||||||
|
float* current;
|
||||||
|
float* next;
|
||||||
|
float* heat;
|
||||||
|
float* heata;
|
||||||
|
|
||||||
|
public:
|
||||||
|
LavaTexture();
|
||||||
|
~LavaTexture();
|
||||||
|
|
||||||
|
void tick();
|
||||||
|
};
|
||||||
|
|
||||||
|
class LavaSideTexture: public DynamicTexture
|
||||||
|
{
|
||||||
|
typedef DynamicTexture super;
|
||||||
|
int _tick;
|
||||||
|
int _frame;
|
||||||
|
int _tickCount;
|
||||||
|
|
||||||
|
float* current;
|
||||||
|
float* next;
|
||||||
|
float* heat;
|
||||||
|
float* heata;
|
||||||
|
|
||||||
|
public:
|
||||||
|
LavaSideTexture();
|
||||||
|
~LavaSideTexture();
|
||||||
|
|
||||||
|
void tick();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
class FireTexture: public DynamicTexture
|
class FireTexture: public DynamicTexture
|
||||||
{
|
{
|
||||||
typedef DynamicTexture super;
|
typedef DynamicTexture super;
|
||||||
|
|||||||
@@ -191,8 +191,13 @@ int main(void) {
|
|||||||
App* app = new MAIN_CLASS();
|
App* app = new MAIN_CLASS();
|
||||||
|
|
||||||
g_app = app;
|
g_app = app;
|
||||||
|
#ifdef __HAIKU__
|
||||||
|
((MAIN_CLASS*)g_app)->externalStoragePath = "/system/settings/minecraftpe";
|
||||||
|
((MAIN_CLASS*)g_app)->externalCacheStoragePath = "/system/settings/minecraftpe";
|
||||||
|
#else
|
||||||
((MAIN_CLASS*)g_app)->externalStoragePath = ".";
|
((MAIN_CLASS*)g_app)->externalStoragePath = ".";
|
||||||
((MAIN_CLASS*)g_app)->externalCacheStoragePath = ".";
|
((MAIN_CLASS*)g_app)->externalCacheStoragePath = ".";
|
||||||
|
#endif
|
||||||
g_app->init(appContext);
|
g_app->init(appContext);
|
||||||
g_app->setSize(appContext.platform->getScreenWidth(), appContext.platform->getScreenHeight());
|
g_app->setSize(appContext.platform->getScreenWidth(), appContext.platform->getScreenHeight());
|
||||||
|
|
||||||
|
|||||||
@@ -31,6 +31,13 @@
|
|||||||
pthread_attr_init(&m_attributes);
|
pthread_attr_init(&m_attributes);
|
||||||
pthread_attr_setdetachstate( &m_attributes, PTHREAD_CREATE_DETACHED );
|
pthread_attr_setdetachstate( &m_attributes, PTHREAD_CREATE_DETACHED );
|
||||||
/*int error =*/ pthread_create(&m_thread, &m_attributes, mp_threadFunc, threadParam);
|
/*int error =*/ pthread_create(&m_thread, &m_attributes, mp_threadFunc, threadParam);
|
||||||
|
#endif
|
||||||
|
#if defined(__HAIKU__)
|
||||||
|
|
||||||
|
mp_threadFunc = (thread_func)threadFunc;
|
||||||
|
m_thread = spawn_thread(mp_threadFunc, "CThread", 10, threadParam);
|
||||||
|
int res = resume_thread(m_thread);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
#ifdef MACOSX
|
#ifdef MACOSX
|
||||||
mp_threadFunc = (TaskProc) threadFunc;
|
mp_threadFunc = (TaskProc) threadFunc;
|
||||||
@@ -56,6 +63,9 @@
|
|||||||
#if defined(LINUX) || defined(ANDROID) || defined(__APPLE__) || defined(POSIX)
|
#if defined(LINUX) || defined(ANDROID) || defined(__APPLE__) || defined(POSIX)
|
||||||
usleep(millis * 1000);
|
usleep(millis * 1000);
|
||||||
#endif
|
#endif
|
||||||
|
#if defined(__HAIKU__)
|
||||||
|
snooze((bigtime_t)(millis * 1000));
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
CThread::~CThread()
|
CThread::~CThread()
|
||||||
@@ -68,6 +78,9 @@
|
|||||||
// and causes SIGABRT when the pthread_t is no longer valid.
|
// and causes SIGABRT when the pthread_t is no longer valid.
|
||||||
pthread_attr_destroy(&m_attributes);
|
pthread_attr_destroy(&m_attributes);
|
||||||
#endif
|
#endif
|
||||||
|
#if defined(__HAIKU__)
|
||||||
|
kill_thread(m_thread);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -21,6 +21,9 @@ typedef void *( * pthread_fn )( void * );
|
|||||||
#ifdef MACOSX
|
#ifdef MACOSX
|
||||||
#include <CoreServices/CoreServices.h>
|
#include <CoreServices/CoreServices.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#endif
|
||||||
|
#ifdef __HAIKU__
|
||||||
|
#include <kernel/OS.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
class CThread
|
class CThread
|
||||||
@@ -43,6 +46,10 @@ typedef void *( * pthread_fn )( void * );
|
|||||||
pthread_t m_thread;
|
pthread_t m_thread;
|
||||||
pthread_attr_t m_attributes;
|
pthread_attr_t m_attributes;
|
||||||
#endif
|
#endif
|
||||||
|
#if defined(__HAIKU__)
|
||||||
|
thread_func mp_threadFunc;
|
||||||
|
thread_id m_thread;
|
||||||
|
#endif
|
||||||
#ifdef MACOSX
|
#ifdef MACOSX
|
||||||
TaskProc mp_threadFunc;
|
TaskProc mp_threadFunc;
|
||||||
MPTaskID m_threadID;
|
MPTaskID m_threadID;
|
||||||
|
|||||||
@@ -351,7 +351,8 @@ StartupResult RakPeer::Startup( unsigned short maxConnections, SocketDescriptor
|
|||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
threadPriority=0;
|
threadPriority=0;
|
||||||
|
|
||||||
|
#elif defined(__HAIKU__)
|
||||||
|
threadPriority=40;
|
||||||
#else
|
#else
|
||||||
threadPriority=1000;
|
threadPriority=1000;
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -19,6 +19,8 @@ using namespace RakNet;
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#elif defined(__HAIKU__)
|
||||||
|
#include <kernel/OS.h>
|
||||||
#else
|
#else
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#endif
|
#endif
|
||||||
@@ -92,10 +94,10 @@ int RakThread::Create( void* start_address( void* ), void *arglist, int priority
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#elif defined(__HAIKU__)
|
||||||
|
thread_id threadHandle = spawn_thread((thread_func)start_address, "RakThread", priority, arglist);
|
||||||
|
int res = resume_thread(threadHandle);
|
||||||
|
return res == B_OK ? 0 : 1;
|
||||||
#else
|
#else
|
||||||
pthread_t threadHandle;
|
pthread_t threadHandle;
|
||||||
// Create thread linux
|
// Create thread linux
|
||||||
|
|||||||
@@ -42,11 +42,10 @@ SocketLayerOverride *SocketLayer::slo=0;
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(__HAIKU__)
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <ifaddrs.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1436,6 +1435,24 @@ RakNet::RakString SocketLayer::GetSubNetForSocketAndIp(SOCKET inSock, RakNet::Ra
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return "";
|
return "";
|
||||||
|
#elif defined(__HAIKU__)
|
||||||
|
struct ifaddrs *ifap, *ifa;
|
||||||
|
getifaddrs (&ifap);
|
||||||
|
for (ifa = ifap; ifa; ifa = ifa->ifa_next) {
|
||||||
|
if (ifa->ifa_addr && ifa->ifa_addr->sa_family==AF_INET) {
|
||||||
|
sockaddr_in* sa = (sockaddr_in*)ifa->ifa_addr;
|
||||||
|
char* ip_addr = inet_ntoa(sa->sin_addr);
|
||||||
|
if (inIpString == ip_addr) {
|
||||||
|
sockaddr_in* sa = (sockaddr_in*)ifa->ifa_netmask;
|
||||||
|
char* netmask = inet_ntoa(sa->sin_addr);
|
||||||
|
|
||||||
|
freeifaddrs(ifap);
|
||||||
|
return netmask;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
freeifaddrs(ifap);
|
||||||
|
return "";
|
||||||
#else
|
#else
|
||||||
|
|
||||||
int fd,fd2;
|
int fd,fd2;
|
||||||
@@ -1648,7 +1665,7 @@ void GetMyIP_Win32( SystemAddress addresses[MAXIMUM_NUMBER_OF_INTERNAL_IDS] )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// #else
|
// #else
|
||||||
/*
|
|
||||||
void GetMyIP_Linux( SystemAddress addresses[MAXIMUM_NUMBER_OF_INTERNAL_IDS] )
|
void GetMyIP_Linux( SystemAddress addresses[MAXIMUM_NUMBER_OF_INTERNAL_IDS] )
|
||||||
{
|
{
|
||||||
struct ifaddrs *ifaddr, *ifa;
|
struct ifaddrs *ifaddr, *ifa;
|
||||||
@@ -1699,7 +1716,7 @@ void GetMyIP_Linux( SystemAddress addresses[MAXIMUM_NUMBER_OF_INTERNAL_IDS] )
|
|||||||
|
|
||||||
freeifaddrs(ifaddr);
|
freeifaddrs(ifaddr);
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1711,6 +1728,8 @@ void SocketLayer::GetMyIP( SystemAddress addresses[MAXIMUM_NUMBER_OF_INTERNAL_ID
|
|||||||
|
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
GetMyIP_Win32(addresses);
|
GetMyIP_Win32(addresses);
|
||||||
|
#elif defined(__HAIKU__)
|
||||||
|
GetMyIP_Linux(addresses);
|
||||||
#else
|
#else
|
||||||
// GetMyIP_Linux(addresses);
|
// GetMyIP_Linux(addresses);
|
||||||
GetMyIP_Win32(addresses);
|
GetMyIP_Win32(addresses);
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
#include "UDPForwarder.h"
|
#include "UDPForwarder.h"
|
||||||
|
|
||||||
|
#if defined(__HAIKU__)
|
||||||
|
#include <sys/select.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#if _RAKNET_SUPPORT_UDPForwarder==1
|
#if _RAKNET_SUPPORT_UDPForwarder==1
|
||||||
|
|
||||||
#include "GetTime.h"
|
#include "GetTime.h"
|
||||||
|
|||||||
@@ -102,8 +102,8 @@ void Chicken::dropDeathLoot( /*bool wasKilledByPlayer, int playerBonusLevel*/ )
|
|||||||
spawnAtLocation(Item::feather->id, 1);
|
spawnAtLocation(Item::feather->id, 1);
|
||||||
}
|
}
|
||||||
//// and some meat
|
//// and some meat
|
||||||
//if (isOnFire()) spawnAtLocation(Item::chicken_cooked->id, 1); //@fire
|
if (isOnFire()) spawnAtLocation(Item::chicken_cooked->id, 1); //@fire
|
||||||
//else
|
else
|
||||||
spawnAtLocation(Item::chicken_raw->id, 1);
|
spawnAtLocation(Item::chicken_raw->id, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -66,11 +66,11 @@ void Cow::dropDeathLoot( /*bool wasKilledByPlayer, int playerBonusLevel*/ ) {
|
|||||||
// and some meat
|
// and some meat
|
||||||
count = random.nextInt(3) + 1;
|
count = random.nextInt(3) + 1;
|
||||||
for (int i = 0; i < count; i++) {
|
for (int i = 0; i < count; i++) {
|
||||||
// if (isOnFire()) { //@fire
|
if (isOnFire()) { //@fire
|
||||||
// spawnAtLocation(Item::beef_cooked->id, 1);
|
spawnAtLocation(Item::beef_cooked->id, 1);
|
||||||
// } else {
|
} else {
|
||||||
spawnAtLocation(Item::beef_raw->id, 1);
|
spawnAtLocation(Item::beef_raw->id, 1);
|
||||||
// }
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -54,8 +54,8 @@ std::string Pig::getDeathSound()
|
|||||||
int Pig::getDeathLoot()
|
int Pig::getDeathLoot()
|
||||||
{
|
{
|
||||||
//@fire
|
//@fire
|
||||||
//if (isOnFire())
|
if (isOnFire())
|
||||||
// return Item::porkChop_cooked->id;
|
return Item::porkChop_cooked->id;
|
||||||
return Item::porkChop_raw->id;
|
return Item::porkChop_raw->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -143,7 +143,7 @@ void Biome::teardownBiomes() {
|
|||||||
Feature* Biome::getTreeFeature( Random* random )
|
Feature* Biome::getTreeFeature( Random* random )
|
||||||
{
|
{
|
||||||
if (random->nextInt(10) == 0) {
|
if (random->nextInt(10) == 0) {
|
||||||
return new BasicTree(false);
|
// return new BasicTree(false); // temporarily disabled
|
||||||
}
|
}
|
||||||
return new TreeFeature(false);
|
return new TreeFeature(false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ public:
|
|||||||
return new BirchFeature();
|
return new BirchFeature();
|
||||||
}
|
}
|
||||||
if (random->nextInt(3) == 0) {
|
if (random->nextInt(3) == 0) {
|
||||||
return new BasicTree(false);
|
// return new BasicTree(false); // temporarily disabled
|
||||||
}
|
}
|
||||||
return new TreeFeature(false);
|
return new TreeFeature(false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ class RainforestBiome: public Biome
|
|||||||
public:
|
public:
|
||||||
Feature* getTreeFeature(Random* random) {
|
Feature* getTreeFeature(Random* random) {
|
||||||
if (random->nextInt(3) == 0) {
|
if (random->nextInt(3) == 0) {
|
||||||
return new BasicTree(false);
|
// return new BasicTree(false); // temporarily disabled
|
||||||
}
|
}
|
||||||
return new TreeFeature(false);
|
return new TreeFeature(false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -138,7 +138,7 @@ void CanyonFeature::addTunnel( int xOffs, int zOffs, unsigned char* blocks, floa
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CanyonFeature::addFeature(Level* level, int x, int z, int xOffs, int zOffs,unsigned char* blocks)
|
void CanyonFeature::addFeature(Level* level, int x, int z, int xOffs, int zOffs, unsigned char* blocks, int blocksSize)
|
||||||
{
|
{
|
||||||
if (random.nextInt(15) != 0) return;
|
if (random.nextInt(15) != 0) return;
|
||||||
|
|
||||||
|
|||||||
@@ -11,8 +11,12 @@ class CanyonFeature: public LargeFeature {
|
|||||||
|
|
||||||
/*protected*/
|
/*protected*/
|
||||||
void addTunnel(int xOffs, int zOffs, unsigned char* blocks, float xCave, float yCave, float zCave, float thickness, float yRot, float xRot, int step, int dist, float yScale);
|
void addTunnel(int xOffs, int zOffs, unsigned char* blocks, float xCave, float yCave, float zCave, float thickness, float yRot, float xRot, int step, int dist, float yScale);
|
||||||
|
|
||||||
/*protected*/
|
/*protected*/
|
||||||
void addFeature(Level* level, int x, int z, int xOffs, int zOffs,unsigned char* blocks);
|
void addFeature(Level* level, int x, int z, int xOffs, int zOffs, unsigned char* blocks, int blocksSize);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -25,6 +25,7 @@ class LevelChunk;
|
|||||||
|
|
||||||
#include "../chunk/ChunkSource.h"
|
#include "../chunk/ChunkSource.h"
|
||||||
#include "LargeCaveFeature.h"
|
#include "LargeCaveFeature.h"
|
||||||
|
#include "CanyonFeature.h"
|
||||||
#include "synth/PerlinNoise.h"
|
#include "synth/PerlinNoise.h"
|
||||||
#include "../../../SharedConstants.h"
|
#include "../../../SharedConstants.h"
|
||||||
|
|
||||||
@@ -63,6 +64,7 @@ private:
|
|||||||
public:
|
public:
|
||||||
//Biome** biomes;
|
//Biome** biomes;
|
||||||
LargeCaveFeature caveFeature;
|
LargeCaveFeature caveFeature;
|
||||||
|
CanyonFeature canyonFeature;
|
||||||
int waterDepths[16+16][16+16];
|
int waterDepths[16+16][16+16];
|
||||||
private:
|
private:
|
||||||
ChunkMap chunkMap;
|
ChunkMap chunkMap;
|
||||||
@@ -92,6 +94,7 @@ private:
|
|||||||
float* fi;
|
float* fi;
|
||||||
float* fis;
|
float* fis;
|
||||||
///*private*/ float[] temperatures;
|
///*private*/ float[] temperatures;
|
||||||
|
float* temperatures; // normally unused like above, but restored this maybe might come handy - shredder
|
||||||
};
|
};
|
||||||
|
|
||||||
class PerformanceTestChunkSource : public ChunkSource
|
class PerformanceTestChunkSource : public ChunkSource
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ class BasicTree : public Feature
|
|||||||
typedef Feature super;
|
typedef Feature super;
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
unsigned char axisConversionArray[6];
|
unsigned char axisConversionArray[6];
|
||||||
Random *rnd;
|
Random *rnd;
|
||||||
@@ -25,11 +25,11 @@ private:
|
|||||||
int origin[3];
|
int origin[3];
|
||||||
int height;
|
int height;
|
||||||
int trunkHeight;
|
int trunkHeight;
|
||||||
double trunkHeightScale;
|
float trunkHeightScale;
|
||||||
double branchDensity;
|
float branchDensity;
|
||||||
double branchSlope;
|
float branchSlope;
|
||||||
double widthScale;
|
float widthScale;
|
||||||
double foliageDensity;
|
float foliageDensity;
|
||||||
int trunkWidth;
|
int trunkWidth;
|
||||||
int heightVariance;
|
int heightVariance;
|
||||||
int foliageHeight;
|
int foliageHeight;
|
||||||
@@ -38,7 +38,7 @@ private:
|
|||||||
void prepare(){
|
void prepare(){
|
||||||
trunkHeight = (int) (height * trunkHeightScale);
|
trunkHeight = (int) (height * trunkHeightScale);
|
||||||
if (trunkHeight >= height) trunkHeight = height - 1;
|
if (trunkHeight >= height) trunkHeight = height - 1;
|
||||||
int clustersPerY = (int) (1.382 + pow(foliageDensity * height / 13.0, 2));
|
int clustersPerY = (int) (1.382f + pow(foliageDensity * height / 13.0, 2));
|
||||||
if (clustersPerY < 1) clustersPerY = 1;
|
if (clustersPerY < 1) clustersPerY = 1;
|
||||||
int **tempFoliageCoords = new int *[clustersPerY * height];
|
int **tempFoliageCoords = new int *[clustersPerY * height];
|
||||||
for( int i = 0; i < clustersPerY * height; i++ )
|
for( int i = 0; i < clustersPerY * height; i++ )
|
||||||
@@ -68,19 +68,19 @@ private:
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
double originOffset = 0.5;
|
float originOffset = 0.5f;
|
||||||
while (num < clustersPerY)
|
while (num < clustersPerY)
|
||||||
{
|
{
|
||||||
double radius = widthScale * (shapefac * (rnd->nextFloat() + 0.328));
|
float radius = widthScale * (shapefac * (rnd->nextFloat() + 0.328f));
|
||||||
double angle = rnd->nextFloat() * 2.0 * 3.14159;
|
float angle = rnd->nextFloat() * 2.0f * 3.14159f;
|
||||||
int x = Mth::floor(radius * sin(angle) + origin[0] + originOffset);
|
int x = Mth::floor(radius * sin(angle) + origin[0] + originOffset);
|
||||||
int z = Mth::floor(radius * cos(angle) + origin[2] + originOffset);
|
int z = Mth::floor(radius * cos(angle) + origin[2] + originOffset);
|
||||||
int checkStart[] = { x, y, z };
|
int checkStart[] = { x, y, z };
|
||||||
int checkEnd[] = { x, y + foliageHeight, z };
|
int checkEnd[] = { x, y + foliageHeight, z };
|
||||||
if (checkLine(checkStart, checkEnd) == -1) {
|
if (checkLine(checkStart, checkEnd) == -1) {
|
||||||
int checkBranchBase[] = { origin[0], origin[1], origin[2] };
|
int checkBranchBase[] = { origin[0], origin[1], origin[2] };
|
||||||
double distance = sqrt(pow(abs(origin[0] - checkStart[0]), 2.0) + pow(abs(origin[2] - checkStart[2]), 2.0));
|
float distance = sqrt(pow(abs(origin[0] - checkStart[0]), 2.0f) + pow(abs(origin[2] - checkStart[2]), 2.0f));
|
||||||
double branchHeight = distance * branchSlope;
|
float branchHeight = distance * branchSlope;
|
||||||
if ((checkStart[1] - branchHeight) > trunkTop)
|
if ((checkStart[1] - branchHeight) > trunkTop)
|
||||||
{
|
{
|
||||||
checkBranchBase[1] = trunkTop;
|
checkBranchBase[1] = trunkTop;
|
||||||
@@ -134,7 +134,9 @@ private:
|
|||||||
offset2 = -rad;
|
offset2 = -rad;
|
||||||
while (offset2 <= rad)
|
while (offset2 <= rad)
|
||||||
{
|
{
|
||||||
double thisdistance = pow(abs(offset1) + 0.5, 2) + pow(abs(offset2) + 0.5, 2);
|
float off1 = (float)offset1 + 0.5f;
|
||||||
|
float off2 = (float)offset2 + 0.5f;
|
||||||
|
float thisdistance = (off1 * off1) + (off2 * off2);
|
||||||
if (thisdistance > radius * radius)
|
if (thisdistance > radius * radius)
|
||||||
{
|
{
|
||||||
offset2++;
|
offset2++;
|
||||||
@@ -159,14 +161,14 @@ private:
|
|||||||
|
|
||||||
}
|
}
|
||||||
float treeShape(int y){
|
float treeShape(int y){
|
||||||
if (y < (((float) height) * 0.3)) return (float) -1.618;
|
if (y < (((float) height) * 0.3f)) return (float) -1.618f;
|
||||||
float radius = ((float) height) / ((float) 2.0);
|
float radius = ((float) height) / ((float) 2.0f);
|
||||||
float adjacent = (((float) height) / ((float) 2.0)) - y;
|
float adjacent = (((float) height) / ((float) 2.0f)) - y;
|
||||||
float distance;
|
float distance;
|
||||||
if (adjacent == 0) distance = radius;
|
if (adjacent == 0) distance = radius;
|
||||||
else if (abs(adjacent) >= radius) distance = (float) 0.0;
|
else if (abs(adjacent) >= radius) distance = (float) 0.0f;
|
||||||
else distance = (float) sqrt(pow(abs(radius), 2) - pow(abs(adjacent), 2));
|
else distance = (float) sqrt(pow(abs(radius), 2) - pow(abs(adjacent), 2));
|
||||||
distance *= (float) 0.5;
|
distance *= (float) 0.5f;
|
||||||
return distance;
|
return distance;
|
||||||
}
|
}
|
||||||
float foliageShape(int y){
|
float foliageShape(int y){
|
||||||
@@ -207,8 +209,8 @@ private:
|
|||||||
char primsign;
|
char primsign;
|
||||||
if (delta[primidx] > 0) primsign = 1;
|
if (delta[primidx] > 0) primsign = 1;
|
||||||
else primsign = -1;
|
else primsign = -1;
|
||||||
double secfac1 = ((double) delta[secidx1]) / ((double) delta[primidx]);
|
float secfac1 = ((float) delta[secidx1]) / ((float) delta[primidx]);
|
||||||
double secfac2 = ((double) delta[secidx2]) / ((double) delta[primidx]);
|
float secfac2 = ((float) delta[secidx2]) / ((float) delta[primidx]);
|
||||||
int coordinate[] = { 0, 0, 0 };
|
int coordinate[] = { 0, 0, 0 };
|
||||||
int primoffset = 0;
|
int primoffset = 0;
|
||||||
int endoffset = delta[primidx] + primsign;
|
int endoffset = delta[primidx] + primsign;
|
||||||
@@ -312,8 +314,8 @@ private:
|
|||||||
char primsign;
|
char primsign;
|
||||||
if (delta[primidx] > 0) primsign = 1;
|
if (delta[primidx] > 0) primsign = 1;
|
||||||
else primsign = -1;
|
else primsign = -1;
|
||||||
double secfac1 = ((double) delta[secidx1]) / ((double) delta[primidx]);
|
float secfac1 = ((float) delta[secidx1]) / ((float) delta[primidx]);
|
||||||
double secfac2 = ((double) delta[secidx2]) / ((double) delta[primidx]);
|
float secfac2 = ((float) delta[secidx2]) / ((float) delta[primidx]);
|
||||||
int coordinate[] = { 0, 0, 0 };
|
int coordinate[] = { 0, 0, 0 };
|
||||||
int primoffset = 0;
|
int primoffset = 0;
|
||||||
int endoffset = delta[primidx] + primsign;
|
int endoffset = delta[primidx] + primsign;
|
||||||
@@ -331,19 +333,19 @@ private:
|
|||||||
}
|
}
|
||||||
primoffset += primsign;
|
primoffset += primsign;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (primoffset == endoffset)
|
if (primoffset == endoffset)
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return abs(primoffset);
|
return abs(primoffset);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
bool checkLocation(){
|
bool checkLocation(){
|
||||||
|
|
||||||
int startPosition[] = { origin[0], origin[1], origin[2] };
|
int startPosition[] = { origin[0], origin[1], origin[2] };
|
||||||
int endPosition[] = { origin[0], origin[1] + height - 1, origin[2] };
|
int endPosition[] = { origin[0], origin[1] + height - 1, origin[2] };
|
||||||
|
|
||||||
@@ -373,11 +375,11 @@ private:
|
|||||||
public:
|
public:
|
||||||
BasicTree(bool doUpdate){
|
BasicTree(bool doUpdate){
|
||||||
axisConversionArray[0] = 2;
|
axisConversionArray[0] = 2;
|
||||||
axisConversionArray[1] = 0;
|
axisConversionArray[1] = 0;
|
||||||
axisConversionArray[2] = 0;
|
axisConversionArray[2] = 0;
|
||||||
axisConversionArray[3] = 1;
|
axisConversionArray[3] = 1;
|
||||||
axisConversionArray[4] = 2;
|
axisConversionArray[4] = 2;
|
||||||
axisConversionArray[5] = 1;
|
axisConversionArray[5] = 1;
|
||||||
rnd = new Random();
|
rnd = new Random();
|
||||||
origin[0] = 0;
|
origin[0] = 0;
|
||||||
origin[1] = 0;
|
origin[1] = 0;
|
||||||
@@ -405,7 +407,7 @@ public:
|
|||||||
delete [] foliageCoords;
|
delete [] foliageCoords;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void init(double heightInit, double widthInit, double foliageDensityInit){
|
virtual void init(float heightInit, float widthInit, float foliageDensityInit){
|
||||||
|
|
||||||
heightVariance = (int) (heightInit * 12);
|
heightVariance = (int) (heightInit * 12);
|
||||||
if (heightInit > 0.5) foliageHeight = 5;
|
if (heightInit > 0.5) foliageHeight = 5;
|
||||||
@@ -430,7 +432,7 @@ public:
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
prepare();
|
prepare();
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,10 @@
|
|||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
#if defined(__HAIKU__)
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
#include "MoveFolder.h"
|
#include "MoveFolder.h"
|
||||||
#endif
|
#endif
|
||||||
@@ -66,7 +70,7 @@ void ExternalFileLevelStorageSource::addLevelSummaryIfExists(LevelSummaryList& d
|
|||||||
|
|
||||||
void ExternalFileLevelStorageSource::getLevelList(LevelSummaryList& dest)
|
void ExternalFileLevelStorageSource::getLevelList(LevelSummaryList& dest)
|
||||||
{
|
{
|
||||||
#ifdef WIN32
|
#if defined(WIN32)
|
||||||
|
|
||||||
WIN32_FIND_DATAA fileData;
|
WIN32_FIND_DATAA fileData;
|
||||||
HANDLE hFind;
|
HANDLE hFind;
|
||||||
@@ -83,8 +87,6 @@ void ExternalFileLevelStorageSource::getLevelList(LevelSummaryList& dest)
|
|||||||
} while (FindNextFileA(hFind, &fileData));
|
} while (FindNextFileA(hFind, &fileData));
|
||||||
FindClose(hFind);
|
FindClose(hFind);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#else
|
#else
|
||||||
DIR *dp;
|
DIR *dp;
|
||||||
struct dirent *dirp;
|
struct dirent *dirp;
|
||||||
@@ -94,10 +96,20 @@ void ExternalFileLevelStorageSource::getLevelList(LevelSummaryList& dest)
|
|||||||
}
|
}
|
||||||
|
|
||||||
while ((dirp = readdir(dp)) != NULL) {
|
while ((dirp = readdir(dp)) != NULL) {
|
||||||
|
#if defined(__HAIKU__)
|
||||||
|
struct stat st;
|
||||||
|
const auto fullPath = basePath + "/" + dirp->d_name;
|
||||||
|
if (!lstat(fullPath.c_str(), &st)) {
|
||||||
|
if(st.st_mode & S_IFDIR) {
|
||||||
|
addLevelSummaryIfExists(dest, dirp->d_name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#else
|
||||||
if (dirp->d_type == DT_DIR)
|
if (dirp->d_type == DT_DIR)
|
||||||
{
|
{
|
||||||
addLevelSummaryIfExists(dest, dirp->d_name);
|
addLevelSummaryIfExists(dest, dirp->d_name);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
closedir(dp);
|
closedir(dp);
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -131,6 +131,10 @@ public:
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int getRenderLayer() {
|
||||||
|
return Tile::RENDERLAYER_ALPHATEST;
|
||||||
|
}
|
||||||
|
|
||||||
bool canBurn(LevelSource* level, int x, int y, int z) {
|
bool canBurn(LevelSource* level, int x, int y, int z) {
|
||||||
return flameOdds[level->getTile(x, y, z)] > 0;
|
return flameOdds[level->getTile(x, y, z)] > 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
#include "../levelgen/feature/SpruceFeature.h"
|
#include "../levelgen/feature/SpruceFeature.h"
|
||||||
#include "../levelgen/feature/BirchFeature.h"
|
#include "../levelgen/feature/BirchFeature.h"
|
||||||
#include "../levelgen/feature/TreeFeature.h"
|
#include "../levelgen/feature/TreeFeature.h"
|
||||||
|
#include "../levelgen/feature/BasicTree.h"
|
||||||
|
|
||||||
class Sapling: public Bush
|
class Sapling: public Bush
|
||||||
{
|
{
|
||||||
@@ -90,9 +91,9 @@ public:
|
|||||||
// f = new TreeFeature(true, 4 + random.nextInt(7), TreeTile::JUNGLE_TRUNK, LeafTile::JUNGLE_LEAF, false);
|
// f = new TreeFeature(true, 4 + random.nextInt(7), TreeTile::JUNGLE_TRUNK, LeafTile::JUNGLE_LEAF, false);
|
||||||
// }
|
// }
|
||||||
} else {
|
} else {
|
||||||
//if (random->nextInt(10) == 0) {
|
if (random->nextInt(10) == 0) {
|
||||||
// f = new BasicTree(true);
|
// f = new BasicTree(true); // temporarily disabled
|
||||||
//} else
|
} else
|
||||||
f = new TreeFeature(true);
|
f = new TreeFeature(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user