Compare commits

...
Author SHA1 Message Date
Christopher Sean Morrison 1d532e97d9 the literals need to be explicit char* for c++11 2025-01-18 23:59:38 -05:00
Christopher Sean Morrison 6efe34d6d8 convert all the sources to cpp 2025-01-18 23:49:25 -05:00
Christopher Sean Morrison ab9af2e9ac converting to c/c++, no sense to hamstring ourselves 2025-01-18 23:47:09 -05:00
Christopher Sean Morrison d5884a7212 set C locale 2025-01-17 23:33:57 -05:00
Christopher Sean Morrison dc94911511 remove a few more trailing lgt references 2025-01-05 00:43:47 -05:00
Christopher Sean Morrison c1a96ff725 removed the lgt.sh script 2025-01-05 00:43:47 -05:00
Christopher Sean Morrison 32a7e7dc0b remove and diminish references to lgt 2025-01-05 00:43:47 -05:00
Christopher Sean Morrison aff23b1db0 remove lgt helper script.
lgt was obsoleted in 7.30.2 so should be safe to remove.  procs are undocumented, but consist of process_mdb, apply_lgt_mat, and make_lgt_light.  all three appear to deal with lgt-specific files.
2025-01-05 00:43:47 -05:00
Christopher Sean Morrison 9e772ad3d8 remove. lgt was removed in 7.30. curiously not in regress. 2025-01-04 23:40:16 -05:00
16 changed files with 17 additions and 470 deletions
+1 -2
View File
@@ -3,7 +3,7 @@ add_subdirectory(ref)
add_definitions(-DCONSOLE)
brlcad_addexec(pixcmp pixcmp.c libbu)
set(BARK_SOURCES benchmark.c compute.c run.c clean.c)
set(BARK_SOURCES benchmark.cpp compute.cpp run.cpp clean.cpp)
brlcad_addexec(bark "${BARK_SOURCES}" libbu NO_STRICT NO_INSTALL TEST_USESDATA)
if(BUILD_TESTING)
@@ -41,7 +41,6 @@ file(
cmakefiles(
CMakeLists.txt
lgt.sh
run.sh
try.sh
viewdiff.sh
+5 -1
View File
@@ -57,6 +57,7 @@
#ifdef HAVE_SYS_UTSNAME_H
# include <sys/utsname.h>
#endif
#include <locale.h>
#include "bio.h"
@@ -67,7 +68,7 @@
int bu_exec(const char *program, void *data, struct bu_vls *out, struct bu_vls *err) {if (!program || !out || !err || !data) return 1; return 0;}
int bu_grep(const char *pattern, const char *input, int(*callback)(const char *line, void *data), void *data) {if (!pattern || !input || !data) return 1; if (!callback) bu_log("TODO: need default callback!!!\n"); return 0;}
int bu_file_glob(const char *pattern, char **paths) {if (!pattern || !paths) return 1; return 0;}
char *format_elapsed(double elapsed) {if (elapsed > 0) return "0 1 2"; return "-0 -1 -2";}
const char *format_elapsed(double elapsed) {static const char* pos = "0 1 2"; static const char* neg = "-0 -1 -2"; if (elapsed > 0) return pos; return neg;}
int perf(const struct bu_vls *vp, const char *items, const char *args[]) {if (!vp || !items || !args) return -1; return 0;}
double calculate_vgr(const struct bu_vls *summary) {if (!summary) return -0.0; return 0.0;}
extern int bench(const char *cmd);
@@ -286,6 +287,9 @@ main(int ac, char *av[])
bu_setprogname(av[0]);
// Force locale setting to C
setlocale(LC_ALL, "C");
/* process the argument list for commands */
for (arg=1; arg<ac; arg++) {
if (BU_STR_EQUAL(av[arg], "clean")) {
View File
-198
View File
@@ -1,198 +0,0 @@
#!/bin/sh
# L G T . S H
# BRL-CAD
#
# Copyright (c) 2004-2024 United States Government as represented by
# the U.S. Army Research Laboratory.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following
# disclaimer in the documentation and/or other materials provided
# with the distribution.
#
# 3. The name of the author may not be used to endorse or promote
# products derived from this software without specific prior written
# permission.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
###
# A Shell script to test LGT
# @(#)$Header$ (BRL)
# Ensure /bin/sh
export PATH || (echo "This isn't sh."; sh $0 $*; kill $$)
path_to_lgt_sh=`dirname $0`
expected="$path_to_lgt_sh/../src/lgt/lgt"
if ! test -f "$expected" ; then
echo "Can't find LGT"
exit 1
fi
# force locale setting to C so things like date output as expected
LC_ALL=C
LGT="$expected"
DB="$path_to_lgt_sh/../db"
CMP="$path_to_lgt_sh/pixcmp"
if test ! -f $CMP ; then
cake pixcmp
fi
# Alliant NFS hack
if test x${MACHINE} = xfx ; then
cp ${LGT} /tmp/lgt
cp ${CMP} /tmp/pixcmp
LGT=/tmp/lgt
CMP=/tmp/pixcmp
fi
# This test of LGT assumes a "live" framebuffer here.
if test x$FB_FILE = x ; then
echo "Environment variable FB_FILE must be set to a real framebuffer"
echo "for this test of LGT to operate correctly."
exit 1
fi
# Run the first set of tests
${LGT} ${DB}/lgt-test.g all.g << EOF
# read light source data base
v ../db/lgt-test.ldb
# read material data base
w ../db/lgt-test.mdb
# force display window to be 512x512 pixels, should cause 8-to-1 zoom
T 512
# clear frame buffer
E
# set maximum bounces to 20
K 20
# turn hidden-line drawing off
k 0
# configure grid: 64 rays across
G 64 0 0 0.0
# turn perspective off
p 0
# change background to mauve
b 111 66 66
# read key frame
j ../db/lgt-test.key
# display view #3
R
# save image in file
H lgt3a.pix
# change frame buffer to disk file
o lgt3b.pix
# save a script of previous commands, to produce the "b" version.
S script3
# disable reading of key frame file
j
# change frame buffer back to default
o
# configure grid: 2.45 mm cells, centered about model origin, view size 225 mm
G 2.45 1 1 225.0
# change background to firebrick
b 142 35 35
# force frame buffer size to be 455 pixels across, should cause 4-to-1 zoom
T 455
# set automatic perspective at 0.25
p 0.25
# set anti-aliasing over-sampling factor to 2
A 2
# set maximum bounces to 20
K 20
# display view #1
R
# save image in file
H lgt1a.pix
# change frame buffer to disk file
o lgt1b.pix
# save a script
S script1
# change frame buffer back to default
o
# turn off anti-aliasing
A 1
# revert to auto-sizing of frame buffer
T 0
# set automatic perspective at 0.25
p 0.25
# select hidden-line drawing, reverse video
k 2
# configure grid: 128 rays across, centered at model RPP, view size 225mm
G 128 0 0 225.0
# display view #2
R
# save image in file
H lgt2a.pix
# change frame buffer to disk file
o lgt2b.pix
# save a script
S script2
# change frame buffer back to default
o
# bye
q
EOF
if test $? = 0 ; then
:
else
echo "Abnormal lgt exit"
exit 1
fi
# Run the second set of tests. The scripts were created above.
./script1 < /dev/null &&
./script2 < /dev/null &&
./script3 < /dev/null || { echo "Script test failed."; exit 1; }
FAIL=0
for i in 1 2 3 ; do
if ${CMP} "$path_to_lgt_sh/../pix/lgt${i}.pix" lgt${i}a.pix ; then
:
else
echo "Test $i A failed."
FAIL=1
fi
if ${CMP} "$path_to_lgt_sh/../pix/lgt${i}.pix" lgt${i}b.pix
then
:
else
echo "Test $i B failed."
FAIL=1
fi
done
if test "$FAIL" -eq 0 ; then
echo "LGT Tested OK."
exit 0
fi
echo "*** LGT does NOT work on this platform ***"
exit 2
# Local Variables:
# mode: sh
# tab-width: 8
# sh-indentation: 4
# sh-basic-offset: 4
# indent-tabs-mode: t
# End:
# ex: shiftwidth=4 tabstop=8
View File
-5
View File
@@ -3170,11 +3170,6 @@
<link xlink:href="../../man1/en/ir-X.php">Ir-X</link>
</para>
</listitem>
<listitem>
<para>
<link xlink:href="../../man1/en/lgt.php">Lgt</link>
</para>
</listitem>
<listitem>
<para>
<link xlink:href="../../man1/en/loop.php">Loop</link>
-1
View File
@@ -465,7 +465,6 @@ host_lookup_by_hostent(localhost) got localhost?
<citerefentry><refentrytitle>scriptsort</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
<citerefentry><refentrytitle>brlcad</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
<citerefentry><refentrytitle>mged</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
<citerefentry><refentrytitle>lgt</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
<citerefentry><refentrytitle>pix-fb</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
<citerefentry><refentrytitle>rtray</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
<citerefentry><refentrytitle>rtpp</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
-1
View File
@@ -708,7 +708,6 @@
<refsection xml:id="see_also"><title>SEE ALSO</title>
<para><citerefentry><refentrytitle>brlcad</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
<citerefentry><refentrytitle>mged</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
<citerefentry><refentrytitle>lgt</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
<citerefentry><refentrytitle>pix-fb</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
<citerefentry><refentrytitle>png-fb</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
<citerefentry><refentrytitle>rtray</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
+10 -9
View File
@@ -609,20 +609,21 @@
<refsection xml:id="additional_options"><title>ADDITIONAL OPTIONS</title>
<para>
<command>rtedge</command> replaces <citerefentry><refentrytitle>lgt</refentrytitle><manvolnum>1</manvolnum></citerefentry>.
In addition to the simple white edges on a black background (or black on white)
provided by <command>lgt</command>, <command>rtedge</command>
allows arbitrary color combinations. It also allows rendering into an
existing framebuffer and occlusion detection between two pieces of geometry.
To configure its behavior, <command>rtedge</command> makes copious use of
the <option>-c</option> option.
In addition to rendering simple white edges on a black
background (or black on white), <command>rtedge</command> allows
arbitrary color combinations. It also allows rendering into an
existing framebuffer and occlusion detection between two pieces
of geometry. To configure behavior, <command>rtedge</command>
makes copious use of the <option>-c</option> option for
configuring settings. <command>rtedge</command> replaced the
now obsolete <command>lgt</command> utility.
</para>
<para>
Note that this approach is necessitated by the fact that
<citerefentry><refentrytitle>librt</refentrytitle><manvolnum>3</manvolnum></citerefentry>
has used up nearly the entire
alphabet. A transition to GNU-style long option names is planned.
has used up nearly the entire alphabet. A transition to
GNU-style long option names is planned.
</para>
<variablelist remap="TP">
<varlistentry>
-1
View File
@@ -282,7 +282,6 @@ SOFTWARE ORGANIZATION</H1>
<tr><TH>PROGRAMS</th><th>Description</th></tr>
<tr></tr>
<tr><td>rt</td><td>A ray-tracing lighting model, for rendering</td></tr>
<tr><td>lgt</td><td>Another lighting model, for rendering</td></tr>
<tr><td>mged</td><td>A solid-model editor</td></tr>
<tr><td>conv</td><td>ASCII/binary database converters</td></tr>
<tr><td>fbserv</td><td>Remote network frame-buffer server</td></tr>
-1
View File
@@ -91,7 +91,6 @@ fix_polysolids
g_diff
g_lint
g_qa
lgt
mged (GUI)
nirt
nmg-bot
@@ -2671,23 +2671,6 @@ Usage: /usr/local/src2/brlcad-build/bin/kurt
----- end usage -----------------------------------
***** end lens ***********************************
***** begin lgt ***********************************
result : (usage)
file(s):
error : 3:exit status: exit code 1
----- begin usage -----------------------------------
This program is deprecated and will not be supported in future releases
Please use \"rtedge\" instead
Please notify \"devs@brlcad.org\" if you need enhancements to \"rtedge\"
Press \"Enter\" to continue
(snip...)
----- end usage -----------------------------------
***** end lgt ***********************************
***** begin loop ***********************************
result : (usage)
file(s):
+1 -3
View File
@@ -620,9 +620,7 @@ view_2init(struct application *UNUSED(ap), char *UNUSED(framename))
pixsize = 3;
/*
* Set the hit distance difference necessary to trigger an edge.
* This algorithm was stolen from lgt, I may make it settable
* later.
* Set default hit distance difference necessary to trigger an edge.
*/
if (max_dist < .00001)
max_dist = (cell_width*ARCTAN_87)+2;
-1
View File
@@ -42,7 +42,6 @@ set(
icreate.tcl
illum.tcl
lc.tcl
lgt_mat.tcl
list.tcl
lodconfig.tcl
make_solid.tcl
-230
View File
@@ -1,230 +0,0 @@
# L G T _ M A T . T C L
# BRL-CAD
#
# Copyright (c) 2004-2024 United States Government as represented by
# the U.S. Army Research Laboratory.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# version 2.1 as published by the Free Software Foundation.
#
# This library is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this file; see the file named COPYING for more
# information.
#
###
proc process_mdb { mdb_file array_name } {
upvar $array_name mdb_array
# open material database file
if { [string length $mdb_file] == 0 } {
puts "ERROR: missing name of material database"
exit
}
if { [catch {open $mdb_file} fdb] } {
puts "ERROR opening database file ($mdb_file)"
puts $fdb
exit
}
#read material database
set mdb [split [read $fdb] "\n"]
# process MDB into an array
set max_index 0
set index 0
set len [llength $mdb]
while { $index < $len } {
set m_name [string trim [lindex $mdb $index]]
incr index
if { $index >= $len } break
set m_index [string trim [lindex $mdb $index]]
incr index
set m_shine [string trim [lindex $mdb $index]]
incr index
set m_spec_wgt [string trim [lindex $mdb $index]]
incr index
set m_diff_wgt [string trim [lindex $mdb $index]]
incr index
set m_trans [string trim [lindex $mdb $index]]
incr index
set m_refl [string trim [lindex $mdb $index]]
incr index
set m_ri [string trim [lindex $mdb $index]]
incr index
set m_rgb [string trim [lindex $mdb $index]]
incr index
set m_mode [string trim [lindex $mdb $index]]
incr index
if { $m_name == "(null)" } continue
set mdb_array($m_index) [list $m_name "sh" $m_shine "sp" $m_spec_wgt "di" $m_diff_wgt "tr" $m_trans "re" $m_refl "ri" $m_ri $m_rgb $m_mode]
}
}
proc apply_lgt_mat { args } {
# set defaults
set mode 0
set mdb_file ""
# mode: Tcl
# 0 - initially apply lgt material database to model
# 1 - reapply lgt material database (using info stored in attributes)
# 2 - undo (revert to old shader parameters using saved attributes)
# process options
set argc [llength $args]
for { set index 0 } { $index < $argc } { incr index } {
set argv [lindex $args $index ]
switch -exact -- $argv {
"-r" {
set mode 1
}
"-u" {
set mode 2
}
default {
if { [string index $argv 0] == "-" } {
puts "Illegal option $argv"
puts "\tChoices are:"
puts "\t\t no options - apply lgt material database"
puts "\t\t -r - reapply lgt material database"
puts "\t\t -u - undo (remove lgt database info)"
exit
} else {
set mdb_file $argv
}
}
}
}
if { $mode < 2 } {
process_mdb $mdb_file "mdb_array"
}
foreach comb [ls -c] {
if { $mode == 0 } {
# initial application, check shader params for "mid"
set shader [db get $comb shader]
} elseif { $mode == 1 } {
# reapply, find "mid" in attribute "lgt_mdb_params"
if { [catch {attr get $comb "lgt_mdb_params"} shader] } continue
} elseif { $mode == 2 } {
# undo, restore the saved parameters from attributes
if { [catch {attr get $comb "lgt_mdb_params"} shader] } continue
if { [catch {attr get $comb "old_inherit"} inherit] } continue
if { [catch {attr get $comb "old_rgb"} rgb] } {set rgb "none"}
puts " restoring saved values to $comb"
db adjust $comb shader $shader inherit $inherit rgb $rgb
continue
}
if { [llength $shader] < 2 } continue
set shader_name [lindex $shader 0]
set shader_params [lindex $shader 1]
set index [lsearch -exact $shader_params "mid"]
if { $index == -1 } continue
incr index
set mid [lindex $shader_params $index]
if { [info exists mdb_array($mid)] } {
set mdb_entry $mdb_array($mid)
puts " Adjusting $comb"
if { $mode == 0 } {
# initial application, save the current settings in attributes
if { ![catch {attr get $comb lgt_mdb_params} old_attr ] } {
if { [string compare $old_attr $shader] != 0 } {
puts "WARNING: $comb already has LGT parameters saved"
puts "\tand they are different from the current settings"
puts "\tthe old saved settings will be overwritten"
puts "\t old settings: $old_attr"
}
}
set old_rgb [db get $comb "rgb"]
if { [string compare $old_rgb "invalid"] == 0 } {
attr set $comb "lgt_mdb_params" $shader \
"old_inherit" [db get $comb "inherit"]
} else {
attr set $comb "lgt_mdb_params" $shader "old_rgb"\
$old_rgb "old_inherit" [db get $comb "inherit"]
}
}
# apply the lgt material properties
db adjust $comb shader [list "plastic" [lrange $mdb_entry 1 12]]
db adjust $comb inherit yes rgb [lindex $mdb_entry 13]
}
}
}
proc make_lgt_light { args } {
set num_args [llength $args]
if { $num_args != 1 && $num_args != 4 } {
puts "ERROR: invalid number or arguments"
puts "Usage: make_lgt_light light_region [x y z]"
return
}
set light [lindex $args 0]
if { $num_args == 4 } {
set x [lindex $args 1]
set y [lindex $args 2]
set z [lindex $args 3]
} else {
set x 2500
set y 4330
set z 8660
}
if { [catch {db get $light tree} light_tree] } {
# light object does not exist, create a new one
set light_solid [make_name s.light@]
db put $light_solid sph V "$x $y $z" A { 0.1 0 0 } \
B { 0 0.1 0 } C { 0 0 0.1 }
db put $light comb region yes id 1 shader light tree "l $light_solid"
} else {
# move existing light to the LGT default position
set mged_state [status state]
if { $mged_state != "VIEWING" } {
puts "This command cannot be run in $mged_state state, must be viewing"
return
}
set operator [lindex $light_tree 0]
while { $operator != "l" } {
set light_tree [lindex $light_tree 1]
set operator [lindex $light_tree 0]
}
set member_name [lindex $light_tree 1]
draw $light
oed $light $member_name
translate $x $y $z
press accept
}
}
# Local Variables:
# mode: Tcl
# tab-width: 8
# c-basic-offset: 4
# tcl-indent-level: 4
# indent-tabs-mode: t
# End:
# ex: shiftwidth=4 tabstop=8