Skip to content

Commit

Permalink
add terrain cpp version check
Browse files Browse the repository at this point in the history
move version assert inside
  • Loading branch information
mazeyu authored and pvl-bot committed Jul 29, 2024
1 parent 4041640 commit ef328ae
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
16 changes: 16 additions & 0 deletions infinigen/terrain/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import logging
import os
from ctypes import c_int32
from pathlib import Path

import bpy
Expand Down Expand Up @@ -46,6 +47,7 @@
Mesh,
Vars,
get_caminfo,
load_cdll,
move_modifier,
write_attributes,
)
Expand Down Expand Up @@ -123,6 +125,20 @@ def __init__(
populated_bounds=(-75, 75, -75, 75, -25, 55),
bounds=(-500, 500, -500, 500, -500, 500),
):
dll = load_cdll(
str(
Path(__file__).parent.resolve()
/ "lib"
/ "cpu"
/ "elements"
/ "waterbody.so"
)
)
func = dll.get_version
func.argtypes = []
func.restype = c_int32
terrain_element_version = func()
assert terrain_element_version == 1
self.seed = seed
self.device = device
self.surface_registry = surface_registry
Expand Down
5 changes: 4 additions & 1 deletion infinigen/terrain/source/cpu/elements/core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,8 @@ extern "C" {
void cleanup() {
}


int get_version() {
return 1;
}

}

0 comments on commit ef328ae

Please sign in to comment.