Scott Brabson (sbrabson++at++chesapeake.net)
Thu, 15 Jan 1998 13:10:28 -0500
Good Luck,
Scott Brabson
Thom DeCarlo wrote:
>
> Inge E.Henriksen wrote:
> >
> > >
> > > From: "Linda Rae" <lrae++at++indy3.gstone.com>
> > > Date: Wed, 14 Jan 1998 13:31:36 -0800
> > > Subject: Breaking up large texture Files
> > > Reply-To: <lrae++at++indy3.gstone.com>
> > >
> > >Good afternoon all:
> > >
> > >This query is just to insure that I don't re-invent the wheel.
> > >I have a large terrain database with 1024x1024 texture files
> > >(the textures are imagery of 5 and 10 Meter data - thus lots
> > >of textures and none are repeated). I want to be able to break
> > >down these large texture files into some thing more manageable
> > >say 256x256 or 512x512 and reapply the textures to the original
> > >OpenFlt file as necessary and re-writting the database file to
> > >disk. I have begun to incorporate MIP Mapping as part of the
> > >solution, but I still need to perform the above mentioned task.
> > >
> > >I am about to write a tool to do this, but I have heard vague
> > >stories that there are tools out in the Performer world that
> > >already do this (yes I know I can do this using the Multigen
> > >development environment). I have looked at the rsets tool I
> > >found in Performer 2.2 - That does half the work for me but
> > >not applying the new files to the database file. Does anyone
> > >know of a Performer script/tool that does this?
> > >
> > >Thanks in advance,
> > >
> > >Linda Rae
> >
> > A easy way that you could do this is by using "imgworks". If you
> > are using Openflight(TM) format all you would have to do is to
> > overwrite the original image-files and the scaled images should
> > be imported the next time you start your Performer(TM) application.
> > Be sure to take a backup first, just in case.
> >
> > If you would like to incorporate the scaling inside your program
> > you might consider "imgcopy", altough I am not sure I suspect
> > this program of also beeing able to scale an image. You can execute
> > a shell program from C-code with the "system()" command.
> >
> > Good luck from Inge
> > :>
> >
> >
> I have been trying to do the same thing. The problem is that we
> don't want to down-sample the imagery. The high resolution data is
> important. I can use standard image processing packages (Erdas, MUSE,
> or even icut) to extract the subimages. The first hard part is trying
> to generate the .attr file for each of the new images. I've not
> found anything showing the format of that file. (Marcus? Anybody?)
> Then we need to reapply the textures. This can be done fairly easily
> with Multigen II Pro's batch geoput utility. (I think.)
>
> Thom
> =======================================================================
> > List Archives, FAQ, FTP: http://www.sgi.com/Technology/Performer/
> > Submissions: info-performer++at++sgi.com
> > Admin. requests: info-performer-request++at++sgi.com
>
> --
> ^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~
> Thom DeCarlo * Off site contact info
> TASC * JPSD/IEC, US Army TEC
> 12100 Sunset Hills Rd. * 7701 Telegraph Rd., Bldg. 2592
> Reston, VA 20190 * Alexandria, VA 22315
> phone: 703/834-5000 * phone: 703/428-9001, -7060, or -7034
> fax: 703/318-7900 * fax: 703/428-7054
> mailto:trdecarlo++at++tasc.com * mailto:tdecarlo++at++rayva.org
> ^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~
> billshit : n, any missive, assertion, statement, comment,
> etc., made or related by any representative of Microsoft.
> v, the act of making such a comment. "The MSlawyers
> sounded sincere but they were just billshitting Judge
> Pennsfield-Jackson and the DOJ."
> ^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~
> =======================================================================
> List Archives, FAQ, FTP: http://www.sgi.com/Technology/Performer/
> Submissions: info-performer++at++sgi.com
> Admin. requests: info-performer-request++at++sgi.com
#include <stdlib.h>
#include <iostream.h>
#include <fstream.h>
#include <string.h>
#include "/usr/local/MultiGen/inc/mgapiall.h"
#include "attr.h"
// **********************************************************************
// DEFINES AND FILE SCOPE VARIABLES
// **********************************************************************
// **********************************************************************
// CODE
// **********************************************************************
Attr::Attr() {}
Attr::~Attr() {}
short Attr::read_pci_attr(char* filename)
{
Parser pci_parser;
Token token;
int done;
// Open the pci attributes file
if (!pci_parser.open(filename)){
cout << "Unable to load GEOREP file:" << filename << endl;
exit(0);
}
done=0;
// Parse the file into Geo_Rep data structure
while ((pci_parser.get_token(token)) && (done==0)){
if(!strcmp (token.value, "Units")){
//Projection
pci_parser.get_token(token); // The colon
pci_parser.get_token(token); // Projection type
if(!strcmp(token.value,"UTM"))
geo_data.projection=4;
else
geo_data.projection=8;
// ADD OTHER PROJECTION CODES HERE
//UTM zone
pci_parser.get_token(token); // Utm zone
geo_data.UTMzone=atoi(token.value);
pci_parser.get_token(token); // Utm row (not used by MultiGen)
//Earth Ellipsoid
pci_parser.get_token(token);
if(!strcmp(token.value,"E012")) // Earth Ellipsoid
geo_data.earth_model=0;
// ADD OTHER EARTH MODELS HERE
}
//Fast forward through file to Upper Right Corner
else if(!strcmp(token.value,"Upper")){
pci_parser.get_token(token);
if(!strcmp(token.value,"Right")){
pci_parser.get_token(token); // The word "Corner"
pci_parser.get_token(token); // The colon
pci_parser.get_token(token);
geo_data.URu=atoi(token.value); // Upper right u value
pci_parser.get_token(token); // The letter "E"
pci_parser.get_token(token);
geo_data.URv=atoi(token.value); // Upper right v value
}
}
//Fast forward through file to Lower Left Corner
else if(!strcmp(token.value,"Lower")){
pci_parser.get_token(token);
if(!strcmp(token.value,"Left")){
pci_parser.get_token(token); // The word "Corner"
pci_parser.get_token(token); // The colon
pci_parser.get_token(token);
geo_data.LLu=atoi(token.value); // Lower left u value
pci_parser.get_token(token); // The letter "E"
pci_parser.get_token(token);
geo_data.LLv=atoi(token.value); // Lower left v value
done=1; // Last value needed so exit
}
}
}
pci_parser.close();
// Hardcoded values for version 1.0
geo_data.hemisphere=1; // northern hemisphere
geo_data.units=1; // meters
geo_data.texture_width=4096; // number of texels in u direction
geo_data.texture_height=4096; // number of texels in v direction
return(1);
}
short Attr::write_mg_attr(char* filename)
{
int rval;
mgrec *geo_rec;
char* errortxt;
char* errorsite;
if(!(geo_rec=mgReadImageAttributes("template"))){
printf("Could not read image attributes template file\n");
exit(1);
}
rval= mgSetAttList(geo_rec,
fltImgWidth, geo_data.texture_width,
fltImgHeight, geo_data.texture_height,
fltImgLowerLeftU,geo_data.LLu,
fltImgLowerLeftV, geo_data.LLv,
fltImgUpperRightU, geo_data.URu,
fltImgUpperRightV, geo_data.URv,
fltImgProjection, geo_data.projection,
fltImgEarthModel, geo_data.earth_model,
fltImgUTMzone, geo_data.UTMzone,
fltImgUnits, geo_data.units,
fltImgHemisphere, geo_data.hemisphere,
mgNULL);
if(!mgWriteImageAttributes(filename, geo_rec)){
printf("Could not write image attributes file: %s\n",filename);
mgGetError(&errorsite, &errortxt);
printf("\nError: %s\n",errortxt);
exit(1);
}
return(1);
}
=======================================================================
List Archives, FAQ, FTP: http://www.sgi.com/Technology/Performer/
Submissions: info-performer++at++sgi.com
Admin. requests: info-performer-request++at++sgi.com
This archive was generated by hypermail 2.0b2 on Mon Aug 10 1998 - 17:56:34 PDT