mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/4jcraft.git
synced 2026-09-23 09:42:26 +00:00
Decouple 4J libs for extraction to 4jlibs
This commit is contained in:
+20
-20
@@ -654,8 +654,8 @@ void C4JRender::Tick() {}
|
||||
void C4JRender::UpdateGamma(unsigned short) {}
|
||||
|
||||
// Converts RGBA data to the format expected by the texture loader.
|
||||
static HRESULT LoadFromSTB(unsigned char* data, int width, int height,
|
||||
D3DXIMAGE_INFO* pSrcInfo, int** ppDataOut) {
|
||||
static int LoadFromSTB(unsigned char* data, int width, int height,
|
||||
D3DXIMAGE_INFO* pSrcInfo, int** ppDataOut) {
|
||||
int pixelCount = width * height;
|
||||
int* pixels = new int[pixelCount];
|
||||
|
||||
@@ -675,45 +675,45 @@ static HRESULT LoadFromSTB(unsigned char* data, int width, int height,
|
||||
}
|
||||
|
||||
*ppDataOut = pixels;
|
||||
return S_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
HRESULT C4JRender::LoadTextureData(const char* szFilename,
|
||||
D3DXIMAGE_INFO* pSrcInfo, int** ppDataOut) {
|
||||
int C4JRender::LoadTextureData(const char* szFilename, D3DXIMAGE_INFO* pSrcInfo,
|
||||
int** ppDataOut) {
|
||||
int width, height, channels;
|
||||
|
||||
unsigned char* data = stbi_load(szFilename, &width, &height, &channels, 4);
|
||||
if (!data) return E_FAIL;
|
||||
if (!data) return -1;
|
||||
|
||||
HRESULT hr = LoadFromSTB(data, width, height, pSrcInfo, ppDataOut);
|
||||
const int hr = LoadFromSTB(data, width, height, pSrcInfo, ppDataOut);
|
||||
|
||||
stbi_image_free(data);
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT C4JRender::LoadTextureData(std::uint8_t* pbData,
|
||||
std::uint32_t byteCount,
|
||||
D3DXIMAGE_INFO* pSrcInfo, int** ppDataOut) {
|
||||
int C4JRender::LoadTextureData(std::uint8_t* pbData,
|
||||
std::uint32_t byteCount,
|
||||
D3DXIMAGE_INFO* pSrcInfo, int** ppDataOut) {
|
||||
int width, height, channels;
|
||||
|
||||
unsigned char* data =
|
||||
stbi_load_from_memory(pbData, byteCount, &width, &height, &channels, 4);
|
||||
if (!data) return E_FAIL;
|
||||
if (!data) return -1;
|
||||
|
||||
HRESULT hr = LoadFromSTB(data, width, height, pSrcInfo, ppDataOut);
|
||||
const int hr = LoadFromSTB(data, width, height, pSrcInfo, ppDataOut);
|
||||
|
||||
stbi_image_free(data);
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT C4JRender::SaveTextureData(const char* szFilename,
|
||||
D3DXIMAGE_INFO* pSrcInfo, int* ppDataOut) {
|
||||
return S_OK;
|
||||
int C4JRender::SaveTextureData(const char* szFilename, D3DXIMAGE_INFO* pSrcInfo,
|
||||
int* ppDataOut) {
|
||||
return 0;
|
||||
}
|
||||
HRESULT C4JRender::SaveTextureDataToMemory(void* pOutput, int outputCapacity,
|
||||
int* outputLength, int width,
|
||||
int height, int* ppDataIn) {
|
||||
return S_OK;
|
||||
int C4JRender::SaveTextureDataToMemory(void* pOutput, int outputCapacity,
|
||||
int* outputLength, int width,
|
||||
int height, int* ppDataIn) {
|
||||
return 0;
|
||||
}
|
||||
void C4JRender::TextureGetStats() {}
|
||||
void* C4JRender::TextureGetTexture(int idx) { return nullptr; }
|
||||
@@ -910,7 +910,7 @@ void C4JRender::StateSetStencil(int Function, uint8_t stencil_ref,
|
||||
|
||||
void C4JRender::StateSetForceLOD(int LOD) {} // No LOD bias in legacy GL path
|
||||
|
||||
void C4JRender::BeginEvent(LPCWSTR eventName) {}
|
||||
void C4JRender::BeginEvent(const wchar_t* eventName) {}
|
||||
void C4JRender::EndEvent() {}
|
||||
void C4JRender::Suspend() {}
|
||||
bool C4JRender::Suspended() { return false; }
|
||||
|
||||
+18
-20
@@ -1,10 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#ifdef __linux__
|
||||
#include "../Minecraft.Client/Platform/Linux/Stubs/LinuxStubs.h"
|
||||
#endif
|
||||
|
||||
#include <cstdint>
|
||||
#include <cstdlib>
|
||||
|
||||
class ImageFileBuffer {
|
||||
public:
|
||||
@@ -18,10 +15,10 @@ public:
|
||||
void* GetBufferPointer() { return m_pBuffer; }
|
||||
int GetBufferSize() { return m_bufferSize; }
|
||||
void Release() {
|
||||
free(m_pBuffer);
|
||||
m_pBuffer = NULL;
|
||||
std::free(m_pBuffer);
|
||||
m_pBuffer = nullptr;
|
||||
}
|
||||
bool Allocated() { return m_pBuffer != NULL; }
|
||||
bool Allocated() { return m_pBuffer != nullptr; }
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
@@ -84,7 +81,7 @@ public:
|
||||
typedef enum {
|
||||
VERTEX_TYPE_PF3_TF2_CB4_NB4_XW1, // Position 3 x float, texture 2 x
|
||||
// float, colour 4 x byte, normal 4 x
|
||||
// byte, padding 1 DWORD
|
||||
// byte, padding 1 32-bit word
|
||||
VERTEX_TYPE_COMPRESSED, // Compressed format - see comment at top of
|
||||
// VS_PS3_TS2_CS1.hlsl for description of
|
||||
// layout
|
||||
@@ -169,15 +166,15 @@ public:
|
||||
void TextureSetParam(int param, int value);
|
||||
void TextureDynamicUpdateStart();
|
||||
void TextureDynamicUpdateEnd();
|
||||
HRESULT LoadTextureData(const char* szFilename, D3DXIMAGE_INFO* pSrcInfo,
|
||||
int** ppDataOut);
|
||||
HRESULT LoadTextureData(std::uint8_t* pbData, std::uint32_t byteCount,
|
||||
D3DXIMAGE_INFO* pSrcInfo, int** ppDataOut);
|
||||
HRESULT SaveTextureData(const char* szFilename, D3DXIMAGE_INFO* pSrcInfo,
|
||||
int* ppDataOut);
|
||||
HRESULT SaveTextureDataToMemory(void* pOutput, int outputCapacity,
|
||||
int* outputLength, int width, int height,
|
||||
int* ppDataIn);
|
||||
int LoadTextureData(const char* szFilename, D3DXIMAGE_INFO* pSrcInfo,
|
||||
int** ppDataOut);
|
||||
int LoadTextureData(std::uint8_t* pbData, std::uint32_t byteCount,
|
||||
D3DXIMAGE_INFO* pSrcInfo, int** ppDataOut);
|
||||
int SaveTextureData(const char* szFilename, D3DXIMAGE_INFO* pSrcInfo,
|
||||
int* ppDataOut);
|
||||
int SaveTextureDataToMemory(void* pOutput, int outputCapacity,
|
||||
int* outputLength, int width, int height,
|
||||
int* ppDataIn);
|
||||
void TextureGetStats();
|
||||
void* TextureGetTexture(int idx);
|
||||
|
||||
@@ -212,12 +209,13 @@ public:
|
||||
void StateSetEnableViewportClipPlanes(bool enable);
|
||||
void StateSetTexGenCol(int col, float x, float y, float z, float w,
|
||||
bool eyeSpace);
|
||||
void StateSetStencil(int Function, uint8_t stencil_ref,
|
||||
uint8_t stencil_func_mask, uint8_t stencil_write_mask);
|
||||
void StateSetStencil(int Function, std::uint8_t stencil_ref,
|
||||
std::uint8_t stencil_func_mask,
|
||||
std::uint8_t stencil_write_mask);
|
||||
void StateSetForceLOD(int LOD);
|
||||
|
||||
// Event tracking
|
||||
void BeginEvent(LPCWSTR eventName);
|
||||
void BeginEvent(const wchar_t* eventName);
|
||||
void EndEvent();
|
||||
|
||||
// PLM event handling
|
||||
|
||||
+2
-4
@@ -1,8 +1,6 @@
|
||||
#ifndef _4J_RENDER_STADAFX_H
|
||||
#define _4J_RENDER_STADAFX_H
|
||||
|
||||
#ifdef __linux__
|
||||
#include "../Minecraft.Client/Platform/Linux/Stubs/LinuxStubs.h"
|
||||
#endif
|
||||
#include "../4J.Common/4J_Compat.h"
|
||||
|
||||
#endif //_4J_RENDER_STADAFX_H
|
||||
#endif //_4J_RENDER_STADAFX_H
|
||||
|
||||
Reference in New Issue
Block a user