Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //My thoughts on how to rasterize. Psuedocode.
- foreach(polyID)
- {
- for(int iy = 0; iy < width; iy ++)
- {
- boolean isOn = false;
- int currentLineFlag;
- for(int ix = 0; ix < height; ix++)
- {
- Pixel p = Screen[ix,iy];
- if(p.isOn())
- {
- boolean partOfCurrentPolygon = ??;
- if(partOfCurrentPolygon)
- {
- //then this pixel is part of the current polygon.
- if(isOn)
- {
- boolean onlyPartOfCurrentLine = ??;
- if(partOfCurrentLine)
- {
- ??
- }
- else if(!partOfCurrentLine)
- {
- ??
- }
- }
- else if(!isOn)
- {
- ??
- }
- }
- else if(!partOfCurrentPolygon)
- {
- ??
- }
- }
- else if(!p.isOn())
- {
- if(isOn)
- {
- ??
- }
- else if(!isOn)
- {
- ??
- }
- }
- }
- }
- }
- foreach(polyID)
- {
- for(int iy = 0; iy < width; iy ++)
- {
- boolean isOn = false;
- int currentLineFlag;
- for(int ix = 0; ix < height; ix++)
- {
- Pixel p = Screen[ix,iy];
- if(p.isOn())
- {
- boolean partOfCurrentPolygon = (1<<polyID & p.getLineID() != 0);
- if(partOfCurrentPolygon)
- {
- //then this pixel is part of the current polygon.
- if(isOn)
- {
- boolean onlyPartOfCurrentLine = (currentLineFlag | p.getLineID() == currentLineFlag);
- if(partOfCurrentLine)
- {
- //ignore
- }
- else if(!partOfCurrentLine)
- {
- //end the rasterization!
- isOn = false;
- }
- }
- else if(!isOn)
- {
- //we've encountered the first on pixel, so init everything
- isOn = true;
- currentLineFlag = p.getLineID();
- }
- }
- else if(!partOfCurrentPolygon)
- {
- //ignore
- }
- }
- else if(!p.isOn())
- {
- if(isOn)
- {
- //rasterize this pixel
- p.turnOn();
- }
- else if(!isOn)
- {
- //ignore
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement