Attempting to port Irrlicht 1.8.5 to PS3 using psl1ght.
Project files set up, CPS3Driver, CIrrDevicePS3, CPS3Texture stubs compiled.
Added ps3 driver initialization to PS3 device, added psl1ght variables and basic clear/begin/end scene so the first tutorial example main loop runs and sets the background color. Md2 mesh loading also seems to be working without needing to change anything; Irrlicht seems to already handle big-endianness. Just needed to change the model file path explicitly to /dev_hdd0:
// tutorial 1 main.cpp
AnimatedMesh* mesh = smgr->getMesh("/dev_hdd0/Irrlicht01/sydney.md2");
// CMD2MeshFileLoader.cpp
file->read(&header, sizeof(SMD2Header));
#ifdef __BIG_ENDIAN__
header.magic = os::Byteswap::byteswap(header.magic);
...
Untextured md2 model from first tutorial working. The pairing configuration of irrlicht and ps3 matrices was:
// CPS3Driver::setTransform()
MvpMatrix = Matrices[ETS_PROJECTION] * Matrices[ETS_VIEW] * Matrices[ETS_WORLD];
// CPS3Driver::drawHardwareBuffer()
core::matrix4 trans = MvpMatrix.getTransposed();
rsxSetVertexProgramParameter(
mContext,
shader->mVpo,
S3DShader::mvpMatUniform,
trans.pointer()
);
// s3d_shader.vert
gl_Position = vec4(aPos,1.0) * uMvpMatrix;
Also needed to force hardware buffers into being used. Not sure how (if at all) to handle drawing vertices directly yet. Textures TODO next.
Got the model texture working. Only supports A8R8G8B8 format for now. Also TODO I think is to add more class members for the PS3 texture class for different uniform locations. Tested on my PS3 hardware to confirm it works on that:
Static text drawing working; missing the border rectangle currently. Had to implement the "draw2DImageBatch" function in the PS3 driver, for which I made another simple shader which doesn't do any position transformation:
#version 130
in vec3 aPos;
in vec2 aTexCoord;
out vec2 texCoord;
void main()
{
gl_Position = vec4(aPos,1.0);
texCoord = aTexCoord;
}
#version 130
out vec4 FragColor;
in vec2 texCoord;
uniform sampler2D uTexture;
uniform vec3 uColor;
void main()
{
FragColor.a = texture2D(uTexture, texCoord).a;
FragColor.rgb = uColor.rgb;
}
Got the static text border working; implemented "draw2DRectangle". Similar to draw2DImageBatch, made a new simple shader and allocated a vertex buffer to store just positions in.