Skip to content
View in the app

A better way to browse. Learn more.

ResHax

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.
Help us keep the site running.

Chinese Game "Fengbao"

Featured Replies

  • Author
  • Localization

Exmex, posted Fri Oct 09, 2020 12:34 pm (59149)


Hello,

I'm trying to import the models from this game named "fengbao" into 3dsmax. I have written an MAXScript to import it but I'm failing at the indices / faces and vertices part.

Script:
Code:
fn readStr binstr strLen = --reads a fixed-size string
(
   str = ""
   for w=1 to strLen do(str = (bit.intasChar(readByte binstr #unsigned)))
   return str
)

fn clamp minVal maxVal val =
(
   if val < minVal then val = minVal
   else if val > maxVal then val = maxVal
   return val
)

binfile = fopen "C:\\aoshan_bingshan.mesh" "rb"

version = readLong binfile
print version

subMeshNum = readLong binfile

fseek binfile 72 #seek_cur

subMeshNum = 1
for i = 0 to subMeshNum - 1 do(
   smNameLen = readLong binfile #unsigned
   smName = readStr binfile smNameLen
   print(smName)
   
   mtrlLen = readLong binfile #unsigned
   mtrlPath = readStr binfile mtrlLen
   print(mtrlPath)
   
   m_isUseNormal = (readByte binfile == 1)
   m_isUseVertexColor = (readByte binfile == 1)   
   m_isUseLightmapUV = (readByte binfile == 1)
   m_isUseTangentBinormal = (readByte binfile == 1)
   lightmapResolution = readLong binfile
   lightmapResolution = clamp 8 12 lightmapResolution
   
   fseek binfile 72 #seek_cur
   
   vertCount = readLong binfile #unsigned
   vertices = #()
   for x = 0 to vertCount by 3 do (
      f1 = readByte binfile
      f3 = readByte binfile
      f2 = readByte binfile
      append vertices ([f1,f2,f3])
   )
   --readLong binfile #unsigned
   
   faceCount = readLong binfile #unsigned
   idxBuffSize = faceCount
   indices = #()
   for x = 0 to idxBuffSize by 3 do (
      f1 = readByte binfile
      f3 = readByte binfile
      f2 = readByte binfile
       append indices ([f1, f2, f3])
   )
   
   -- AABB
   vMinX = readFloat binfile
   vMinY = readFloat binfile
   vMinZ = readFloat binfile
   
   vMaxX = readFloat binfile
   vMaxY = readFloat binfile
   vMaxZ = readFloat binfile
   
    submesh = mesh vertices:vertices faces:indices
)


I have no clue if the reading part of the indices and vertices is correct. If anything else is needed I'll supply everything thats needed. I have just barebone knowledge how vertices and indices work in this game they use vertex strides.

I've figured out that the vertex stride size is 48. Reading 4 floats for vertices does give some better output like so:

Code:
   for j = 0 to vertCount by 4 do (
      x = readFloat binfile
      y = readFloat binfile
      z = readFloat binfile
      unknown = readFloat binfile
      
      append vertices ([x,y,z])
   )


But messes up the indices...
  • Author
  • Localization

pgw00k, posted Mon Nov 16, 2020 1:14 am (60293)


Maybe you should post the game's Chinese name or some sample file to there?
Guest
This topic is now closed to further replies.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.