Skip to content

feat(core): implement arParamChangeSize and arglCameraFrustumRH#121

Merged
kalwalt merged 6 commits into
devfrom
copilot/implement-arparamchangesize-ar3dcreatehandle-arglc
May 11, 2026
Merged

feat(core): implement arParamChangeSize and arglCameraFrustumRH#121
kalwalt merged 6 commits into
devfrom
copilot/implement-arparamchangesize-ar3dcreatehandle-arglc

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 10, 2026

Summary

Closes / implements #19.

This PR ports three groups of ARToolKit C functions into Rust as part of the WebARKitLib-rs API build-out:


1. arParamChangeSizear_param_change_size (crates/core/src/ar/param.rs)

  • In-place mutation of an ARParam struct to a new output resolution.
  • Scales all focal-length and principal-point fields (fx, fy, cx, cy) by the ratio of the new size to the original.
  • C equivalent: arParamChangeSize in param.c.
  • Returns Err(ArParamError) on zero-width/height inputs.
  • Full unit-test coverage included.

2. New module param_gl (crates/core/src/ar/param_gl.rs)

Ports four OpenGL matrix-generation helpers from ARToolKit's paramGL.c:

Rust function C equivalent Description
argl_camera_frustum_rh arglCameraFrustumRH f64 right-handed OpenGL frustum/projection matrix from ARParam
argl_camera_view_rh arglCameraViewRH f64 right-handed OpenGL model-view matrix from a 3×4 pose matrix
argl_camera_frustum_rh_f arglCameraFrustumRHf f32 variant of the frustum function
argl_camera_view_rh_f arglCameraViewRHf f32 variant of the model-view function

All functions return 16-element column-major arrays ready for use with glUniformMatrix4fv.
Full unit tests and doc-examples are included for each function.


3. Module wiring (mod.rs, lib.rs)

  • param_gl added to crates/core/src/ar/mod.rs (table entry + pub mod declaration).
  • param_gl re-exported from crates/core/src/lib.rs.

4. Bug fix — Clippy doc_overindented_list_items

  • Fixed over-indented doc-comment continuation line in param_gl.rs:249 (12-space indent → 2-space indent) to resolve CI failure.

Files changed

File Change
crates/core/src/ar/param.rs ar_param_change_size implementation + tests
crates/core/src/ar/param_gl.rs New file — four paramGL.c functions, docs, tests
crates/core/src/ar/mod.rs Register param_gl module
crates/core/src/lib.rs Re-export param_gl

Copilot AI changed the title [WIP] Implement arParamChangeSize, ar3DCreateHandle, and arglCameraFrustumRH feat(core): implement arParamChangeSize and arglCameraFrustumRH May 10, 2026
Copilot AI requested a review from kalwalt May 10, 2026 16:10
Add argl_camera_view_rh (f64), argl_camera_frustum_rh_f (f32) and
argl_camera_view_rh_f (f32) — direct Rust ports of arglCameraViewRH,
arglCameraFrustumRHf and arglCameraViewRHf from ARToolKit's paramGL.c.

All three follow the arlog_e! + return Err error pattern. Covered by
19 new unit tests (28 total in the module, all green). cargo fmt and
cargo clippy --no-default-features are both clean.

Agent-Logs-Url: https://github.com/webarkit/WebARKitLib-rs/sessions/7016360c-5440-408b-b1cb-bf68903ef50d

Co-authored-by: kalwalt <1275858+kalwalt@users.noreply.github.com>
@kalwalt kalwalt merged commit 1004bf8 into dev May 11, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement arParamChangeSize, ar3DCreateHandle, and arglCameraFrustumRH (+ audit related functions with code references)

2 participants