Author Topic: Cpct?  (Read 9262 times)

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12170
    • View Profile
    • http://www.jpct.net
Re: Cpct?
« Reply #60 on: December 29, 2020, 04:25:12 pm »
No, Hashtable and HashMap don't care about this. And why would they? I consider it to be rather...not stupid...but, well let's go with stupid anyway...behaviour to throw an exception in this case. You would have to modify the code to check for the key and remove/add it or replace it, if that's supported.

Offline AGP

  • quad
  • ******
  • Posts: 1696
    • View Profile
Re: Cpct?
« Reply #61 on: December 30, 2020, 07:56:40 am »
I added the test. And then I think I fixed another issue. Now I'm only getting the appropriate background color, and convertTexture(Texture) is printing [ 12/30/2020 3:57:37 AM ] - ERROR: Failed to upload texture! texID, unhelpfully (helplessly?) is always 0.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12170
    • View Profile
    • http://www.jpct.net
Re: Cpct?
« Reply #62 on: December 30, 2020, 11:35:05 am »
That's before the actual upload happens. All it does, is to make the GL driver generate an ID. If that fails, it's most likely that something with your handling of the native buffers is wrong...or whatever C# uses in this place.

Offline AGP

  • quad
  • ******
  • Posts: 1696
    • View Profile
Re: Cpct?
« Reply #63 on: December 30, 2020, 10:56:45 pm »
About that, I made a GenericBuffer<T> class to mimic Java's xBuffer classes. But there's a chunk in convertTexture() where you do IntBuffer (GenericBuffer<int> in mine) buf = getSmallBuffer(); GL11.GenTextures(buf) and then you claim that the texture refence is now in buf. But buf is a local variable that's never called again.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12170
    • View Profile
    • http://www.jpct.net
Re: Cpct?
« Reply #64 on: December 31, 2020, 12:43:25 pm »
The GenTexture call puts it there.

Offline AGP

  • quad
  • ******
  • Posts: 1696
    • View Profile
Re: Cpct?
« Reply #65 on: January 18, 2021, 10:30:58 pm »
Happy 95% of what remains of this year, pal.

What's with WorldProcessor.createWSNormals()? It seems to me to be both a waste of processing time and a waste of memory.

Offline AGP

  • quad
  • ******
  • Posts: 1696
    • View Profile
Re: Cpct?
« Reply #66 on: January 22, 2021, 02:40:30 am »
And what is supposed to be in visList.vobj[0]? It's become null as I tinkered with the World class.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12170
    • View Profile
    • http://www.jpct.net
Re: Cpct?
« Reply #67 on: January 22, 2021, 08:34:50 am »
WorldProcessor.createWSNormals() is needed for the software renderer when using environment mapping in world space. In every other case, it's not even called. All it does is to create 3 float[]-arrays (per WorldProcessor thread) to store the world space normals in, if needed and only once. So as long as you don't use this feature, it won't be called and if you do, then you have to live with the additional memory overhead.

vobj[0] is like any other index of vobj[]. When using the software render, it stores the reference to either the object itself (in that case, it's the same as vorg) or, if the polygon that belongs at this index is being clipped, a reference to the object that contains the clipped polygons.
« Last Edit: January 22, 2021, 08:42:10 am by EgonOlsen »

Offline AGP

  • quad
  • ******
  • Posts: 1696
    • View Profile
Re: Cpct?
« Reply #68 on: January 22, 2021, 05:30:59 pm »
Can you think of a reason why it might be null? It doesn't happen with the 1.03 World instance, but does with the 1.31.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12170
    • View Profile
    • http://www.jpct.net
Re: Cpct?
« Reply #69 on: January 23, 2021, 09:45:40 pm »
vobj and vorg are either populated with the same instance (the actual object itself) or vorg is the object and vobj is the clipped polygon object. If vorg isn't null, but vobj is, then the clipped polygon object is null for some reason.

Offline AGP

  • quad
  • ******
  • Posts: 1696
    • View Profile
Re: Cpct?
« Reply #70 on: January 23, 2021, 11:03:33 pm »
I'm not getting any lights, I think, since I ported World to 1.31. Everything I render with the software renderer is fully, flatly, black.

And by the way, software rendering on 1.31 is SO MUCH slower than on 1.03 (possibly the transparency additions but I would think it's because of the overall bloating of the code).
« Last Edit: January 25, 2021, 01:57:06 am by AGP »

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12170
    • View Profile
    • http://www.jpct.net
Re: Cpct?
« Reply #71 on: January 25, 2021, 07:30:04 am »
On my side, the software rendering code hasn't changed in ages. If something has been added, it has been added in a new method and leaves the old methods untouched, so having transparency added does nothing to the existing methods. It might be the runtime that for some reason decides not to just-in-time compile some methods or something like that.
« Last Edit: January 25, 2021, 08:24:40 am by EgonOlsen »

Offline AGP

  • quad
  • ******
  • Posts: 1696
    • View Profile
Re: Cpct?
« Reply #72 on: January 27, 2021, 05:33:30 am »
I'm not even where I was when I started porting this thing: now even when I don't call setTexture I get a solid black, unshaded model. Same models that were working before. I had SoftGLRenderer print System.Console.WriteLine("Pixel color: "+r +", "+g +", "+b +" Pixel: "+pixels[tx]) and I get for uint[] pixels the interesting value of 4,278,190,335 (binary 11111111000000000000000011111111) in drawShadedZbufferedFilteredScanline(). If you have any insights, please share them because I need them.

Offline AGP

  • quad
  • ******
  • Posts: 1696
    • View Profile
Re: Cpct?
« Reply #73 on: January 28, 2021, 02:06:29 am »
Update: I had the epiphany of blitting the texture and calling setShadingMode(Object3D.SHADING_FAKED_FLAT). The texture blit looks perfect and SHADING_FAKED_FLAT made the model shade by the ambient light color (and still not by an added light), but fully and properly textured. I guess the problem would be in the gouraud shading block. Again, any direction would be greatly appreciated.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12170
    • View Profile
    • http://www.jpct.net
Re: Cpct?
« Reply #74 on: January 29, 2021, 09:09:49 am »
The thing is that faked flat actually means exactly that: It's fake. It's still using gouraud shading (there are no other rendering modes in jPCT's software renderer) but with the same color used on every vertex. If that fixes something, I can only imagine that somehow, your light intensity calculation on the vertices is off.