/* canchor - august 2001 - by Macfly */ /* c3d3 client anchor interface */ /* Definition de l'ancre */ typedef Anchor= objAnchor [H3d HMat3d S I] | posAnchor [S [I I I] [I I I]] ;; fun anchbyn(x,n)= let x->[a _] in !strcmp a n ;; fun ANCHOR_GetObjMat (anchor) = match anchor with (objAnchor [oname mname _ _] -> [oname mname]) |(_ -> [nil nil]) ;; fun ANCHOR_GetObjNameMatName (anchor, session) = let ANCHOR_GetObjMat anchor -> [o m] in [(M3objName session o) (M3materialName session m)] ;; fun ANCHOR_TextGetObjNameMatName (anchortext) = if (nth_char anchortext 0)=='# then let tl hd strextr anchortext -> [obj [mat _]] in [obj mat] else [nil nil] ;; fun ANCHOR_TextGetObjMat (anchortext, session) = let ANCHOR_TextGetObjNameMatName anchortext -> [oname mname] in [(M3getObj session oname) (M3getMat session mname)] ;; fun ANCHOR_CompareWithObjMat (anchor, obj, mat) = let ANCHOR_GetObjMat anchor -> [o1 m1] in ((o1 == nil) || (o1 == obj)) && ((m1 == nil) || (m1 == mat)) ;; fun ANCHOR_GetFirstObjAnchor (anchorlist) = if anchorlist == nil then nil else match hd anchorlist with (objAnchor _ -> hd anchorlist) |(_ -> ANCHOR_GetFirstObjAnchor tl anchorlist) ;; fun ANCHOR_CheckAllMaterialFilled (session, anchorlist) = if anchorlist == nil then 1 else match hd anchorlist with (objAnchor [_ mat _ _] -> if M3isTextureFilled session M3textureFromMaterial session mat then ANCHOR_CheckAllMaterialFilled session tl anchorlist else 0 ) |(_ -> ANCHOR_CheckAllMaterialFilled session tl anchorlist) ;;