Post

Replies

Boosts

Views

Activity

Reply to View and Projection Matrix in Metal for a First Person Camera
correct me if I'm wrong You're not wrong. I checked everything else: the projection and view matrix code looks correct. You're also correct that all this shouldn't be done in the shader. Most of these (excluding the model matrix) only have to be computed once per render loop. If it helps here's my projection and view matrix routines (they match yours): static __inline__ simd_float4x4 matrix4x4_perspective_projection(float inAspect, float inFovRAD, float inNear, float inFar) { float y = 1 / tan(inFovRAD * 0.5); float x = y / inAspect; float z = inFar / (inFar - inNear); simd_float4 X = { x, 0, 0, 0}; simd_float4 Y = { 0, y, 0, 0}; simd_float4 Z = { 0, 0, z, 1}; simd_float4 W = { 0, 0, z * -inNear, 0}; return (matrix_float4x4) {{X, Y, Z, W}}; } static __inline__ simd_float4x4 matrix4x4_lookAt(const simd_float3 inEye, const simd_float3 inTo, const simd_float3 inUp) { //forward vector simd_float3 zAxis = simd_normalize(inTo - inEye); //horizontal vector simd_float3 xAxis = simd_normalize(simd_cross(inUp, zAxis)); //vertical vector simd_float3 yAxis = simd_cross(zAxis, xAxis); //translation vector simd_float3 t = (simd_float3) {-simd_dot(xAxis, inEye), -simd_dot(yAxis, inEye), -simd_dot(zAxis, inEye)}; return (matrix_float4x4) {{ { xAxis.x, yAxis.x, zAxis.x, 0 }, { xAxis.y, yAxis.y, zAxis.y, 0 }, { xAxis.z, yAxis.z, zAxis.z, 0 }, { t.x, t.y, t.z, 1 } }}; } // lookAt
Aug ’23
Reply to java/javac on Big Sur
Type this command in terminal: "/usr/libexec/java_home" You should get something like: "/Library/Java/JavaVirtualMachines/jdk-14.jdk/Contents/Home" Now edit </Applications/NetBeans/Apache NetBeans xx.x/Contents/Resources/NetBeans/netbeans/etc/netbeans.conf> and search for netbeansjdkhome. Change it's path to match the above result. It should now look something like this: netbeansjdkhome="/Library/Java/JavaVirtualMachines/jdk-14.jdk/Contents/Home" Now relaunch netbeans and try again. Hope this helps! ;-)
Nov ’20