Skip to content

Commit

Permalink
Merge pull request #225 from princeton-vl/mesher_version_check
Browse files Browse the repository at this point in the history
Mesher version check
  • Loading branch information
araistrick authored Aug 1, 2024
2 parents 8c4e30d + ef328ae commit 0712df6
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 2 deletions.
2 changes: 1 addition & 1 deletion infinigen/OcMesher
Submodule OcMesher updated 1 files
+3 −1 ocmesher/__init__.py
19 changes: 19 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 All @@ -31,6 +32,7 @@
Transparency,
)
from infinigen.OcMesher.ocmesher import OcMesher as UntexturedOcMesher
from infinigen.OcMesher.ocmesher import __version__ as ocmesher_version
from infinigen.terrain.assets.ocean import ocean_asset
from infinigen.terrain.mesher import (
OpaqueSphericalMesher,
Expand All @@ -45,10 +47,13 @@
Mesh,
Vars,
get_caminfo,
load_cdll,
move_modifier,
write_attributes,
)

assert ocmesher_version == "1.0"

logger = logging.getLogger(__name__)

fine_suffix = "_fine"
Expand Down Expand Up @@ -120,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 0712df6

Please sign in to comment.