BUG: T2DShape3D (and T3DTSRenderComponent)
by Scott Goodwin · in Torque X 2D · 03/18/2008 (2:29 pm) · 6 replies
In an earlier thread, I reported a problem with T2DShape3D on the xbox www.garagegames.com/mg/forums/result.thread.php?qt=73186
Here's a fix for the problem in T2DShape3D.SetShape. Note: the code is similar to code in T3DTSRenderComponent so a fix might be needed there too but I haven't tried it.
Here's a fix for the problem in T2DShape3D.SetShape. Note: the code is similar to code in T3DTSRenderComponent so a fix might be needed there too but I haven't tried it.
#region BUG(SDG)
// causes a System.UnauthorizedAccessException on the xbox
#if !SDG_APPLY_BUGFIXES
// create the shape
FileStream fs = null;
try
{
fs = new FileStream(_shapeFile, FileMode.Open);
}
catch
{
return false;
}
ShapeReader reader = new ShapeReader();
Shape shape = reader.ReadShape(fs);
fs.Close();
FileInfo fi = new FileInfo(_shapeFile);
shape.FilePath = fi.DirectoryName;
// remove executable directory so that path is relative to it
shape.FilePath = shape.FilePath.Replace(TorqueEngineComponent.Instance.ExecutableDirectory + @"\", string.Empty);
Shape = shape;
#endif
#endregion
#region BUGFIX(SDG)
// Replaced with code similar to code in T3DTSRenderComponent.cs
// Added FileAccess.Read to solve the
// System.UnauthorizedAccessException on the xbox
// TODO: Is a similar change needed in T3DTSRenderComponent.cs?
#if SDG_APPLY_BUGFIXES
// create the shape
if (File.Exists(_shapeFile))
{
FileStream fs = new FileStream(_shapeFile, FileMode.Open, FileAccess.Read);
ShapeReader reader = new ShapeReader();
Shape shape = reader.ReadShape(fs);
fs.Close();
FileInfo fi = new FileInfo(_shapeFile);
shape.FilePath = fi.DirectoryName;
// remove executable directory so that path is relative to it
shape.FilePath = shape.FilePath.Replace(TorqueEngineComponent.Instance.ExecutableDirectory + @"\", string.Empty);
Shape = shape;
}
else
{
Assert.Fatal(false, string.Format("Specified shape file not found: {0}", _shapeFile));
}
#endif
#endregionAbout the author
#2
07/10/2009 (8:10 am)
Unfortunately, the bug fix was not included in version 3. I don't know any way around it without the source code.
#3
Otherwise as a student I'm pretty SOL.
07/10/2009 (8:16 am)
Is it against the rules/eula if someone else were to edit the source code, compile and distribute it?Otherwise as a student I'm pretty SOL.
#4
07/10/2009 (12:58 pm)
We have it licenced for our students in our labs :-)
#5
07/10/2009 (1:42 pm)
Unfortunately Computer Science at my university is more concerned with Theory than any sort of graphics, let alone game programming.
#6
Try to find an enthusiastic prof with a research grant. Maybe you can get him/her to buy a licence in exchange for some project work or something. Ten hours work is easily worth the cost of a licence. Maybe update a prof's webpage or something in exchange for a licence.
07/10/2009 (2:14 pm)
Yeah, I hear you. I teach theory and AI here. I had to fight with the "chalkboard heads" to get an $80K teaching lab with high end PCs and XBoxes and start a game development specialization. Next week we are running a game development camp for grade 7 and 8 girls to plant the seed early and hopefully boost our enrolments in the future.Try to find an enthusiastic prof with a research grant. Maybe you can get him/her to buy a licence in exchange for some project work or something. Ten hours work is easily worth the cost of a licence. Maybe update a prof's webpage or something in exchange for a licence.
Torque Owner David A Young