* upate genesis-3d engine to version 1.3.1.

match the genesis editor version 1.3.1.921.
master
zhongdaohuan 2014-06-19 16:21:15 +08:00
parent 1b34d8d839
commit ad5cd7b16a
234 changed files with 5746 additions and 1278 deletions

View File

@ -1,8 +1,8 @@
[webjet]
assetname="asdasd"
scenename="asset:test_shader.scene"
gamedir="/test_shader"
scenename="asset:editorBox3.scene"
gamedir="/editorBox3"
packagename="com.genesis"
remotepath=""
usePrecompilerShader="true"
usePrecompilerShader="false"

View File

@ -30,11 +30,13 @@ import org.genesis.lib.GenesisHelperListener;
import com.genesis.R;
import android.app.Activity;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.PaintDrawable;
import android.os.Bundle;
import android.os.Message;
import android.view.ViewGroup;
import android.view.ViewTreeObserver;
import android.widget.FrameLayout;
public abstract class GenesisActivity extends Activity implements GenesisHelperListener {
@ -44,6 +46,7 @@ public abstract class GenesisActivity extends Activity implements GenesisHelperL
private static final String TAG = GenesisActivity.class.getSimpleName();
// ===========================================================
private GenesisGLSurfaceView mGLSurefaceView;
private int s_topPos;
public GenesisGLSurfaceView GetSurfaceView()
{
@ -120,16 +123,90 @@ public abstract class GenesisActivity extends Activity implements GenesisHelperL
ViewGroup.LayoutParams.FILL_PARENT);
FrameLayout framelayout = new FrameLayout(this);
framelayout.setLayoutParams(framelayout_params);
// Cocos2dxGLSurfaceView
this.mGLSurefaceView = new GenesisGLSurfaceView(this);
// ...add to FrameLayout
framelayout.addView(mGLSurefaceView);
//edittext view
// Cocos2dxEditText layout
FrameLayout.LayoutParams edittext_layout_params =
new FrameLayout.LayoutParams(FrameLayout.LayoutParams.FILL_PARENT,
FrameLayout.LayoutParams.WRAP_CONTENT);
final GenesisEditText edittext = new GenesisEditText(this);
edittext.setLayoutParams(edittext_layout_params);
framelayout.addView(edittext);
mGLSurefaceView.setBackgroundResource(R.drawable.load);
mGLSurefaceView.setGenesisRenderer(new GenesisRenderer(this));
this.mGLSurefaceView.setGenesisEditText(edittext);
//!-- keyboardheight
final FrameLayout fframelayout = framelayout;
fframelayout.getViewTreeObserver().addOnGlobalLayoutListener( new ViewTreeObserver.OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
// TODO Auto-generated method stub
Rect r = new Rect();
edittext.getWindowVisibleDisplayFrame(r);
int screenHeight = edittext.getRootView().getHeight();
int screenWidth = edittext.getRootView().getWidth();
int heightDifference = screenHeight - (r.bottom - r.top);
boolean visible = heightDifference > screenHeight / 3;
//set edittext postion
int editBottom = edittext.getBottom();
int editHeight = edittext.getHeight();
//((EditText) edittext).setBottom(heightDifference);
boolean keyboardVisible = false;
int topPos = screenHeight;
if(r.bottom < screenHeight)
{
keyboardVisible = true;
topPos = r.bottom - editHeight ;
}
if(s_topPos == topPos)
{
return;
}
s_topPos = topPos;
FrameLayout.LayoutParams params = (FrameLayout.LayoutParams) edittext.getLayoutParams();
params.leftMargin = 0;
params.topMargin = topPos;
params.width = screenWidth;
params.height = editHeight;
// params.rightMargin = screenWidth;
// params.bottomMargin = heightDifference;
edittext.setLayoutParams(params);
if(keyboardVisible)
{
FrameLayout flayout = (FrameLayout) edittext.getParent();
flayout.removeView(edittext);
flayout.addView(edittext);
edittext.setFocusable(true);
edittext.setFocusableInTouchMode(true);
edittext.requestFocus();
}
//edittext.getParent().bringChildToFront(edittext);
}
});
// Set framelayout as the content view
setContentView(framelayout);
}

View File

@ -0,0 +1,90 @@
/****************************************************************************
Copyright (c) 2006, Radon Labs GmbH
Copyright (c) 2011-2013,WebJet Business Division,CYOU
http://www.genesis-3d.com.cn
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
package org.genesis.lib;
import android.content.Context;
import android.util.AttributeSet;
import android.view.KeyEvent;
import android.widget.EditText;
public class GenesisEditText extends EditText {
// ===========================================================
// Constants
// ===========================================================
// ===========================================================
// Fields
// ===========================================================
private GenesisGLSurfaceView mGenesisGLSurfaceView;
// ===========================================================
// Constructors
// ===========================================================
public GenesisEditText(final Context context) {
super(context);
}
public GenesisEditText(final Context context, final AttributeSet attrs) {
super(context, attrs);
}
public GenesisEditText(final Context context, final AttributeSet attrs, final int defStyle) {
super(context, attrs, defStyle);
}
// ===========================================================
// Getter & Setter
// ===========================================================
public void setGenesisGLSurfaceView(final GenesisGLSurfaceView pGenesisGLSurfaceView) {
this.mGenesisGLSurfaceView = pGenesisGLSurfaceView;
}
// ===========================================================
// Methods for/from SuperClass/Interfaces
// ===========================================================
@Override
public boolean onKeyDown(final int pKeyCode, final KeyEvent pKeyEvent) {
super.onKeyDown(pKeyCode, pKeyEvent);
/* Let GlSurfaceView get focus if back key is input. */
if (pKeyCode == KeyEvent.KEYCODE_BACK) {
this.mGenesisGLSurfaceView.requestFocus();
}
return true;
}
// ===========================================================
// Methods
// ===========================================================
// ===========================================================
// Inner and Anonymous Classes
// ===========================================================
}

View File

@ -58,6 +58,7 @@ public class GenesisGLSurfaceView extends GLSurfaceView {
private static Handler sHandler;
private GenesisActivity mActivity;
private static GenesisGLSurfaceView mGenesisGLSurfaceView;
private static GenesisTextInputWraper sGenesisTextInputWraper;
private String gamedir;
private String scenename;
@ -69,10 +70,23 @@ public class GenesisGLSurfaceView extends GLSurfaceView {
private boolean usePrecompilerShader;
private GenesisRenderer mGenesisRenderer;
private GenesisEditText mGenesisEditText;
private ContextFactory mContextFactory;
private AssetManager mMgr;
//get set methods=====================================================================================
public GenesisEditText getGenesisEditText() {
return this.mGenesisEditText;
}
public void setGenesisEditText(final GenesisEditText pGenesisEditText) {
this.mGenesisEditText = pGenesisEditText;
if (null != this.mGenesisEditText && null != GenesisGLSurfaceView.sGenesisTextInputWraper) {
this.mGenesisEditText.setOnEditorActionListener(GenesisGLSurfaceView.sGenesisTextInputWraper);
this.mGenesisEditText.setGenesisGLSurfaceView(this);
this.requestFocus();
}
}
private void GetStorageType(final Context context)
{
String sgamedir = gamedir;
@ -135,6 +149,7 @@ public class GenesisGLSurfaceView extends GLSurfaceView {
return availableSize/(1024*1024);
}
private void copyAllResFiles(final Context context,String Data,String Dest)
{
Log.d( "copy", "copy start");
@ -430,17 +445,40 @@ public class GenesisGLSurfaceView extends GLSurfaceView {
this.setFocusableInTouchMode(true);
GenesisGLSurfaceView.mGenesisGLSurfaceView = this;
GenesisGLSurfaceView.sGenesisTextInputWraper = new GenesisTextInputWraper(this);
GenesisGLSurfaceView.sHandler = new Handler() {
@Override
public void handleMessage(final Message msg) {
switch (msg.what) {
case HANDLER_OPEN_IME_KEYBOARD:
{
if (null != GenesisGLSurfaceView.this.mGenesisEditText && GenesisGLSurfaceView.this.mGenesisEditText.requestFocus()) {
GenesisGLSurfaceView.this.mGenesisEditText.removeTextChangedListener(GenesisGLSurfaceView.sGenesisTextInputWraper);
GenesisGLSurfaceView.this.mGenesisEditText.setText("");
final String text = (String) msg.obj;
GenesisGLSurfaceView.this.mGenesisEditText.append(text);
GenesisGLSurfaceView.sGenesisTextInputWraper.setOriginText(text);
GenesisGLSurfaceView.this.mGenesisEditText.addTextChangedListener(GenesisGLSurfaceView.sGenesisTextInputWraper);
final InputMethodManager imm = (InputMethodManager) GenesisGLSurfaceView.mGenesisGLSurfaceView.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
imm.showSoftInput(GenesisGLSurfaceView.this.mGenesisEditText, 0);
Log.d("GLSurfaceView", "showSoftInput");
}
}
break;
case HANDLER_CLOSE_IME_KEYBOARD:
{
if (null != GenesisGLSurfaceView.this.mGenesisEditText) {
GenesisGLSurfaceView.this.mGenesisEditText.removeTextChangedListener(GenesisGLSurfaceView.sGenesisTextInputWraper);
final InputMethodManager imm = (InputMethodManager) GenesisGLSurfaceView.mGenesisGLSurfaceView.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(GenesisGLSurfaceView.this.mGenesisEditText.getWindowToken(), 0);
GenesisGLSurfaceView.this.requestFocus();
Log.d("GLSurfaceView", "HideSoftInput");
}
}
break;
}
}
@ -545,7 +583,7 @@ public class GenesisGLSurfaceView extends GLSurfaceView {
}
/*
* This function is called before Cocos2dxRenderer.nativeInit(), so the
* This function is called before GenesisRenderer.nativeInit(), so the
* width and height is correct.
*/
@Override
@ -794,5 +832,34 @@ public class GenesisGLSurfaceView extends GLSurfaceView {
private int[] mValue = new int[1];
}
// called by c++==========================================================================
public static void openIMEKeyboard() {
final Message msg = new Message();
msg.what = GenesisGLSurfaceView.HANDLER_OPEN_IME_KEYBOARD;
msg.obj = GenesisGLSurfaceView.mGenesisGLSurfaceView.mGenesisRenderer.getContentText();
GenesisGLSurfaceView.sHandler.sendMessage(msg);
}
public static void closeIMEKeyboard() {
final Message msg = new Message();
msg.what = GenesisGLSurfaceView.HANDLER_CLOSE_IME_KEYBOARD;
GenesisGLSurfaceView.sHandler.sendMessage(msg);
}
//text input methods===================================================================================
public void insertText(final String pText) {
this.queueEvent(new Runnable() {
@Override
public void run() {
GenesisGLSurfaceView.this.mGenesisRenderer.handleInsertText(pText);
}
});
}
public void deleteBackward() {
this.queueEvent(new Runnable() {
@Override
public void run() {
GenesisGLSurfaceView.this.mGenesisRenderer.handleDeleteBackward();
}
});
}
}

View File

@ -0,0 +1,193 @@
/****************************************************************************
Copyright (c) 2006, Radon Labs GmbH
Copyright (c) 2011-2013,WebJet Business Division,CYOU
http://www.genesis-3d.com.cn
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
package org.genesis.lib;
import android.content.Context;
import android.text.Editable;
import android.text.TextWatcher;
import android.util.Log;
import android.view.KeyEvent;
import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputMethodManager;
import android.widget.TextView;
import android.widget.TextView.OnEditorActionListener;
public class GenesisTextInputWraper implements TextWatcher, OnEditorActionListener {
// ===========================================================
// Constants
// ===========================================================
private static final String TAG = GenesisTextInputWraper.class.getSimpleName();
// ===========================================================
// Fields
// ===========================================================
private final GenesisGLSurfaceView mGenesisGLSurfaceView;
private String mText;
private String mOriginText;
private int mCurrentInputPos;
private int mCountChar;
// ===========================================================
// Constructors
// ===========================================================
public GenesisTextInputWraper(final GenesisGLSurfaceView pGenesisGLSurfaceView) {
this.mGenesisGLSurfaceView = pGenesisGLSurfaceView;
}
// ===========================================================
// Getter & Setter
// ===========================================================
private boolean isFullScreenEdit() {
final TextView textField = this.mGenesisGLSurfaceView.getGenesisEditText();
final InputMethodManager imm = (InputMethodManager) textField.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
return imm.isFullscreenMode();
}
public void setOriginText(final String pOriginText) {
this.mOriginText = pOriginText;
}
// ===========================================================
// Methods for/from SuperClass/Interfaces
// ===========================================================
@Override
public void afterTextChanged(final Editable s) {
if (this.isFullScreenEdit()) {
return;
}
if(this.mCountChar > 0) {
int start = this.mCurrentInputPos;
int end = start + this.mCountChar;
final String insertText = s.subSequence(start,end).toString();
if(insertText.equals("\n"))
{
String trueStr = s.subSequence(0,start).toString() +
s.subSequence(end,s.length()).toString();
this.mGenesisGLSurfaceView.insertText( trueStr );
}
}
return;
// int nModified = s.length() - this.mText.length();
// if (nModified < 0)
// {
// for (; nModified < 0; ++nModified) {
// this.mGenesisGLSurfaceView.deleteBackward();
// /*
// if (BuildConfig.DEBUG) {
// Log.d(TAG, "deleteBackward");
// }
// */
// }
// }
// else if(this.mCountChar > 0) {
// int start = this.mCurrentInputPos;
// int end = start + this.mCountChar;
// final String insertText = s.subSequence(start,end).toString();
// this.mGenesisGLSurfaceView.insertText(insertText);
//
// //move cursor
// /*
// if (BuildConfig.DEBUG) {
// Log.d(TAG, "insertText(" + insertText + ")");
// }
// */
// }
// this.mText = s.toString();
}
@Override
public void beforeTextChanged(final CharSequence pCharSequence, final int start, final int count, final int after) {
/*
if (BuildConfig.DEBUG) {
Log.d(TAG, "beforeTextChanged(" + pCharSequence + ")start: " + start + ",count: " + count + ",after: " + after);
}
*/
this.mText = pCharSequence.toString();
this.mCurrentInputPos = start;
}
@Override
public void onTextChanged(final CharSequence pCharSequence, final int start, final int before, final int count) {
this.mCountChar = count;
}
@Override
public boolean onEditorAction(final TextView pTextView, final int pActionID, final KeyEvent pKeyEvent) {
if (this.mGenesisGLSurfaceView.getGenesisEditText() == pTextView && this.isFullScreenEdit()) {
// user press the action button, delete all old text and insert new text
for (int i = this.mOriginText.length(); i > 0; i--) {
this.mGenesisGLSurfaceView.deleteBackward();
/*
if (BuildConfig.DEBUG) {
Log.d(TAG, "deleteBackward");
}
*/
}
String text = pTextView.getText().toString();
/* If user input nothing, translate "\n" to engine. */
if (text.compareTo("") == 0) {
text = "\n";
}
if ('\n' != text.charAt(text.length() - 1)) {
text += '\n';
}
final String insertText = text;
this.mGenesisGLSurfaceView.insertText(insertText);
/*
if (BuildConfig.DEBUG) {
Log.d(TAG, "insertText(" + insertText + ")");
}
*/
}
if (pActionID == EditorInfo.IME_ACTION_DONE) {
this.mGenesisGLSurfaceView.requestFocus();
}
return false;
}
// ===========================================================
// Methods
// ===========================================================
// ===========================================================
// Inner and Anonymous Classes
// ===========================================================
}

View File

@ -24,7 +24,7 @@
@rem 根据本机cmake的安装路径修改cmakeExe变量
set cmakeExe="D:\Program Files\cmake-2.8.8-win32-x86\bin\cmake.exe"
set cmakeExe="D:\Program Files\CMake 2.8\bin\cmake.exe"
set curPath=%cd%

View File

@ -7,6 +7,8 @@
objects = {
/* Begin PBXBuildFile section */
587F8B4218FB8FB4007563A8 /* OCAndCPlusInterface.mm in Sources */ = {isa = PBXBuildFile; fileRef = 587F8B3F18FB8FB4007563A8 /* OCAndCPlusInterface.mm */; };
587F8B4318FB8FB4007563A8 /* TextViewController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 587F8B4118FB8FB4007563A8 /* TextViewController.mm */; };
F54D9A4418580A9D0007115E /* libGenesisEngineLib.a in Frameworks */ = {isa = PBXBuildFile; fileRef = F54D9A3318580A840007115E /* libGenesisEngineLib.a */; };
F560C2F018111C0700487A7D /* ViewController_iPad.xib in Resources */ = {isa = PBXBuildFile; fileRef = F560C2EC18111C0700487A7D /* ViewController_iPad.xib */; };
F560C2F118111C0700487A7D /* ViewController_iPhone.xib in Resources */ = {isa = PBXBuildFile; fileRef = F560C2EE18111C0700487A7D /* ViewController_iPhone.xib */; };
@ -180,6 +182,9 @@
/* End PBXContainerItemProxy section */
/* Begin PBXFileReference section */
587F8B3F18FB8FB4007563A8 /* OCAndCPlusInterface.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = OCAndCPlusInterface.mm; sourceTree = "<group>"; };
587F8B4018FB8FB4007563A8 /* TextViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TextViewController.h; sourceTree = "<group>"; };
587F8B4118FB8FB4007563A8 /* TextViewController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = TextViewController.mm; sourceTree = "<group>"; };
F54D9A2C18580A810007115E /* GenesisEngineLib.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = GenesisEngineLib.xcodeproj; path = ../GenesisEngineLib/GenesisEngineLib.xcodeproj; sourceTree = "<group>"; };
F560C2ED18111C0700487A7D /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/ViewController_iPad.xib; sourceTree = "<group>"; };
F560C2EF18111C0700487A7D /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/ViewController_iPhone.xib; sourceTree = "<group>"; };
@ -302,6 +307,9 @@
F5BC88A417F2959300F0D1DD /* IOSFramework */ = {
isa = PBXGroup;
children = (
587F8B3F18FB8FB4007563A8 /* OCAndCPlusInterface.mm */,
587F8B4018FB8FB4007563A8 /* TextViewController.h */,
587F8B4118FB8FB4007563A8 /* TextViewController.mm */,
F560C2EC18111C0700487A7D /* ViewController_iPad.xib */,
F560C2EE18111C0700487A7D /* ViewController_iPhone.xib */,
F5BC88A517F2959300F0D1DD /* AppDelegate.h */,
@ -716,6 +724,7 @@
buildActionMask = 2147483647;
files = (
F5EFE6C618BC444F00D585CC /* Mono.Security.dll in Sources */,
587F8B4318FB8FB4007563A8 /* TextViewController.mm in Sources */,
F5EFE6C718BC444F00D585CC /* mscorlib.dll in Sources */,
F5EFE6C818BC444F00D585CC /* ScriptFrameworkLibrary.dll in Sources */,
F5EFE6C918BC444F00D585CC /* ScriptGUILibrary.dll in Sources */,
@ -724,6 +733,7 @@
F5EFE6CC18BC444F00D585CC /* System.dll in Sources */,
F5EFE6CD18BC444F00D585CC /* System.Security.dll in Sources */,
F5EFE6CE18BC444F00D585CC /* System.Xml.dll in Sources */,
587F8B4218FB8FB4007563A8 /* OCAndCPlusInterface.mm in Sources */,
F5EFE6CF18BC444F00D585CC /* UserDefCSharp.dll in Sources */,
F5BC88B617F2959400F0D1DD /* AppDelegate.mm in Sources */,
F5BC88BE17F2959400F0D1DD /* main.mm in Sources */,

View File

@ -7,6 +7,13 @@
objects = {
/* Begin PBXBuildFile section */
58548DAE19061FC400BA92A0 /* script_app.cc in Sources */ = {isa = PBXBuildFile; fileRef = 58548DAC19061FC400BA92A0 /* script_app.cc */; };
82C7DF6B192222D2002CE939 /* FileData.cc in Sources */ = {isa = PBXBuildFile; fileRef = 82C7DF5D192222D2002CE939 /* FileData.cc */; };
82C7DF6C192222D2002CE939 /* FileTable.cc in Sources */ = {isa = PBXBuildFile; fileRef = 82C7DF60192222D2002CE939 /* FileTable.cc */; };
82C7DF6D192222D2002CE939 /* Package.cc in Sources */ = {isa = PBXBuildFile; fileRef = 82C7DF63192222D2002CE939 /* Package.cc */; };
82C7DF6E192222D2002CE939 /* PackageSystem.cc in Sources */ = {isa = PBXBuildFile; fileRef = 82C7DF65192222D2002CE939 /* PackageSystem.cc */; };
82C7DF6F192222D2002CE939 /* PackageTool.cc in Sources */ = {isa = PBXBuildFile; fileRef = 82C7DF67192222D2002CE939 /* PackageTool.cc */; };
82C7DF70192222D2002CE939 /* PackageUtil.cc in Sources */ = {isa = PBXBuildFile; fileRef = 82C7DF69192222D2002CE939 /* PackageUtil.cc */; };
F504B89B18BC39F800B7C723 /* SoundInterface.cc in Sources */ = {isa = PBXBuildFile; fileRef = F504B89918BC39F800B7C723 /* SoundInterface.cc */; };
F52905801830C2DC0081A084 /* CGTool.cc in Sources */ = {isa = PBXBuildFile; fileRef = F52905781830C2DC0081A084 /* CGTool.cc */; };
F52905811830C2DC0081A084 /* D3DCompiler.cc in Sources */ = {isa = PBXBuildFile; fileRef = F529057A1830C2DC0081A084 /* D3DCompiler.cc */; };
@ -838,12 +845,6 @@
F5F49CEE17E1C5EE00361F45 /* spriteplayer.cc in Sources */ = {isa = PBXBuildFile; fileRef = F5F49CDD17E1C5EE00361F45 /* spriteplayer.cc */; };
F5F49CEF17E1C5EE00361F45 /* spriteutils.cc in Sources */ = {isa = PBXBuildFile; fileRef = F5F49CDF17E1C5EE00361F45 /* spriteutils.cc */; };
F5F49CF017E1C5EE00361F45 /* spritevertex.cc in Sources */ = {isa = PBXBuildFile; fileRef = F5F49CE117E1C5EE00361F45 /* spritevertex.cc */; };
F5FD75DD1859ACB90029DB32 /* FileData.cc in Sources */ = {isa = PBXBuildFile; fileRef = F5FD75CF1859ACB90029DB32 /* FileData.cc */; };
F5FD75DE1859ACB90029DB32 /* FileTable.cc in Sources */ = {isa = PBXBuildFile; fileRef = F5FD75D21859ACB90029DB32 /* FileTable.cc */; };
F5FD75DF1859ACB90029DB32 /* Package.cc in Sources */ = {isa = PBXBuildFile; fileRef = F5FD75D41859ACB90029DB32 /* Package.cc */; };
F5FD75E01859ACB90029DB32 /* PackageSystem.cc in Sources */ = {isa = PBXBuildFile; fileRef = F5FD75D61859ACB90029DB32 /* PackageSystem.cc */; };
F5FD75E11859ACB90029DB32 /* PackageTool.cc in Sources */ = {isa = PBXBuildFile; fileRef = F5FD75D81859ACB90029DB32 /* PackageTool.cc */; };
F5FD75E21859ACB90029DB32 /* PackageUtil.cc in Sources */ = {isa = PBXBuildFile; fileRef = F5FD75DA1859ACB90029DB32 /* PackageUtil.cc */; };
/* End PBXBuildFile section */
/* Begin PBXCopyFilesBuildPhase section */
@ -859,6 +860,36 @@
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
58548DAC19061FC400BA92A0 /* script_app.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = script_app.cc; sourceTree = "<group>"; };
58548DAD19061FC400BA92A0 /* script_app.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = script_app.h; sourceTree = "<group>"; };
587A3D9A18F68D15000ED13A /* OCAndCPlusInterface.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OCAndCPlusInterface.h; sourceTree = "<group>"; };
82C7DF4C19221F92002CE939 /* cg.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cg.h; sourceTree = "<group>"; };
82C7DF4D19221F92002CE939 /* cgGL_profiles.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cgGL_profiles.h; sourceTree = "<group>"; };
82C7DF4E19221F92002CE939 /* cg_bindlocations.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cg_bindlocations.h; sourceTree = "<group>"; };
82C7DF4F19221F92002CE939 /* cg_datatypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cg_datatypes.h; sourceTree = "<group>"; };
82C7DF5019221F92002CE939 /* cg_enums.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cg_enums.h; sourceTree = "<group>"; };
82C7DF5119221F92002CE939 /* cg_errors.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cg_errors.h; sourceTree = "<group>"; };
82C7DF5219221F92002CE939 /* cg_profiles.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cg_profiles.h; sourceTree = "<group>"; };
82C7DF5419221F92002CE939 /* glsl_optimizer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = glsl_optimizer.h; sourceTree = "<group>"; };
82C7DF5619221F92002CE939 /* hlsl2glsl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = hlsl2glsl.h; sourceTree = "<group>"; };
82C7DF5819221F92002CE939 /* mojoshader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mojoshader.h; sourceTree = "<group>"; };
82C7DF5919221F92002CE939 /* mojoshader_parser_hlsl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mojoshader_parser_hlsl.h; sourceTree = "<group>"; };
82C7DF5A19221F92002CE939 /* mojoshader_version.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mojoshader_version.h; sourceTree = "<group>"; };
82C7DF5C192222D2002CE939 /* CMakeLists.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = CMakeLists.txt; sourceTree = "<group>"; };
82C7DF5D192222D2002CE939 /* FileData.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FileData.cc; sourceTree = "<group>"; };
82C7DF5E192222D2002CE939 /* FileData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileData.h; sourceTree = "<group>"; };
82C7DF5F192222D2002CE939 /* FileFormat.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileFormat.h; sourceTree = "<group>"; };
82C7DF60192222D2002CE939 /* FileTable.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FileTable.cc; sourceTree = "<group>"; };
82C7DF61192222D2002CE939 /* FileTable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileTable.h; sourceTree = "<group>"; };
82C7DF62192222D2002CE939 /* PackDef.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PackDef.h; sourceTree = "<group>"; };
82C7DF63192222D2002CE939 /* Package.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Package.cc; sourceTree = "<group>"; };
82C7DF64192222D2002CE939 /* Package.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Package.h; sourceTree = "<group>"; };
82C7DF65192222D2002CE939 /* PackageSystem.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PackageSystem.cc; sourceTree = "<group>"; };
82C7DF66192222D2002CE939 /* PackageSystem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PackageSystem.h; sourceTree = "<group>"; };
82C7DF67192222D2002CE939 /* PackageTool.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PackageTool.cc; sourceTree = "<group>"; };
82C7DF68192222D2002CE939 /* PackageTool.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PackageTool.h; sourceTree = "<group>"; };
82C7DF69192222D2002CE939 /* PackageUtil.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PackageUtil.cc; sourceTree = "<group>"; };
82C7DF6A192222D2002CE939 /* PackageUtil.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PackageUtil.h; sourceTree = "<group>"; };
F504B89918BC39F800B7C723 /* SoundInterface.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SoundInterface.cc; sourceTree = "<group>"; };
F504B89A18BC39F800B7C723 /* SoundInterface.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SoundInterface.h; sourceTree = "<group>"; };
F52905781830C2DC0081A084 /* CGTool.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CGTool.cc; sourceTree = "<group>"; };
@ -1583,18 +1614,6 @@
F5F48FA517E1A66000361F45 /* ShaderCompiler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ShaderCompiler.h; sourceTree = "<group>"; };
F5F48FA817E1A66000361F45 /* stdneb.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = stdneb.cc; sourceTree = "<group>"; };
F5F48FA917E1A66000361F45 /* stdneb.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = stdneb.h; sourceTree = "<group>"; };
F5F48FBC17E1A66000361F45 /* cg.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cg.h; sourceTree = "<group>"; };
F5F48FBD17E1A66000361F45 /* cg_bindlocations.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cg_bindlocations.h; sourceTree = "<group>"; };
F5F48FBE17E1A66000361F45 /* cg_datatypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cg_datatypes.h; sourceTree = "<group>"; };
F5F48FBF17E1A66000361F45 /* cg_enums.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cg_enums.h; sourceTree = "<group>"; };
F5F48FC017E1A66000361F45 /* cg_errors.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cg_errors.h; sourceTree = "<group>"; };
F5F48FC117E1A66000361F45 /* cg_profiles.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cg_profiles.h; sourceTree = "<group>"; };
F5F48FC217E1A66000361F45 /* cgGL_profiles.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cgGL_profiles.h; sourceTree = "<group>"; };
F5F48FC417E1A66000361F45 /* glsl_optimizer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = glsl_optimizer.h; sourceTree = "<group>"; };
F5F48FC617E1A66000361F45 /* hlsl2glsl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = hlsl2glsl.h; sourceTree = "<group>"; };
F5F48FC817E1A66000361F45 /* mojoshader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mojoshader.h; sourceTree = "<group>"; };
F5F48FC917E1A66000361F45 /* mojoshader_parser_hlsl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mojoshader_parser_hlsl.h; sourceTree = "<group>"; };
F5F48FCA17E1A66000361F45 /* mojoshader_version.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mojoshader_version.h; sourceTree = "<group>"; };
F5F48FDE17E1A66000361F45 /* aldlist.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = aldlist.cc; sourceTree = "<group>"; };
F5F48FDF17E1A66000361F45 /* aldlist.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = aldlist.h; sourceTree = "<group>"; };
F5F48FE017E1A66000361F45 /* CMakeLists.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = CMakeLists.txt; sourceTree = "<group>"; };
@ -2742,21 +2761,6 @@
F5F49CE017E1C5EE00361F45 /* spriteutils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = spriteutils.h; sourceTree = "<group>"; };
F5F49CE117E1C5EE00361F45 /* spritevertex.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = spritevertex.cc; sourceTree = "<group>"; };
F5F49CE217E1C5EE00361F45 /* spritevertex.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = spritevertex.h; sourceTree = "<group>"; };
F5FD75CE1859ACB80029DB32 /* CMakeLists.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = CMakeLists.txt; sourceTree = "<group>"; };
F5FD75CF1859ACB90029DB32 /* FileData.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FileData.cc; sourceTree = "<group>"; };
F5FD75D01859ACB90029DB32 /* FileData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileData.h; sourceTree = "<group>"; };
F5FD75D11859ACB90029DB32 /* FileFormat.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileFormat.h; sourceTree = "<group>"; };
F5FD75D21859ACB90029DB32 /* FileTable.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FileTable.cc; sourceTree = "<group>"; };
F5FD75D31859ACB90029DB32 /* FileTable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileTable.h; sourceTree = "<group>"; };
F5FD75D41859ACB90029DB32 /* Package.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Package.cc; sourceTree = "<group>"; };
F5FD75D51859ACB90029DB32 /* Package.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Package.h; sourceTree = "<group>"; };
F5FD75D61859ACB90029DB32 /* PackageSystem.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PackageSystem.cc; sourceTree = "<group>"; };
F5FD75D71859ACB90029DB32 /* PackageSystem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PackageSystem.h; sourceTree = "<group>"; };
F5FD75D81859ACB90029DB32 /* PackageTool.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PackageTool.cc; sourceTree = "<group>"; };
F5FD75D91859ACB90029DB32 /* PackageTool.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PackageTool.h; sourceTree = "<group>"; };
F5FD75DA1859ACB90029DB32 /* PackageUtil.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PackageUtil.cc; sourceTree = "<group>"; };
F5FD75DB1859ACB90029DB32 /* PackageUtil.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PackageUtil.h; sourceTree = "<group>"; };
F5FD75DC1859ACB90029DB32 /* PackDef.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PackDef.h; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@ -2771,6 +2775,89 @@
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
587A3D9918F68D15000ED13A /* OCAndCPlusPlusInterface */ = {
isa = PBXGroup;
children = (
587A3D9A18F68D15000ED13A /* OCAndCPlusInterface.h */,
);
path = OCAndCPlusPlusInterface;
sourceTree = "<group>";
};
82C7DF4A19221F92002CE939 /* win */ = {
isa = PBXGroup;
children = (
82C7DF4B19221F92002CE939 /* Cg */,
82C7DF5319221F92002CE939 /* GlslOptimizer */,
82C7DF5519221F92002CE939 /* hlsl2glslfork */,
82C7DF5719221F92002CE939 /* mojoshader */,
);
name = win;
path = ../../ExtIncludes/ShaderUtil;
sourceTree = "<group>";
};
82C7DF4B19221F92002CE939 /* Cg */ = {
isa = PBXGroup;
children = (
82C7DF4C19221F92002CE939 /* cg.h */,
82C7DF4D19221F92002CE939 /* cgGL_profiles.h */,
82C7DF4E19221F92002CE939 /* cg_bindlocations.h */,
82C7DF4F19221F92002CE939 /* cg_datatypes.h */,
82C7DF5019221F92002CE939 /* cg_enums.h */,
82C7DF5119221F92002CE939 /* cg_errors.h */,
82C7DF5219221F92002CE939 /* cg_profiles.h */,
);
path = Cg;
sourceTree = "<group>";
};
82C7DF5319221F92002CE939 /* GlslOptimizer */ = {
isa = PBXGroup;
children = (
82C7DF5419221F92002CE939 /* glsl_optimizer.h */,
);
path = GlslOptimizer;
sourceTree = "<group>";
};
82C7DF5519221F92002CE939 /* hlsl2glslfork */ = {
isa = PBXGroup;
children = (
82C7DF5619221F92002CE939 /* hlsl2glsl.h */,
);
path = hlsl2glslfork;
sourceTree = "<group>";
};
82C7DF5719221F92002CE939 /* mojoshader */ = {
isa = PBXGroup;
children = (
82C7DF5819221F92002CE939 /* mojoshader.h */,
82C7DF5919221F92002CE939 /* mojoshader_parser_hlsl.h */,
82C7DF5A19221F92002CE939 /* mojoshader_version.h */,
);
path = mojoshader;
sourceTree = "<group>";
};
82C7DF5B192222D2002CE939 /* packagetool */ = {
isa = PBXGroup;
children = (
82C7DF5C192222D2002CE939 /* CMakeLists.txt */,
82C7DF5D192222D2002CE939 /* FileData.cc */,
82C7DF5E192222D2002CE939 /* FileData.h */,
82C7DF5F192222D2002CE939 /* FileFormat.h */,
82C7DF60192222D2002CE939 /* FileTable.cc */,
82C7DF61192222D2002CE939 /* FileTable.h */,
82C7DF62192222D2002CE939 /* PackDef.h */,
82C7DF63192222D2002CE939 /* Package.cc */,
82C7DF64192222D2002CE939 /* Package.h */,
82C7DF65192222D2002CE939 /* PackageSystem.cc */,
82C7DF66192222D2002CE939 /* PackageSystem.h */,
82C7DF67192222D2002CE939 /* PackageTool.cc */,
82C7DF68192222D2002CE939 /* PackageTool.h */,
82C7DF69192222D2002CE939 /* PackageUtil.cc */,
82C7DF6A192222D2002CE939 /* PackageUtil.h */,
);
name = packagetool;
path = ../../packagetool;
sourceTree = "<group>";
};
F52905931830CA550081A084 /* ShaderTemplate */ = {
isa = PBXGroup;
children = (
@ -2883,6 +2970,7 @@
F5BC886217F28E0A00F0D1DD /* IOSObjectC */ = {
isa = PBXGroup;
children = (
587A3D9918F68D15000ED13A /* OCAndCPlusPlusInterface */,
F5BC886317F28E0A00F0D1DD /* iosALSystem */,
);
name = IOSObjectC;
@ -3006,9 +3094,9 @@
F5F48B3B17E1A61300361F45 /* GenesisEngineLib */ = {
isa = PBXGroup;
children = (
82C7DF5B192222D2002CE939 /* packagetool */,
F5E8AB241867EAAB006C5348 /* profilesystem */,
F5ECD9121862EE9900AFFB4E /* tinyxml */,
F5FD75CD1859ACB80029DB32 /* packageTool */,
F5F49C0817E1B4C000361F45 /* CSharpAssembly */,
F5F4966417E1A66400361F45 /* GenesisiOS */,
F5F48B5017E1A65A00361F45 /* addons */,
@ -3789,6 +3877,7 @@
F5F48F9B17E1A66000361F45 /* shadercompiler */ = {
isa = PBXGroup;
children = (
82C7DF4A19221F92002CE939 /* win */,
F5C42B3518B1E3A400F5144E /* Compilers */,
F5C42B3E18B1E3A400F5144E /* ShadercompilerConfig.cc */,
F5C42B3F18B1E3A400F5144E /* ShadercompilerConfig.h */,
@ -3815,7 +3904,6 @@
F5F48FA817E1A66000361F45 /* stdneb.cc */,
F5F48FA917E1A66000361F45 /* stdneb.h */,
F5F48FB117E1A66000361F45 /* Utility */,
F5F48FBA17E1A66000361F45 /* win */,
);
path = shadercompiler;
sourceTree = "<group>";
@ -3851,57 +3939,6 @@
path = Utility;
sourceTree = "<group>";
};
F5F48FBA17E1A66000361F45 /* win */ = {
isa = PBXGroup;
children = (
F5F48FBB17E1A66000361F45 /* Cg */,
F5F48FC317E1A66000361F45 /* GlslOptimizer */,
F5F48FC517E1A66000361F45 /* hlsl2glslfork */,
F5F48FC717E1A66000361F45 /* mojoshader */,
);
path = win;
sourceTree = "<group>";
};
F5F48FBB17E1A66000361F45 /* Cg */ = {
isa = PBXGroup;
children = (
F5F48FBC17E1A66000361F45 /* cg.h */,
F5F48FBD17E1A66000361F45 /* cg_bindlocations.h */,
F5F48FBE17E1A66000361F45 /* cg_datatypes.h */,
F5F48FBF17E1A66000361F45 /* cg_enums.h */,
F5F48FC017E1A66000361F45 /* cg_errors.h */,
F5F48FC117E1A66000361F45 /* cg_profiles.h */,
F5F48FC217E1A66000361F45 /* cgGL_profiles.h */,
);
path = Cg;
sourceTree = "<group>";
};
F5F48FC317E1A66000361F45 /* GlslOptimizer */ = {
isa = PBXGroup;
children = (
F5F48FC417E1A66000361F45 /* glsl_optimizer.h */,
);
path = GlslOptimizer;
sourceTree = "<group>";
};
F5F48FC517E1A66000361F45 /* hlsl2glslfork */ = {
isa = PBXGroup;
children = (
F5F48FC617E1A66000361F45 /* hlsl2glsl.h */,
);
path = hlsl2glslfork;
sourceTree = "<group>";
};
F5F48FC717E1A66000361F45 /* mojoshader */ = {
isa = PBXGroup;
children = (
F5F48FC817E1A66000361F45 /* mojoshader.h */,
F5F48FC917E1A66000361F45 /* mojoshader_parser_hlsl.h */,
F5F48FCA17E1A66000361F45 /* mojoshader_version.h */,
);
path = mojoshader;
sourceTree = "<group>";
};
F5F48FDD17E1A66000361F45 /* soundsystem */ = {
isa = PBXGroup;
children = (
@ -4439,6 +4476,8 @@
F5F492AE17E1A66200361F45 /* scriptfeature */ = {
isa = PBXGroup;
children = (
58548DAC19061FC400BA92A0 /* script_app.cc */,
58548DAD19061FC400BA92A0 /* script_app.h */,
F5F492AF17E1A66200361F45 /* editable_field_value.cc */,
F5F492B017E1A66200361F45 /* editable_field_value.h */,
F5F492B117E1A66200361F45 /* inc */,
@ -5992,29 +6031,6 @@
path = sprite;
sourceTree = "<group>";
};
F5FD75CD1859ACB80029DB32 /* packageTool */ = {
isa = PBXGroup;
children = (
F5FD75CE1859ACB80029DB32 /* CMakeLists.txt */,
F5FD75CF1859ACB90029DB32 /* FileData.cc */,
F5FD75D01859ACB90029DB32 /* FileData.h */,
F5FD75D11859ACB90029DB32 /* FileFormat.h */,
F5FD75D21859ACB90029DB32 /* FileTable.cc */,
F5FD75D31859ACB90029DB32 /* FileTable.h */,
F5FD75D41859ACB90029DB32 /* Package.cc */,
F5FD75D51859ACB90029DB32 /* Package.h */,
F5FD75D61859ACB90029DB32 /* PackageSystem.cc */,
F5FD75D71859ACB90029DB32 /* PackageSystem.h */,
F5FD75D81859ACB90029DB32 /* PackageTool.cc */,
F5FD75D91859ACB90029DB32 /* PackageTool.h */,
F5FD75DA1859ACB90029DB32 /* PackageUtil.cc */,
F5FD75DB1859ACB90029DB32 /* PackageUtil.h */,
F5FD75DC1859ACB90029DB32 /* PackDef.h */,
);
name = packageTool;
path = ../../packageTool;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
@ -6187,6 +6203,7 @@
F5F497C217E1A66500361F45 /* MyGUI_TabItem.cpp in Sources */,
F5F497C317E1A66500361F45 /* MyGUI_TextBox.cpp in Sources */,
F5F497C417E1A66500361F45 /* MyGUI_TextIterator.cpp in Sources */,
82C7DF6B192222D2002CE939 /* FileData.cc in Sources */,
F5F497C517E1A66500361F45 /* MyGUI_TextureUtility.cpp in Sources */,
F5F497C617E1A66500361F45 /* MyGUI_TextView.cpp in Sources */,
F5F497C717E1A66500361F45 /* MyGUI_TileRect.cpp in Sources */,
@ -6203,6 +6220,7 @@
F5F4980717E1A66500361F45 /* particleColorAffectorSerialization.cc in Sources */,
F5F4980A17E1A66500361F45 /* particleFollowerAffector.cc in Sources */,
F5F4980B17E1A66500361F45 /* particleFollowerAffectorSerialization.cc in Sources */,
82C7DF6C192222D2002CE939 /* FileTable.cc in Sources */,
F5F4980C17E1A66500361F45 /* particleGravityAffector.cc in Sources */,
F5F4980D17E1A66500361F45 /* particleGravityAffectorSerialization.cc in Sources */,
F5F4981017E1A66500361F45 /* particleLinearForceAffector.cc in Sources */,
@ -6504,6 +6522,7 @@
F5F49A6017E1A66500361F45 /* TerrainRenderComponent.cc in Sources */,
F5F49A6117E1A66500361F45 /* TerrainRenderComponentSerialization.cc in Sources */,
F5F49A6217E1A66500361F45 /* TerrainRenderObject.cc in Sources */,
82C7DF6F192222D2002CE939 /* PackageTool.cc in Sources */,
F5F49A6717E1A66500361F45 /* application.cc in Sources */,
F5F49A6917E1A66500361F45 /* androidsysfunc.cc in Sources */,
F5F49A6A17E1A66500361F45 /* coreserver.cc in Sources */,
@ -6561,6 +6580,7 @@
F5F49A9E17E1A66500361F45 /* archivefilesystem.cc in Sources */,
F5F49A9F17E1A66500361F45 /* archivefilesystembase.cc in Sources */,
F5F49AA017E1A66500361F45 /* assignregistry.cc in Sources */,
82C7DF70192222D2002CE939 /* PackageUtil.cc in Sources */,
F5F49AA117E1A66500361F45 /* gamecontentserverbase.cc in Sources */,
F5F49AA217E1A66500361F45 /* binaryreader.cc in Sources */,
F5F49AA317E1A66500361F45 /* binarywriter.cc in Sources */,
@ -6642,6 +6662,7 @@
F5F49AFA17E1A66500361F45 /* conebuilder.cc in Sources */,
F5F49AFB17E1A66500361F45 /* meshbuilder.cc in Sources */,
F5F49AFC17E1A66500361F45 /* parallelogrambuilder.cc in Sources */,
82C7DF6E192222D2002CE939 /* PackageSystem.cc in Sources */,
F5F49AFD17E1A66500361F45 /* asyncport.cc in Sources */,
F5F49AFE17E1A66500361F45 /* asynhandlerthread.cc in Sources */,
F5F49AFF17E1A66500361F45 /* batchmessage.cc in Sources */,
@ -6796,6 +6817,7 @@
F5F49CC217E1C55900361F45 /* vegetationfeature.cc in Sources */,
F5F49CC317E1C55900361F45 /* vegetationfeatureprotocol.cc in Sources */,
F5F49CE317E1C5EE00361F45 /* sprite.cc in Sources */,
82C7DF6D192222D2002CE939 /* Package.cc in Sources */,
F5F49CE417E1C5EE00361F45 /* spriteanimation.cc in Sources */,
F5F49CE517E1C5EE00361F45 /* spriteanimationclip.cc in Sources */,
F5F49CE617E1C5EE00361F45 /* spriteblock.cc in Sources */,
@ -6838,6 +6860,7 @@
F55211611856F90B003AC44B /* Animation.cc in Sources */,
F55211621856F90B003AC44B /* AnimationLayer.cc in Sources */,
F55211631856F90B003AC44B /* AnimationServer.cc in Sources */,
58548DAE19061FC400BA92A0 /* script_app.cc in Sources */,
F55211641856F90B003AC44B /* ClipControl.cc in Sources */,
F55211A21856FC71003AC44B /* GenesisMakeGPUProgram.cc in Sources */,
F55211A31856FC71003AC44B /* GenesisMakeMaterial.cc in Sources */,
@ -6876,12 +6899,6 @@
F55211FB1858015B003AC44B /* TerrainDataSource.cc in Sources */,
F5DA5ADF185815370083349F /* ForwardShadingRenderPipeline.cc in Sources */,
F5DA5AE1185826380083349F /* scriptbind_physicsshape.cc in Sources */,
F5FD75DD1859ACB90029DB32 /* FileData.cc in Sources */,
F5FD75DE1859ACB90029DB32 /* FileTable.cc in Sources */,
F5FD75DF1859ACB90029DB32 /* Package.cc in Sources */,
F5FD75E01859ACB90029DB32 /* PackageSystem.cc in Sources */,
F5FD75E11859ACB90029DB32 /* PackageTool.cc in Sources */,
F5FD75E21859ACB90029DB32 /* PackageUtil.cc in Sources */,
F5ECD9021862E8D300AFFB4E /* particleMovementAffector.cc in Sources */,
F5ECD9061862E90400AFFB4E /* particleGPUTarget.cc in Sources */,
F5ECD9071862E90400AFFB4E /* particleGPUTargetSerialization.cc in Sources */,
@ -7028,7 +7045,7 @@
../extlibs/IosLibs,
../graphicsystem,
../addons,
../addons/shadercompiler/win,
../ExtIncludes/ShaderUtil,
../addons/Utility,
../addons/shadercompiler,
../app,
@ -7067,7 +7084,7 @@
../extlibs/IosLibs,
../graphicsystem,
../addons,
../addons/shadercompiler/win,
../ExtIncludes/ShaderUtil,
../addons/Utility,
../addons/shadercompiler,
../app,

View File

@ -26,11 +26,13 @@ THE SOFTWARE.
#import <UIKit/UIKit.h>
@class ViewController;
@class TextViewController;
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@property (strong, nonatomic) ViewController *viewController;
@property (strong, nonatomic) TextViewController *textviewController;
@end

View File

@ -1,3 +1,26 @@
/****************************************************************************
Copyright (c) 2011-2013,WebJet Business Division,CYOU
http://www.genesis-3d.com.cn
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
//
// AppDelegate.m
// GenesisEngineIos
@ -8,6 +31,8 @@
#import "AppDelegate.h"
#import "ViewController.h"
#import "TextViewController.h"
#include "MobClick.h"
@implementation AppDelegate
@ -22,6 +47,15 @@
self.viewController = [[ViewController alloc] initWithNibName:@"ViewController_iPad" bundle:nil];
}
self.window.rootViewController = self.viewController;
self.textviewController = [[TextViewController alloc]initWithNibName:nil bundle:nil ];
[self.textviewController setupTextView];
//add child textviewcontroller and subview
[self.viewController addChildViewController:self.textviewController];
[self.viewController.view addSubview:self.textviewController.view];
[self.window makeKeyAndVisible];
return YES;
}

View File

@ -0,0 +1,47 @@
/****************************************************************************
Copyright (c) 2011-2013,WebJet Business Division,CYOU
http://www.genesis-3d.com.cn
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
//
// OCAndCPlusInterface.cpp
// GameApp
//
// Created by xuhengjin on 4/8/14.
// Copyright (c) 2014 webJet. All rights reserved.
//
#import <Foundation/Foundation.h>
//#import "EAGLView.h"
#import "TextViewController.h"
#import "../OCAndCPlusPlusInterface/OCAndCPlusInterface.h"
void OCAndCPlusInterface::showKeyboard(bool bShow,const char* contentUtf8)
{
//NSLog(@"showkeyboard11");
if (bShow) {
[TextViewController setTextViewText:contentUtf8];
}
[TextViewController showKeyboard:bShow];
}

View File

@ -0,0 +1,80 @@
/****************************************************************************
Copyright (c) 2011-2013,WebJet Business Division,CYOU
http://www.genesis-3d.com.cn
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
/*
File: TextViewController.h
Abstract: The view controller for hosting the UITextView features of this sample.
Version: 2.11
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of
this Apple software constitutes acceptance of these terms. If you do
not agree with these terms, please do not use, install, modify or
redistribute this Apple software.
In consideration of your agreement to abide by the following terms, and
subject to these terms, Apple grants you a personal, non-exclusive
license, under Apple's copyrights in this original Apple software (the
"Apple Software"), to use, reproduce, modify and redistribute the Apple
Software, with or without modifications, in source and/or binary forms;
provided that if you redistribute the Apple Software in its entirety and
without modifications, you must retain this notice and the following
text and disclaimers in all such redistributions of the Apple Software.
Neither the name, trademarks, service marks or logos of Apple Inc. may
be used to endorse or promote products derived from the Apple Software
without specific prior written permission from Apple. Except as
expressly stated in this notice, no other rights or licenses, express or
implied, are granted by Apple herein, including but not limited to any
patent rights that may be infringed by your derivative works or by other
works in which the Apple Software may be incorporated.
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION,
MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
Copyright (C) 2013 Apple Inc. All Rights Reserved.
*/
#import <UIKit/UIKit.h>
@interface MyUITextView : UITextView
@end
@interface TextViewController : UIViewController<UITextViewDelegate>
+ (void) showKeyboard: (bool) bShow ;
+ (void) setTextViewText:(const char*) content;
- (void)setupTextView;
@end

View File

@ -0,0 +1,297 @@
/****************************************************************************
Copyright (c) 2011-2013,WebJet Business Division,CYOU
http://www.genesis-3d.com.cn
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
/*
File: TextViewController.m
Abstract: The view controller for hosting the UITextView features of this sample.
Version: 2.11
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of
this Apple software constitutes acceptance of these terms. If you do
not agree with these terms, please do not use, install, modify or
redistribute this Apple software.
In consideration of your agreement to abide by the following terms, and
subject to these terms, Apple grants you a personal, non-exclusive
license, under Apple's copyrights in this original Apple software (the
"Apple Software"), to use, reproduce, modify and redistribute the Apple
Software, with or without modifications, in source and/or binary forms;
provided that if you redistribute the Apple Software in its entirety and
without modifications, you must retain this notice and the following
text and disclaimers in all such redistributions of the Apple Software.
Neither the name, trademarks, service marks or logos of Apple Inc. may
be used to endorse or promote products derived from the Apple Software
without specific prior written permission from Apple. Except as
expressly stated in this notice, no other rights or licenses, express or
implied, are granted by Apple herein, including but not limited to any
patent rights that may be infringed by your derivative works or by other
works in which the Apple Software may be incorporated.
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION,
MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
Copyright (C) 2013 Apple Inc. All Rights Reserved.
*/
#import "TextViewController.h"
#import "AppDelegate.h"
#import "ViewController.h"
#include "Shell/Genesis.h"
#ifdef DEBUG
CGRect g_rectPos = CGRectMake(0, -101, 300, 100);
#else
CGRect g_rectPos = CGRectMake(0, -101, 300, 100);
#endif
float g_textviewHeight = 60;
@implementation MyUITextView
@end
MyUITextView* g_textEdit;
CGSize g_sizeDevice;
int g_maxCharCount = 100;
@interface TextViewController () <UITextViewDelegate>
@property (nonatomic, strong) MyUITextView *textView;
@end
#pragma mark -
@implementation TextViewController
+ (void) showKeyboard: (bool) bShow
{
NSString* empty = @"";
if (bShow) {
g_textEdit.frame = g_rectPos;
//[g_textEdit setText:empty];
//[g_textEdit setText:@"edit"];
[g_textEdit setKeyboardType:UIKeyboardTypeDefault];
g_textEdit.hidden = FALSE;
[g_textEdit becomeFirstResponder];
} else {
[g_textEdit resignFirstResponder];
g_textEdit.hidden = TRUE;
[g_textEdit setText:empty];
}
}
+ (void) setTextViewText:(const char*) content
{
NSString* nsContent = [[NSString alloc] initWithUTF8String:content];
[g_textEdit setText:nsContent];
}
- (void)setupTextView
{
self.textView = [[UITextView alloc] initWithFrame:self.view.frame];
g_textEdit = self.textView;
self.textView.textColor = [UIColor blackColor];
self.textView.font = [UIFont fontWithName:@"Arial" size:18.0];
self.textView.delegate = self;
self.textView.backgroundColor = [UIColor whiteColor];
self.textView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
NSString *textToAdd = @"Now is the time for all good developers to come to serve their country.\n\nNow is the time for all good developers to come to serve their country.\r\rThis text view can also use attributed strings.";
NSMutableAttributedString *attrString = [[NSMutableAttributedString alloc] initWithString:textToAdd];
// make red text
// [attrString addAttribute:NSForegroundColorAttributeName
// value:[UIColor redColor]
// range:NSMakeRange([attrString length] - 19, 19)];
//
// // make blue text
// [attrString addAttribute:NSForegroundColorAttributeName
// value:[UIColor blueColor]
// range:NSMakeRange([attrString length] - 23, 3)];
// [attrString addAttribute:NSUnderlineStyleAttributeName
// value:[NSNumber numberWithInteger:1]
// range:NSMakeRange([attrString length] - 23, 3)];
//[self.textView setAttributedText:attrString];
self.textView.returnKeyType = UIReturnKeyDefault;
self.textView.keyboardType = UIKeyboardTypeDefault; // use the default type input method (entire keyboard)
self.textView.scrollEnabled = YES;
// note: for UITextView, if you don't like auto correction while typing use:
// myTextView.autocorrectionType = UITextAutocorrectionTypeNo;
//[self.view addSubview:self.textView];
self.view = self.textView;
CGSize sizeDevice = [[UIScreen mainScreen] bounds].size;
g_sizeDevice = sizeDevice;
g_rectPos = CGRectMake(0, sizeDevice.height, sizeDevice.width, 60);
self.view.frame = g_rectPos;
}
- (void)viewDidLoad
{
[super viewDidLoad];
self.title = NSLocalizedString(@"TextViewTitle", @"");
[self setupTextView];
}
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
// listen for keyboard hide/show notifications so we can properly adjust the table's height
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(keyboardWillShow:)
name:UIKeyboardWillShowNotification
object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(keyboardWillHide:)
name:UIKeyboardWillHideNotification
object:nil];
}
#pragma mark - Notifications
- (void)adjustViewForKeyboardReveal:(BOOL)showKeyboard notificationInfo:(NSDictionary *)notificationInfo
{
// the keyboard is showing so resize the table's height
}
- (void)keyboardWillShow:(NSNotification *)notification
{
//NSLog(@" textviewctrl keyboardWillShow");
[self adjustViewForKeyboardReveal:YES notificationInfo:[notification userInfo]];
CGRect keyboardRect;
[[notification.userInfo objectForKey:UIKeyboardFrameEndUserInfoKey] getValue:&keyboardRect];
AppDelegate* pApp = (AppDelegate*)[ [UIApplication sharedApplication] delegate ];
CGRect finalRectRoot = [pApp.viewController.view convertRect:keyboardRect fromView:nil];
g_textviewHeight = keyboardRect.size.height/5;
CGRect kbPos = CGRectMake(finalRectRoot.origin.x, finalRectRoot.origin.y-g_textviewHeight, finalRectRoot.size.width, finalRectRoot.size.height);
self.view.frame = kbPos;
}
- (void)keyboardWillHide:(NSNotification *)aNotification
{
[self adjustViewForKeyboardReveal:NO notificationInfo:[aNotification userInfo]];
}
- (void)viewDidDisappear:(BOOL)animated
{
[super viewDidDisappear:animated];
[[NSNotificationCenter defaultCenter] removeObserver:self
name:UIKeyboardWillShowNotification
object:nil];
[[NSNotificationCenter defaultCenter] removeObserver:self
name:UIKeyboardWillHideNotification
object:nil];
}
#pragma mark - UITextViewDelegate
- (void)saveAction:(id)sender
{
// finish typing text/dismiss the keyboard by removing it as the first responder
//
[self.textView resignFirstResponder];
self.navigationItem.rightBarButtonItem = nil; // this will remove the "save" button
}
- (void)textViewDidBeginEditing:(UITextView *)textView
{
// provide my own Save button to dismiss the keyboard
UIBarButtonItem* saveItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone
target:self
action:@selector(saveAction:)];
self.navigationItem.rightBarButtonItem = saveItem;
}
- (void)textViewDidEndEditing:(UITextView *)textView
{
NSString* strText = textView.text;
const char* pStr = [strText UTF8String];
EngineShell::UIInsertText(pStr);
[TextViewController showKeyboard:false ];
}
- (BOOL) textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text
{
if([text isEqualToString:@"\n"])
{
[g_textEdit resignFirstResponder];
g_textEdit.hidden = TRUE;
return NO;
}
else if( range.location >= g_maxCharCount )
{
return NO;
}
return YES;
}
@end

View File

@ -207,7 +207,7 @@ DeviceLevel GetDeviceLevel()
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
const char *appWriteableDic = [documentsDirectory UTF8String];
EngineShell::InitEngine(g_Width,g_Height,resChar,appWriteableDic,"asset:BeginScene.scene",true);
EngineShell::InitEngine(g_Width,g_Height,resChar,appWriteableDic,"asset:editBox3.scene",false);
}

View File

@ -0,0 +1,41 @@
/****************************************************************************
Copyright (c) 2011-2013,WebJet Business Division,CYOU
http://www.genesis-3d.com.cn
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
//
// OCAndCPlusInterface.h
// GameApp
//
// Created by xuhengjin on 4/8/14.
// Copyright (c) 2014 webJet. All rights reserved.
//
#ifndef __GameApp__OCAndCPlusInterface__
#define __GameApp__OCAndCPlusInterface__
class OCAndCPlusInterface
{
public:
static void showKeyboard(bool bShow,const char* contentUtf8);
};
#endif /* defined(__GameApp__OCAndCPlusInterface__) */

View File

@ -34,7 +34,12 @@
#include "input/inputwindowsource.h"
#include "input/osx/osxinputsource.h"
#include "input/osx/osxtouchevent.h"
#include "input/mobilekeyboardevent.h"
#include "addons/shadercompiler/ShadercompilerConfig.h"
#include "addons/myguiengine/include/MyGUI_UString.h"
#include "app/guifeature/scriptgui.h"
using namespace RenderBase;
@ -120,5 +125,50 @@ void OnStopped()
g_pApp->OnStopped();
}
void UIInsertText(const char* wstr)
{
#if __OSX__
MyGUI::UString uiStr(wstr);
App::ScriptGui::SetFocusedEditboxCaption(uiStr);
MyGUI::InputManager::getInstance().setKeyFocusWidget(nullptr);
#elif __ANDROID__
std::wstring stdWstr = uiStr.asWStr();
for ( IndexT i = 0; i < stdWstr.length(); i++ )
{
Input::MobileKeyboardEvent keyboardEvent;
keyboardEvent.SetType(Input::MoibleInputEvent::INPUT_EVENT_TYPE_KEY);
keyboardEvent.SetMotionType(Input::MobileKeyboardEvent::MOTION_EVENT_CHAR);
Input::Char characterCode = (Input::Char)stdWstr.at(i);
keyboardEvent.SetChar(characterCode);
const GPtr<Input::InputSource>& pInputSource = g_pApp->GetInputSource();
if (pInputSource.isvalid())
{
pInputSource.downcast<OSXInput::OSXInputSource>()->OnOSXProc(&keyboardEvent);
}
}
#endif
}
void UIDeleteBackward()
{
Input::MobileKeyboardEvent keyboardEvent;
keyboardEvent.SetType(Input::MoibleInputEvent::INPUT_EVENT_TYPE_KEY);
keyboardEvent.SetMotionType(Input::MobileKeyboardEvent::MOTION_EVENT_KEY_DOWN);
keyboardEvent.SetKeycode(Input::InputKey::Back);
const GPtr<Input::InputSource>& pInputSource = g_pApp->GetInputSource();
if (pInputSource.isvalid())
{
pInputSource.downcast<OSXInput::OSXInputSource>()->OnOSXProc(&keyboardEvent);
//send keyrelease
keyboardEvent.SetMotionType(Input::MobileKeyboardEvent::MOTION_EVENT_KEY_UP);
pInputSource.downcast<OSXInput::OSXInputSource>()->OnOSXProc(&keyboardEvent);
}
}
}

View File

@ -10,7 +10,6 @@
#define GenesisEngineLib_Genesis_h
#include <vector>
namespace EngineShell
{
enum InputAciton
@ -34,6 +33,8 @@ namespace EngineShell
void TouchPoint( const TouchDataVector& touchDatas, const InputAciton& action );
void OnResumed();
void OnStopped();
void UIInsertText(const char* wstr);
void UIDeleteBackward();
}
#endif

View File

@ -115,6 +115,7 @@ SET ( _HEADER_FILES
inputmobileconfig.h
mobileinputevent.h
mobiletouchevent.h
mobilekeyboardevent.h
)
# folder

View File

@ -29,6 +29,7 @@ THE SOFTWARE.
#include "input/android/androidtouchevent.h"
#include "graphicsystem/GraphicSystem.h"
#include "input/inputmobileconfig.h"
#include "input/mobilekeyboardevent.h"
namespace AndroidInput
{
@ -102,14 +103,56 @@ int AndroidInputSource::OnAndroidProc(MoibleInputEvent* pEvent)
break;
case MoibleInputEvent::INPUT_EVENT_TYPE_KEY:
break;
default:
{
OnKeyboardEvent(pEvent);
}
break;
}
return 0;
}
void AndroidInputSource::OnKeyboardEvent(const Input::MoibleInputEvent* pEvent)
{
//put event to eventProcessList
if ( !pEvent )
{
return;
}
Input::MoibleInputEvent* punCEvent = const_cast<Input::MoibleInputEvent*>(pEvent);
Input::MobileKeyboardEvent* pkeyEvent = dynamic_cast<Input::MobileKeyboardEvent*>( punCEvent );
if ( !pkeyEvent )
{
return;
}
Input::InputEvent inputEvent;
switch(pkeyEvent->GetMotionType())
{
case Input::MobileKeyboardEvent::MOTION_EVENT_KEY_DOWN:
{
inputEvent.SetType(Input::InputEvent::KeyDown);
inputEvent.SetKey(pkeyEvent->GetKeycode());
}
break;
case Input::MobileKeyboardEvent::MOTION_EVENT_KEY_UP:
{
inputEvent.SetType(Input::InputEvent::KeyUp);
inputEvent.SetKey(pkeyEvent->GetKeycode());
}
break;
case Input::MobileKeyboardEvent::MOTION_EVENT_CHAR:
{
inputEvent.SetType(Input::InputEvent::Character);
inputEvent.SetChar(pkeyEvent->GetChar());
}
break;
default:
break;
}
m_InputEventList.Append(inputEvent);
}
void AndroidInputSource::OnTouchEvent(const MobileTouchEvent* pEvent)
{
#if _DEBUG
@ -126,11 +169,8 @@ void AndroidInputSource::OnTouchEvent(const MobileTouchEvent* pEvent)
case MobileTouchEvent::MOTION_EVENT_ACTION_DOWN:
case MobileTouchEvent::MOTION_EVENT_ACTION_UP:
case MobileTouchEvent::MOTION_EVENT_ACTION_CANCEL:
OnTouch(pEvent, actionType);
break;
default:
break;
}
}
@ -169,12 +209,6 @@ void AndroidInputSource::OnTouch(const MobileTouchEvent* pEvent, const int type)
inputEvent.SetType(InputEvent::TouchMotionUp);
m_InputEventList.Append(inputEvent);
break;
case MobileTouchEvent::MOTION_EVENT_ACTION_CANCEL:
inputEvent.SetType(InputEvent::TouchMotionCancel);
m_InputEventList.Append(inputEvent);
break;
default:
break;
}
}

View File

@ -69,6 +69,7 @@ protected:
void OnTouchMove(const Input::MobileTouchEvent* pEvent);
void OnTouch(const Input::MobileTouchEvent* pEvent, const int type);
void OnKeyboardEvent(const Input::MoibleInputEvent* pEvent);
protected:
Util::Array<Input::InputEvent> m_InputEventList;

View File

@ -144,7 +144,7 @@ InputMouseBase::OnEvent(const InputEvent& inputEvent)
case InputEvent::MouseMove:
this->UpdateMousePositions(inputEvent.GetAbsMousePos(), inputEvent.GetNormMousePos());
this->currentEvents.Append(MouseButtonEvent(InputMouseButton::InvalidMouseButton, inputEvent.GetType()));
this->currentEvents.Append(MouseButtonEvent(InputMouseButton::InvalidMouseButton, inputEvent.GetType(),inputEvent.GetAbsMousePos(), inputEvent.GetNormMousePos()));
break;
case InputEvent::RawMouseMove:
@ -159,7 +159,7 @@ InputMouseBase::OnEvent(const InputEvent& inputEvent)
this->buttonStates[btn].down = true;
this->buttonStates[btn].pressed = true;
this->UpdateMousePositions(inputEvent.GetAbsMousePos(), inputEvent.GetNormMousePos());
this->currentEvents.Append(MouseButtonEvent(btn, inputEvent.GetType()));
this->currentEvents.Append(MouseButtonEvent(btn, inputEvent.GetType(),inputEvent.GetAbsMousePos(), inputEvent.GetNormMousePos()));
}
}
break;
@ -178,7 +178,7 @@ InputMouseBase::OnEvent(const InputEvent& inputEvent)
// be cleared at the beginning of the next frame
// when the button up flag was set
this->UpdateMousePositions(inputEvent.GetAbsMousePos(), inputEvent.GetNormMousePos());
this->currentEvents.Append(MouseButtonEvent(btn, inputEvent.GetType()));
this->currentEvents.Append(MouseButtonEvent(btn, inputEvent.GetType(),inputEvent.GetAbsMousePos(), inputEvent.GetNormMousePos()));
}
}
break;
@ -190,19 +190,19 @@ InputMouseBase::OnEvent(const InputEvent& inputEvent)
{
this->buttonStates[btn].doubleClicked = true;
this->UpdateMousePositions(inputEvent.GetAbsMousePos(), inputEvent.GetNormMousePos());
this->currentEvents.Append(MouseButtonEvent(btn, inputEvent.GetType()));
this->currentEvents.Append(MouseButtonEvent(btn, inputEvent.GetType(),inputEvent.GetAbsMousePos(), inputEvent.GetNormMousePos()));
}
}
break;
case InputEvent::MouseWheelForward:
this->wheelForward = true;
this->currentEvents.Append(MouseButtonEvent(InputMouseButton::MiddleButton, inputEvent.GetType()));
this->currentEvents.Append(MouseButtonEvent(InputMouseButton::MiddleButton, inputEvent.GetType(),inputEvent.GetAbsMousePos(), inputEvent.GetNormMousePos()));
break;
case InputEvent::MouseWheelBackward:
this->wheelBackward = true;
this->currentEvents.Append(MouseButtonEvent(InputMouseButton::MiddleButton, inputEvent.GetType()));
this->currentEvents.Append(MouseButtonEvent(InputMouseButton::MiddleButton, inputEvent.GetType(),inputEvent.GetAbsMousePos(), inputEvent.GetNormMousePos()));
break;
default:

View File

@ -117,7 +117,7 @@ bool InputTouchScreenBase::OnEvent(const Input::InputEvent& inputEvent)
const IndexT id = inputEvent.GetPointerId(i);
m_FingerStates[id].pressed = true;
UpdateFingerPositions(inputEvent.GetAbsTouchPos(id), inputEvent.GetNormTouchPos(id), id);
m_CurrentEvents.Append(TouchEvent(id, inputEvent.GetType()));
m_CurrentEvents.Append(TouchEvent(id, inputEvent.GetType(),inputEvent.GetAbsTouchPos(id), inputEvent.GetNormTouchPos(id) ));
}
}
@ -132,7 +132,7 @@ bool InputTouchScreenBase::OnEvent(const Input::InputEvent& inputEvent)
const IndexT id = inputEvent.GetPointerId(i);
m_FingerStates[id].down = true;
UpdateFingerPositions(inputEvent.GetAbsTouchPos(id), inputEvent.GetNormTouchPos(id), id);
m_CurrentEvents.Append(TouchEvent(id, inputEvent.GetType()));
m_CurrentEvents.Append(TouchEvent(id, inputEvent.GetType(),inputEvent.GetAbsTouchPos(id), inputEvent.GetNormTouchPos(id) ));
}
}
break;
@ -146,7 +146,7 @@ bool InputTouchScreenBase::OnEvent(const Input::InputEvent& inputEvent)
const IndexT id = inputEvent.GetPointerId(i);
m_FingerStates[id].up = true;
UpdateFingerPositions(inputEvent.GetAbsTouchPos(id), inputEvent.GetNormTouchPos(id), id);
m_CurrentEvents.Append(TouchEvent(id, inputEvent.GetType()));
m_CurrentEvents.Append(TouchEvent(id, inputEvent.GetType(),inputEvent.GetAbsTouchPos(id), inputEvent.GetNormTouchPos(id) ));
}
}
break;
@ -161,7 +161,7 @@ bool InputTouchScreenBase::OnEvent(const Input::InputEvent& inputEvent)
m_FingerStates[id].down = false;
m_FingerStates[id].pressed = false;
m_FingerStates[id].up = true;
m_CurrentEvents.Append(TouchEvent(id, inputEvent.GetType()));
m_CurrentEvents.Append(TouchEvent(id, inputEvent.GetType(),inputEvent.GetAbsTouchPos(id), inputEvent.GetNormTouchPos(id) ));
}
}
}

View File

@ -62,29 +62,37 @@ namespace Input
struct TouchEvent : public EventBase
{
int id;
Math::float2 pixelPos;
Math::float2 screenPos;
inline TouchEvent()
:id(-1)
{
}
inline TouchEvent(int id, InputEvent::Type event)
inline TouchEvent(int id, InputEvent::Type event,Math::float2 pixelPos,Math::float2 screenPos)
:EventBase(event)
{
this->id = id;
this->pixelPos = pixelPos;
this->screenPos = screenPos;
}
};
struct MouseButtonEvent : public EventBase
{
InputMouseButton::Code button;
Math::float2 pixelPos;
Math::float2 screenPos;
inline MouseButtonEvent()
:button(InputMouseButton::InvalidMouseButton)
{
}
inline MouseButtonEvent(InputMouseButton::Code button, InputEvent::Type event)
inline MouseButtonEvent(InputMouseButton::Code button, InputEvent::Type event,Math::float2 pixelPos,Math::float2 screenPos)
:EventBase(event)
{
this->button = button;
this->pixelPos = pixelPos;
this->screenPos = screenPos;
}
};

View File

@ -27,7 +27,7 @@ THE SOFTWARE.
#if __WIN32__
namespace Input
{
__ImplementClass(Input::InputWindowSource, 'WDIS', Win32Input::Win32InputWindowSource);
__ImplementClass(Input::InputWindowSource, 'WDIS', Win32Input::Win32InputWebWindowSource);
}
#elif __ANDROID__
namespace Input

View File

@ -28,10 +28,10 @@ THE SOFTWARE.
#if __WIN32__
#include "input/win32/win32inputwindowsource.h"
#include "input/win32/win32inputwebwindowsource.h"
namespace Input
{
class InputWindowSource : public Win32Input::Win32InputWindowSource
class InputWindowSource : public Win32Input::Win32InputWebWindowSource
{
__DeclareClass(InputWindowSource);
};

View File

@ -27,7 +27,7 @@ THE SOFTWARE.
namespace Input
{
class MoibleInputEvent
class MoibleInputEvent
{
public:
@ -43,6 +43,7 @@ public:
};
MoibleInputEvent();
virtual ~MoibleInputEvent();
/// set event type
void SetType(Type t);
@ -59,6 +60,10 @@ inline MoibleInputEvent::MoibleInputEvent()
: m_Type(InvalidType)
{
}
inline MoibleInputEvent::~MoibleInputEvent()
{
}
inline void MoibleInputEvent::SetType(Type t)

View File

@ -0,0 +1,106 @@
/****************************************************************************
Copyright (c) 2011-2013,WebJet Business Division,CYOU
http://www.genesis-3d.com.cn
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#ifndef __mobilekeyboardevent_H__
#define __mobilekeyboardevent_H__
#include "input/mobileinputevent.h"
#include "inputkey.h"
#include "inputchar.h"
namespace Input
{
class MobileKeyboardEvent : public Input::MoibleInputEvent
{
public:
enum MotionType
{
MOTION_EVENT_KEY_DOWN = 0,
MOTION_EVENT_KEY_UP,
MOTION_EVENT_CHAR,
};
MobileKeyboardEvent();
~MobileKeyboardEvent();
public:
void SetMotionType(const MotionType type);
const MotionType GetMotionType() const;
void SetKeycode(InputKey::Code keyc);
InputKey::Code GetKeycode();
void SetChar(Char& keyc);
Char GetChar();
protected:
MotionType m_MotionType;
InputKey::Code keyCode;
Char character;
};
inline MobileKeyboardEvent::MobileKeyboardEvent()
{
}
inline MobileKeyboardEvent::~MobileKeyboardEvent()
{
}
inline void MobileKeyboardEvent::SetMotionType(const MotionType type)
{
m_MotionType = type;
}
inline const MobileKeyboardEvent::MotionType MobileKeyboardEvent::GetMotionType() const
{
return m_MotionType;
}
inline void MobileKeyboardEvent::SetKeycode(InputKey::Code keyc)
{
keyCode = keyc;
}
inline InputKey::Code MobileKeyboardEvent::GetKeycode()
{
return keyCode;
}
inline void MobileKeyboardEvent::SetChar(Char& keyc)
{
character = keyc;
}
inline Char MobileKeyboardEvent::GetChar()
{
return character;
}
}
#endif

View File

@ -29,6 +29,7 @@ THE SOFTWARE.
#include "input/osx/osxtouchevent.h"
#include "graphicsystem/GraphicSystem.h"
#include "input/inputmobileconfig.h"
#include "input/mobilekeyboardevent.h"
namespace OSXInput
{
@ -98,12 +99,56 @@ int OSXInputSource::OnOSXProc(MoibleInputEvent* pEvent)
break;
case MoibleInputEvent::INPUT_EVENT_TYPE_KEY:
{
OnKeyboardEvent(pEvent);
}
break;
}
return 0;
}
void OSXInputSource::OnKeyboardEvent(const Input::MoibleInputEvent* pEvent)
{
//put event to eventProcessList
if ( !pEvent )
{
return;
}
Input::MoibleInputEvent* punCEvent = const_cast<Input::MoibleInputEvent*>(pEvent);
Input::MobileKeyboardEvent* pkeyEvent = dynamic_cast<Input::MobileKeyboardEvent*>( punCEvent );
if ( !pkeyEvent )
{
return;
}
Input::InputEvent inputEvent;
switch(pkeyEvent->GetMotionType())
{
case Input::MobileKeyboardEvent::MOTION_EVENT_KEY_DOWN:
{
inputEvent.SetType(Input::InputEvent::KeyDown);
inputEvent.SetKey(pkeyEvent->GetKeycode());
}
break;
case Input::MobileKeyboardEvent::MOTION_EVENT_KEY_UP:
{
inputEvent.SetType(Input::InputEvent::KeyUp);
inputEvent.SetKey(pkeyEvent->GetKeycode());
}
break;
case Input::MobileKeyboardEvent::MOTION_EVENT_CHAR:
{
inputEvent.SetType(Input::InputEvent::Character);
inputEvent.SetChar(pkeyEvent->GetChar());
}
break;
default:
break;
}
m_InputEventList.Append(inputEvent);
}
void OSXInputSource::OnTouchEvent(const MobileTouchEvent* pEvent)
{
const MobileTouchEvent::MotionType actionType = pEvent->GetMotionType();

View File

@ -69,6 +69,8 @@ protected:
void OnTouchMove(const Input::MobileTouchEvent* pEvent);
void OnTouch(const Input::MobileTouchEvent* pEvent, const int type);
void OnKeyboardEvent(const Input::MoibleInputEvent* pEvent);
protected:
Util::Array<Input::InputEvent> m_InputEventList;

View File

@ -35,7 +35,7 @@ namespace Win32Input
__ImplementClass(Win32Input::Win32InputWebWindowSource, 'WWWI', Input::InputSource );
int _virtualKeyToText(UINT _virtualKey)
int Win32InputWebWindowSource::VirtualKeyToText(UINT _virtualKey)
{
static WCHAR deadKey = 0;
@ -212,7 +212,7 @@ namespace Win32Input
//inputEvent.SetType(InputEvent::KeyDown);
//inputEvent.SetKey(keyCode);
//mInputEventList.Append(inputEvent);
SetKeyDown(mInputEventList, inputEvent, keyCode, _virtualKeyToText((UINT)wParam));
SetKeyDown(mInputEventList, inputEvent, keyCode, VirtualKeyToText((UINT)wParam));
return 0;
}
}
@ -574,6 +574,8 @@ namespace Win32Input
case VK_OEM_6: return Input::InputKey::RightBracket;
case VK_OEM_7: return Input::InputKey::Quote;
case VK_PROCESSKEY: return Input::InputKey::InvalidKey; //输入法消息。
case '0': return Input::InputKey::Key0;
case '1': return Input::InputKey::Key1;
case '2': return Input::InputKey::Key2;

View File

@ -101,7 +101,7 @@ namespace Win32Input
{
return mInputEventList;
}
static int VirtualKeyToText(UINT _virtualKey);
protected:
void mouseMove(const Math::float2& absMousePos);

View File

@ -141,18 +141,22 @@ namespace GenesisMaterialMaker
#endif
for (SizeT i = 0; i < m_matParamList.Size(); ++i)
{
if(m_matParamList[i]->GetType() == Graphic::eMaterialParamTexture2D)
{
static_cast<Graphic::MaterialParamTex2D*>(m_matParamList[i])->SetHandle(tex2DHandle);
static_cast<Graphic::MaterialParamTex2D*>(m_matParamList[i])->SetStringValue("sys:white.jpg");
}
#if __WIN32__ && RENDERDEVICE_D3D9
else if (m_matParamList[i]->GetType() == Graphic::eMaterialParamTexture3D)
{
static_cast<Graphic::MaterialParamTex3D*>(m_matParamList[i])->SetHandle(tex3DHandle);
static_cast<Graphic::MaterialParamTex3D*>(m_matParamList[i])->SetStringValue("sys:Random3D.dds");
}
else if(m_matParamList[i]->GetType() == Graphic::eMaterialParamTextureCUBE)
{
static_cast<Graphic::MaterialParamTexCube*>(m_matParamList[i])->SetHandle(texCubeHandle);
static_cast<Graphic::MaterialParamTex3D*>(m_matParamList[i])->SetStringValue("sys:whitecube.dds");
}
#endif
}

View File

@ -1558,7 +1558,7 @@ yyreduce:
/* Line 1455 of yacc.c */
#line 72 "GenesisShaderBison.ycc"
{ //n_printf("init genesisshader\n");
{ //n_debuglog("init genesisshader\n");
g_GenesisMaterial->SetName((yyvsp[(2) - (2)].str));
delete[] (yyvsp[(2) - (2)].str);
ResetParserParams();
@ -1570,7 +1570,7 @@ yyreduce:
/* Line 1455 of yacc.c */
#line 78 "GenesisShaderBison.ycc"
{ //n_printf("in genesisshader,left\n");
{ //n_debuglog("in genesisshader,left\n");
}
break;
@ -1578,7 +1578,7 @@ yyreduce:
/* Line 1455 of yacc.c */
#line 80 "GenesisShaderBison.ycc"
{ //n_printf("from PropertySection to genesisshader\n");
{ //n_debuglog("from PropertySection to genesisshader\n");
}
break;
@ -1586,7 +1586,7 @@ yyreduce:
/* Line 1455 of yacc.c */
#line 82 "GenesisShaderBison.ycc"
{ //n_printf("out genesisshader,right\n");
{ //n_debuglog("out genesisshader,right\n");
g_GenesisMaterial->AddMaterial(*g_curGenesisMakeMaterial);
delete g_curGenesisMakeMaterial;
g_curGenesisMakeMaterial = 0;
@ -1597,7 +1597,7 @@ yyreduce:
/* Line 1455 of yacc.c */
#line 87 "GenesisShaderBison.ycc"
{//n_printf("init PropertySection\n");
{//n_debuglog("init PropertySection\n");
}
break;
@ -1605,7 +1605,7 @@ yyreduce:
/* Line 1455 of yacc.c */
#line 89 "GenesisShaderBison.ycc"
{//n_printf("in ParameterSection,left\n");
{//n_debuglog("in ParameterSection,left\n");
}
break;
@ -1613,7 +1613,7 @@ yyreduce:
/* Line 1455 of yacc.c */
#line 91 "GenesisShaderBison.ycc"
{//n_printf("from ParameterSection to PropertySection\n");
{//n_debuglog("from ParameterSection to PropertySection\n");
}
break;
@ -1621,7 +1621,7 @@ yyreduce:
/* Line 1455 of yacc.c */
#line 93 "GenesisShaderBison.ycc"
{ //n_printf("out ParameterSection,right\n");
{ //n_debuglog("out ParameterSection,right\n");
}
break;
@ -1630,7 +1630,7 @@ yyreduce:
/* Line 1455 of yacc.c */
#line 95 "GenesisShaderBison.ycc"
{ g_curGenesisMakeMaterial->SetRenderQueue(Graphic::RenderQueue::FromString((yyvsp[(3) - (3)].str)));
//n_printf("in PropertySection,setrenderqueue:%s\n", Util::String($3).AsCharPtr());
//n_debuglog("in PropertySection,setrenderqueue:%s\n", Util::String($3).AsCharPtr());
}
break;
@ -1638,7 +1638,7 @@ yyreduce:
/* Line 1455 of yacc.c */
#line 98 "GenesisShaderBison.ycc"
{ //n_printf("in TechniqueSection,left\n");
{ //n_debuglog("in TechniqueSection,left\n");
g_curGenesisMakeTechnique = new GenesisMakeTechnique();
}
break;
@ -1647,7 +1647,7 @@ yyreduce:
/* Line 1455 of yacc.c */
#line 101 "GenesisShaderBison.ycc"
{//n_printf("from TechniqueSection to PropertySection\n");
{//n_debuglog("from TechniqueSection to PropertySection\n");
}
break;
@ -1655,7 +1655,7 @@ yyreduce:
/* Line 1455 of yacc.c */
#line 103 "GenesisShaderBison.ycc"
{ //n_printf("in TechniqueSection,left\n");
{ //n_debuglog("in TechniqueSection,left\n");
g_curGenesisMakeTechnique = new GenesisMakeTechnique();
g_curGenesisMakeTechnique->SetName((yyvsp[(3) - (4)].str));
}
@ -1665,7 +1665,7 @@ yyreduce:
/* Line 1455 of yacc.c */
#line 107 "GenesisShaderBison.ycc"
{//n_printf("from TechniqueSection to PropertySection\n");
{//n_debuglog("from TechniqueSection to PropertySection\n");
}
break;
@ -1673,7 +1673,7 @@ yyreduce:
/* Line 1455 of yacc.c */
#line 109 "GenesisShaderBison.ycc"
{//n_printf("init ParameterSection\n");
{//n_debuglog("init ParameterSection\n");
}
break;
@ -1705,7 +1705,13 @@ yyreduce:
g_curMatParam->SetName((yyvsp[(3) - (5)].str));
g_curMatParam->SetDesc((yyvsp[(3) - (5)].str));
g_curMatParam->SetStringValue((yyvsp[(5) - (5)].str));
//n_printf("define texture\n");
if ( g_curMatParam->GetStringValue() == "#UserDefTex")
{
g_curMatParam->SetHiddenInEditor(true);
}
//n_debuglog("define texture\n");
g_curGenesisMakeMaterial->AddMatParam(g_curMatParam);
g_curMatParam = NULL;
@ -1755,7 +1761,13 @@ yyreduce:
g_curMatParam->SetName((yyvsp[(3) - (6)].str));
g_curMatParam->SetDesc((yyvsp[(4) - (6)].str));
g_curMatParam->SetStringValue((yyvsp[(6) - (6)].str));
//n_printf("define texture\n");
if ( g_curMatParam->GetStringValue() == "#UserDefTex")
{
g_curMatParam->SetHiddenInEditor(true);
}
//n_debuglog("define texture\n");
g_curGenesisMakeMaterial->AddMatParam(g_curMatParam);
g_curMatParam = NULL;
@ -1813,6 +1825,18 @@ yyreduce:
g_curMatParam->SetName((yyvsp[(3) - (6)].str));
g_curMatParam->SetDesc((yyvsp[(4) - (6)].str));
g_curMatParam->SetStringValue((yyvsp[(6) - (6)].str));
if (
Util::String::MatchPattern(g_curMatParam->GetName(), "*Color*")
|| Util::String::MatchPattern(g_curMatParam->GetName(), "*color*")
|| Util::String::MatchPattern(g_curMatParam->GetName(), "*emissive*")
|| Util::String::MatchPattern(g_curMatParam->GetName(), "*specular*")
|| Util::String::MatchPattern(g_curMatParam->GetName(), "*diffuse*")
)
{
g_curMatParam->SetUseForColor(true);
}
g_curGenesisMakeMaterial->AddMatParam(g_curMatParam);
g_curMatParam = NULL;
@ -1828,6 +1852,17 @@ yyreduce:
g_curMatParam->SetDesc((yyvsp[(3) - (5)].str));
g_curMatParam->SetStringValue((yyvsp[(5) - (5)].str));
if (
Util::String::MatchPattern(g_curMatParam->GetName(), "*Color*")
|| Util::String::MatchPattern(g_curMatParam->GetName(), "*color*")
|| Util::String::MatchPattern(g_curMatParam->GetName(), "*emissive*")
|| Util::String::MatchPattern(g_curMatParam->GetName(), "*specular*")
|| Util::String::MatchPattern(g_curMatParam->GetName(), "*diffuse*")
)
{
g_curMatParam->SetUseForColor(true);
}
g_curGenesisMakeMaterial->AddMatParam(g_curMatParam);
g_curMatParam = NULL;
}
@ -1865,7 +1900,7 @@ yyreduce:
/* Line 1455 of yacc.c */
#line 248 "GenesisShaderBison.ycc"
{ //n_printf("init TechniqueSection\n");
{ //n_debuglog("init TechniqueSection\n");
}
break;
@ -1873,7 +1908,7 @@ yyreduce:
/* Line 1455 of yacc.c */
#line 250 "GenesisShaderBison.ycc"
{ //n_printf("from PassSection to TechniqueSection\n");
{ //n_debuglog("from PassSection to TechniqueSection\n");
}
break;
@ -1881,7 +1916,7 @@ yyreduce:
/* Line 1455 of yacc.c */
#line 252 "GenesisShaderBison.ycc"
{ //n_printf("out TechniqueSection,right\n");
{ //n_debuglog("out TechniqueSection,right\n");
g_curGenesisMakeMaterial->AddTechnique(*g_curGenesisMakeTechnique);
delete g_curGenesisMakeTechnique;
g_curGenesisMakeTechnique = 0;
@ -1892,7 +1927,7 @@ yyreduce:
/* Line 1455 of yacc.c */
#line 258 "GenesisShaderBison.ycc"
{ //n_printf("init PassSection\n");
{ //n_debuglog("init PassSection\n");
}
break;
@ -1909,7 +1944,7 @@ yyreduce:
/* Line 1455 of yacc.c */
#line 263 "GenesisShaderBison.ycc"
{ //n_printf("init Pass\n");
{ //n_debuglog("init Pass\n");
}
break;
@ -1917,7 +1952,7 @@ yyreduce:
/* Line 1455 of yacc.c */
#line 265 "GenesisShaderBison.ycc"
{ //n_printf("in PassSection,left\n");
{ //n_debuglog("in PassSection,left\n");
}
break;
@ -1926,7 +1961,7 @@ yyreduce:
/* Line 1455 of yacc.c */
#line 268 "GenesisShaderBison.ycc"
{ //n_printf("from codeSection to PassSection\n");
{ //n_debuglog("from codeSection to PassSection\n");
}
break;
@ -1935,7 +1970,7 @@ yyreduce:
/* Line 1455 of yacc.c */
#line 270 "GenesisShaderBison.ycc"
{
//n_printf("out PassSection,right\n");
//n_debuglog("out PassSection,right\n");
g_curGenesisMakeTechnique->AddPass(*g_curMakePass);
delete g_curMakePass;
g_curMakePass = 0;
@ -1947,7 +1982,7 @@ yyreduce:
/* Line 1455 of yacc.c */
#line 277 "GenesisShaderBison.ycc"
{
n_printf("in PassSection,left\n");
n_debuglog("in PassSection,left\n");
g_curMakePass = new GenesisMakePass();
g_curMakePass->SetName("NoName");
}
@ -1958,7 +1993,7 @@ yyreduce:
/* Line 1455 of yacc.c */
#line 282 "GenesisShaderBison.ycc"
{
n_printf("in PassSection,left\n");
n_debuglog("in PassSection,left\n");
g_curMakePass = new GenesisMakePass();
g_curMakePass->SetName((yyvsp[(2) - (2)].str));
}
@ -1968,7 +2003,7 @@ yyreduce:
/* Line 1455 of yacc.c */
#line 288 "GenesisShaderBison.ycc"
{ //n_printf("in codeSection\n");
{ //n_debuglog("in codeSection\n");
}
break;
@ -1976,7 +2011,7 @@ yyreduce:
/* Line 1455 of yacc.c */
#line 290 "GenesisShaderBison.ycc"
{ //n_printf("from shadertype,to StateSection\n");
{ //n_debuglog("from shadertype,to StateSection\n");
}
break;
@ -1984,7 +2019,7 @@ yyreduce:
/* Line 1455 of yacc.c */
#line 292 "GenesisShaderBison.ycc"
{ //n_printf("from shadertype,to shadertype\n");
{ //n_debuglog("from shadertype,to shadertype\n");
}
break;
@ -1994,7 +2029,7 @@ yyreduce:
#line 294 "GenesisShaderBison.ycc"
{
g_curMakePass->SetBuiltInMacro((yyvsp[(4) - (5)].str));
n_printf("set builtinMacro\n");
n_debuglog("set builtinMacro\n");
}
break;
@ -2004,7 +2039,7 @@ yyreduce:
#line 298 "GenesisShaderBison.ycc"
{
g_curMakePass->SetCustumMacro((yyvsp[(4) - (5)].str));
n_printf("set builtinMacro\n");
n_debuglog("set builtinMacro\n");
}
break;
@ -2012,7 +2047,7 @@ yyreduce:
/* Line 1455 of yacc.c */
#line 303 "GenesisShaderBison.ycc"
{ //n_printf("in StateSection\n");
{ //n_debuglog("in StateSection\n");
}
break;
@ -2023,7 +2058,7 @@ yyreduce:
{
g_rsDesc = RenderBase::RenderStateDesc::Create();
g_rsDesc->Setup();
//n_printf("Create StateSection\n");//n_printf("init StateSection\n");
//n_debuglog("Create StateSection\n");//n_debuglog("init StateSection\n");
}
break;
@ -2041,7 +2076,7 @@ yyreduce:
{
g_curMakePass->SetRenderStateDesc(g_rsDesc);
g_rsDesc = 0;
//n_printf("from RenderStateSetup,to shadertype\n");
//n_debuglog("from RenderStateSetup,to shadertype\n");
}
break;
@ -2049,7 +2084,7 @@ yyreduce:
/* Line 1455 of yacc.c */
#line 317 "GenesisShaderBison.ycc"
{ //n_printf("in RenderStateSetup\n");
{ //n_debuglog("in RenderStateSetup\n");
}
break;
@ -2090,7 +2125,7 @@ yyreduce:
/* Line 1455 of yacc.c */
#line 334 "GenesisShaderBison.ycc"
{ //n_printf("set depthtest complete \n");
{ //n_debuglog("set depthtest complete \n");
}
break;
@ -2109,7 +2144,7 @@ yyreduce:
/* Line 1455 of yacc.c */
#line 341 "GenesisShaderBison.ycc"
{ //n_printf("set blendmode complete \n");
{ //n_debuglog("set blendmode complete \n");
}
break;
@ -2117,7 +2152,7 @@ yyreduce:
/* Line 1455 of yacc.c */
#line 343 "GenesisShaderBison.ycc"
{ //n_printf("set alphatest complete \n");
{ //n_debuglog("set alphatest complete \n");
}
break;
@ -2125,7 +2160,7 @@ yyreduce:
/* Line 1455 of yacc.c */
#line 345 "GenesisShaderBison.ycc"
{ //n_printf("set samplerstate complete \n");
{ //n_debuglog("set samplerstate complete \n");
}
break;
@ -2242,7 +2277,7 @@ yyreduce:
{
g_curGenesisMakeGPUProgram = new GenesisMakeGPUProgram();
g_curGenesisMakeGPUProgram->SetShaderType((yyvsp[(2) - (2)].str));
//n_printf("in shaderType,SetShaderType\n");
//n_debuglog("in shaderType,SetShaderType\n");
delete[] (yyvsp[(2) - (2)].str);
}
break;
@ -2251,7 +2286,7 @@ yyreduce:
/* Line 1455 of yacc.c */
#line 415 "GenesisShaderBison.ycc"
{ //n_printf("in shaderType,left\n");
{ //n_debuglog("in shaderType,left\n");
}
break;
@ -2259,7 +2294,7 @@ yyreduce:
/* Line 1455 of yacc.c */
#line 417 "GenesisShaderBison.ycc"
{ //n_printf("from DeviceTypeSetup to shaderType\n");
{ //n_debuglog("from DeviceTypeSetup to shaderType\n");
}
break;
@ -2273,7 +2308,7 @@ yyreduce:
delete g_curGenesisMakeGPUProgram;
g_curGenesisMakeGPUProgram = NULL;
}
//n_printf("out shaderType,right\n");
//n_debuglog("out shaderType,right\n");
}
break;
@ -2281,7 +2316,7 @@ yyreduce:
/* Line 1455 of yacc.c */
#line 428 "GenesisShaderBison.ycc"
{ n_printf("in DeviceTypeSetup\n");}
{ n_debuglog("in DeviceTypeSetup\n");}
break;
case 66:
@ -2290,7 +2325,7 @@ yyreduce:
#line 429 "GenesisShaderBison.ycc"
{
g_curGenesisMakeGPUProgram->SetDeviceType((yyvsp[(3) - (3)].str));
n_printf("in DeviceTypeSetup\n");
n_debuglog("in DeviceTypeSetup\n");
delete[] (yyvsp[(3) - (3)].str);
}
break;
@ -2299,7 +2334,7 @@ yyreduce:
/* Line 1455 of yacc.c */
#line 434 "GenesisShaderBison.ycc"
{ n_printf("in DeviceTypeSetup,left\n");
{ n_debuglog("in DeviceTypeSetup,left\n");
}
break;
@ -2307,7 +2342,7 @@ yyreduce:
/* Line 1455 of yacc.c */
#line 436 "GenesisShaderBison.ycc"
{ n_printf("from SubGPUProgramSetup to DeviceTypeSetup\n");
{ n_debuglog("from SubGPUProgramSetup to DeviceTypeSetup\n");
}
break;
@ -2315,7 +2350,7 @@ yyreduce:
/* Line 1455 of yacc.c */
#line 438 "GenesisShaderBison.ycc"
{ n_printf("out DeviceTypeSetup,right\n");
{ n_debuglog("out DeviceTypeSetup,right\n");
g_curMakePass->AddShaderProgram(*g_curGenesisMakeGPUProgram);
}
break;
@ -2324,14 +2359,14 @@ yyreduce:
/* Line 1455 of yacc.c */
#line 441 "GenesisShaderBison.ycc"
{ n_printf("in empty SubGPUProgramSetup\n");}
{ n_debuglog("in empty SubGPUProgramSetup\n");}
break;
case 71:
/* Line 1455 of yacc.c */
#line 442 "GenesisShaderBison.ycc"
{ n_printf("in SubGPUProgramSetup\n");
{ n_debuglog("in SubGPUProgramSetup\n");
}
break;
@ -2339,7 +2374,7 @@ yyreduce:
/* Line 1455 of yacc.c */
#line 444 "GenesisShaderBison.ycc"
{ n_printf("in SubGPUProgramSetup,left\n");
{ n_debuglog("in SubGPUProgramSetup,left\n");
g_curGenesisSubGPUProgram = new GenesisSubGPUProgram();
g_curGenesisSubGPUProgram->SetShaderMask((yyvsp[(3) - (5)].str));
}
@ -2349,7 +2384,7 @@ yyreduce:
/* Line 1455 of yacc.c */
#line 448 "GenesisShaderBison.ycc"
{ n_printf("from CodeBlock to SubGPUProgramSetup\n");
{ n_debuglog("from CodeBlock to SubGPUProgramSetup\n");
}
break;
@ -2357,7 +2392,7 @@ yyreduce:
/* Line 1455 of yacc.c */
#line 450 "GenesisShaderBison.ycc"
{ n_printf("out SubGPUProgramSetup,right\n");
{ n_debuglog("out SubGPUProgramSetup,right\n");
g_curGenesisMakeGPUProgram->AddSubGpuProgram(*g_curGenesisSubGPUProgram);
if(g_curGenesisSubGPUProgram != NULL)
{
@ -2371,7 +2406,7 @@ yyreduce:
/* Line 1455 of yacc.c */
#line 459 "GenesisShaderBison.ycc"
{ n_printf("in CodeBlock\n");
{ n_debuglog("in CodeBlock\n");
}
break;
@ -2381,7 +2416,7 @@ yyreduce:
#line 461 "GenesisShaderBison.ycc"
{
g_curGenesisSubGPUProgram->SetShaderCode((yyvsp[(3) - (3)].str));
n_printf("in CodeBlock,AddGPUProgram\n");
n_debuglog("in CodeBlock,AddGPUProgram\n");
delete[] (yyvsp[(3) - (3)].str);
}
break;
@ -2395,7 +2430,7 @@ yyreduce:
g_curShaderParameter->SetRegister((yyvsp[(3) - (5)].num));
g_curShaderParameter->SetName((yyvsp[(4) - (5)].str));
g_curGenesisSubGPUProgram->AddParam(*g_curShaderParameter);
n_printf("bind texture\n"); delete[] (yyvsp[(4) - (5)].str);
n_debuglog("bind texture\n"); delete[] (yyvsp[(4) - (5)].str);
delete g_curShaderParameter;
g_curShaderParameter = 0;
}
@ -2410,7 +2445,7 @@ yyreduce:
g_curShaderParameter->SetRegister((yyvsp[(3) - (5)].num));
g_curShaderParameter->SetName((yyvsp[(4) - (5)].str));
g_curGenesisSubGPUProgram->AddParam(*g_curShaderParameter);
//n_printf("setparam matrix register\n"); delete[] $4;
//n_debuglog("setparam matrix register\n"); delete[] $4;
delete g_curShaderParameter;
g_curShaderParameter = 0;
}
@ -2425,7 +2460,7 @@ yyreduce:
g_curShaderParameter->SetRegister((yyvsp[(3) - (5)].num));
g_curShaderParameter->SetName((yyvsp[(4) - (5)].str));
g_curGenesisSubGPUProgram->AddParam(*g_curShaderParameter);
//n_printf("setparam vector register\n"); delete[] $4;
//n_debuglog("setparam vector register\n"); delete[] $4;
delete g_curShaderParameter;
g_curShaderParameter = 0;
}
@ -2440,7 +2475,7 @@ yyreduce:
g_curShaderParameter->SetRegister((yyvsp[(3) - (5)].num));
g_curShaderParameter->SetName((yyvsp[(4) - (5)].str));
g_curGenesisSubGPUProgram->AddParam(*g_curShaderParameter);
//n_printf("setparam float register\n"); delete[] $4;
//n_debuglog("setparam float register\n"); delete[] $4;
delete g_curShaderParameter;
g_curShaderParameter = 0;
}
@ -2666,7 +2701,7 @@ yyreturn:
int yyerror (const char *s)
{
n_printf("GenesisShader Error: %s At line:%d\n",s,Genesislineno);
n_debuglog("GenesisShader Error: %s At line:%d\n",s,Genesislineno);
return 0;
}

View File

@ -132,6 +132,11 @@ ParameterSection:/* empty */ {//n_printf("init ParameterSection\n");
g_curMatParam->SetName($3);
g_curMatParam->SetDesc($3);
g_curMatParam->SetStringValue($5);
if ( g_curMatParam->GetStringValue() == "#UserDefTex")
{
g_curMatParam->SetHiddenInEditor(true);
}
//n_printf("define texture\n");
g_curGenesisMakeMaterial->AddMatParam(g_curMatParam);
g_curMatParam = NULL;
@ -176,6 +181,12 @@ ParameterSection:/* empty */ {//n_printf("init ParameterSection\n");
g_curMatParam->SetName($3);
g_curMatParam->SetDesc($4);
g_curMatParam->SetStringValue($6);
if ( g_curMatParam->GetStringValue() == "#UserDefTex")
{
g_curMatParam->SetHiddenInEditor(true);
}
//n_printf("define texture\n");
g_curGenesisMakeMaterial->AddMatParam(g_curMatParam);
g_curMatParam = NULL;
@ -216,6 +227,18 @@ ParameterSection:/* empty */ {//n_printf("init ParameterSection\n");
g_curMatParam->SetName($3);
g_curMatParam->SetDesc($4);
g_curMatParam->SetStringValue($6);
if (
Util::String::MatchPattern(g_curMatParam->GetName(), "*Color*")
|| Util::String::MatchPattern(g_curMatParam->GetName(), "*color*")
|| Util::String::MatchPattern(g_curMatParam->GetName(), "*emissive*")
|| Util::String::MatchPattern(g_curMatParam->GetName(), "*specular*")
|| Util::String::MatchPattern(g_curMatParam->GetName(), "*diffuse*")
)
{
g_curMatParam->SetUseForColor(true);
}
g_curGenesisMakeMaterial->AddMatParam(g_curMatParam);
g_curMatParam = NULL;
@ -224,6 +247,17 @@ ParameterSection:/* empty */ {//n_printf("init ParameterSection\n");
g_curMatParam->SetName($3);
g_curMatParam->SetDesc($3);
g_curMatParam->SetStringValue($5);
if (
Util::String::MatchPattern(g_curMatParam->GetName(), "*Color*")
|| Util::String::MatchPattern(g_curMatParam->GetName(), "*color*")
|| Util::String::MatchPattern(g_curMatParam->GetName(), "*emissive*")
|| Util::String::MatchPattern(g_curMatParam->GetName(), "*specular*")
|| Util::String::MatchPattern(g_curMatParam->GetName(), "*diffuse*")
)
{
g_curMatParam->SetUseForColor(true);
}
g_curGenesisMakeMaterial->AddMatParam(g_curMatParam);
g_curMatParam = NULL;

View File

@ -130,7 +130,7 @@ namespace MyGUI
virtual void updateDropItems();
virtual void updateDropItemsState(const DDWidgetState& _state);
void mouseDrag(MouseButton _id);
bool mouseDrag(MouseButton _id);// expand by genesis-3d
void mouseButtonReleased(MouseButton _id);
void mouseButtonPressed(MouseButton _id);

View File

@ -282,7 +282,8 @@ namespace MyGUI
void notifyMouseDrag(Widget* _sender, int _left, int _top, MouseButton _id);
void notifyMouseButtonDoubleClick(Widget* _sender);
void notifyScrollChangePosition(ScrollBar* _sender, size_t _position);
void notifyScrollChangePosition(ScrollBar* _sender, int _position);// expand by genesis-3d
void notifyMouseWheel(Widget* _sender, int _rel);
// обновление представления

View File

@ -143,6 +143,7 @@ namespace MyGUI
/*internal:*/
void _resetMouseFocusWidget();
void _forceChangeMouseFocus(Widget* _focusNew, int _absx, int _absy, int _absz);// expand by genesis-3d
private:
// удаляем данный виджет из всех возможных мест
@ -158,6 +159,8 @@ namespace MyGUI
// сбрасывает клавишу повторения
void resetKey();
bool changeMouseFocus(Widget* item, Widget* old_mouse_focus, int _absx, int _absy, int _absz);// expand by genesis-3d
private:
// виджеты которым принадлежит фокус
Widget* mWidgetMouseFocus;

View File

@ -47,6 +47,20 @@ namespace MyGUI
public:
ItemBox();
//------------------------------------------------------------------------------//
// expand by genesis-3d
/** Show VScroll when text size larger than EditBox */
void setVScrollVisible(bool _value);
/** Get Show VScroll flag */
bool isVScrollVisible() const;
/** Show HScroll when text size larger than EditBox */
void setHScrollVisible(bool _value);
/** Get Show HScroll flag */
bool isHScrollVisible() const;
//------------------------------------------------------------------------------//
//------------------------------------------------------------------------------//
// манипуляции айтемами
@ -202,6 +216,10 @@ namespace MyGUI
virtual void _resetContainer(bool _update);
protected:
virtual void onClientDragBegin(Widget* _sender, int _left, int _top, MouseButton _id);// expand by genesis-3d
virtual void onClientDragEnd(Widget* _sender);// expand by genesis-3d
virtual void onClientDrag(Widget* _sender, int _left, int _top, MouseButton _id);// expand by genesis-3d
virtual void initialiseOverride();
virtual void shutdownOverride();
@ -223,7 +241,7 @@ namespace MyGUI
void notifyKeyButtonPressed(Widget* _sender, KeyCode _key, Char _char);
void notifyKeyButtonReleased(Widget* _sender, KeyCode _key);
void notifyScrollChangePosition(ScrollBar* _sender, size_t _index);
void notifyScrollChangePosition(ScrollBar* _sender, int _index);// expand by genesis-3d
void notifyMouseWheel(Widget* _sender, int _rel);
void notifyRootMouseChangeFocus(Widget* _sender, bool _focus);
void notifyMouseButtonDoubleClick(Widget* _sender);
@ -263,7 +281,28 @@ namespace MyGUI
private:
size_t calcIndexByWidget(Widget* _widget);
// -------------------------------------------------------------------------
// expand by genesis-3d
float defualtSpeed() const;
void notifyScrollBarPress(Widget* _sender, int _left, int _top, MouseButton _id);// expand by genesis-3d
void pushContentPosition();
bool headEmpty() const;
bool tailEmpty() const;
void checkScrollState();
void scrollStop();
void scrollOverflow(float time);
void scrollForceOverflow(float time);
void scrollInertia(float time);
void notifyTick(float time);
void preDrag();
int dragOperator(int _current, int _length, int _sizeItem);
int getStartIndex() const;
void updateContentPosition(const IntPoint& _point);
void testSpeed();
void resetCounter();
void dragMove(float move);
void finalSpeed();
// -------------------------------------------------------------------------
void requestItemSize();
virtual IntSize getContentSize();
@ -318,6 +357,20 @@ namespace MyGUI
Widget* mItemDrag;
IntPoint mPointDragOffset;
float mPreCoord;// expand by genesis-3d
int mPreMouse;// expand by genesis-3d
float mTimeCounter;// expand by genesis-3d
float mMoveCounter;// expand by genesis-3d
float mScrollSpeed;// expand by genesis-3d
enum
{
ScrollStop,
ScrollOverflow,
ScrollForceOverflow,
ScrollInertia,
} mScrollState;// expand by genesis-3d
bool mAlignVert;

View File

@ -259,7 +259,7 @@ namespace MyGUI
void onMouseWheel(int _rel);
void onKeyButtonPressed(KeyCode _key, Char _char);
void notifyScrollChangePosition(ScrollBar* _sender, size_t _rel);
void notifyScrollChangePosition(ScrollBar* _sender, int _rel);// expand by genesis-3d
void notifyMousePressed(Widget* _sender, int _left, int _top, MouseButton _id);
void notifyMouseDoubleClick(Widget* _sender);
void notifyMouseWheel(Widget* _sender, int _rel);

View File

@ -28,7 +28,8 @@
namespace MyGUI
{
typedef delegates::CMultiDelegate2<ScrollBar*, size_t> EventHandle_ScrollBarPtrSizeT;
//typedef delegates::CMultiDelegate2<ScrollBar*, size_t> EventHandle_ScrollBarPtrSizeT; old code
typedef delegates::CMultiDelegate2<ScrollBar*, int> EventHandle_ScrollBarPtrSizeT;// expand by genesis-3d
class MYGUI_EXPORT ScrollBar :
public Widget,
@ -49,10 +50,10 @@ namespace MyGUI
/** Get scroll range */
size_t getScrollRange() const;
/** Set scroll position (value from 0 to range - 1) */
void setScrollPosition(size_t _value);
/** Get scroll position (value from 0 to range - 1) */
size_t getScrollPosition() const;
void setScrollPosition(int _value, bool _force = false);// expand by genesis-3d
int getScrollPosition() const;
/** Set scroll page
@param _value Tracker step when buttons pressed
@ -105,6 +106,12 @@ namespace MyGUI
/** @copydoc Widget::setCoord(int _left, int _top, int _width, int _height) */
void setCoord(int _left, int _top, int _width, int _height);
// expand by genesis-3d -------------------------------------------
void setLimitRange(bool _value);
bool getLimitRange() const;
// ----------------------------------------------------------------
/*events:*/
/** Event : scroll tracker position changed.\n
signature : void method(MyGUI::ScrollBar* _sender, size_t _position)\n
@ -118,8 +125,9 @@ namespace MyGUI
virtual void initialiseOverride();
virtual void shutdownOverride();
void updatePreActionOffset();// expand by genesis-3d
void updateTrack();
void TrackMove(int _left, int _top);
void TrackMove(int _left, int _top);// expand by genesis-3d
virtual void onMouseWheel(int _rel);
@ -148,15 +156,19 @@ namespace MyGUI
size_t mSkinRangeStart;
size_t mSkinRangeEnd;
size_t mScrollRange;
size_t mScrollPosition;
size_t mScrollPage; // на сколько перещелкивать, при щелчке на кнопке
size_t mScrollViewPage; // на сколько перещелкивать, при щелчке по полосе
int mScrollRange;
//size_t mScrollPosition; old
int mScrollPosition;
int mScrollPage; // на сколько перещелкивать, при щелчке на кнопке
int mScrollViewPage; // на сколько перещелкивать, при щелчке по полосе
int mMinTrackSize;
bool mMoveToClick;
bool mVerticalAlignment;
bool mLimitRange;// expand by genesis-3d
};
} // namespace MyGUI

View File

@ -90,7 +90,7 @@ namespace MyGUI
void notifyMousePressed(Widget* _sender, int _left, int _top, MouseButton _id);
void notifyMouseReleased(Widget* _sender, int _left, int _top, MouseButton _id);
void notifyScrollChangePosition(ScrollBar* _sender, size_t _position);
void notifyScrollChangePosition(ScrollBar* _sender, int _position);// expand by genesis-3d
void notifyMouseWheel(Widget* _sender, int _rel);
void updateView();

View File

@ -54,8 +54,18 @@ namespace MyGUI
virtual Align getContentAlign();
virtual void eraseContent();
protected:
void bindDrag();// expand by genesis-3d
bool dragClent(int _left, int _top, MouseButton _id);// expand by genesis-3d
bool isDraging() const;// expand by genesis-3d
void notifyClentPress(Widget* _sender, int _left, int _top, MouseButton _id);// expand by genesis-3d
void notifyClentRelease(Widget* _sender, int _left, int _top, MouseButton _id);// expand by genesis-3d
void notifyClentDrag(Widget* _sender, int _left, int _top, MouseButton _id);// expand by genesis-3d
void notifyClentLostFocus(Widget* _sender, Widget* _newFocus);// expand by genesis-3d
virtual void onClientDragBegin(Widget* _sender, int _left, int _top, MouseButton _id);// expand by genesis-3d
virtual void onClientDragEnd(Widget* _sender);// expand by genesis-3d
virtual void onClientDrag(Widget* _sender, int _left, int _top, MouseButton _id);// expand by genesis-3d
ScrollBar* mVScroll;
ScrollBar* mHScroll;
Widget* mClient;
@ -66,6 +76,9 @@ namespace MyGUI
size_t mVRange;
size_t mHRange;
// expand by genesis-3d
bool mDraging;
//----------------------------
// изменяется ли содержимое при ресайзе
bool mChangeContentByResize;
};

View File

@ -298,7 +298,18 @@ namespace MyGUI
void Canvas::_setUVSet(const FloatRect& _rect)
{
if (nullptr != getSubWidgetMain())
getSubWidgetMain()->_setUVSet(_rect);
{
if (VertexColourType::ColourABGR == RenderManager::getInstancePtr()->getVertexFormat())
{
FloatRect glrect(_rect.left, 1.0f - _rect.top, _rect.right, 1.0f - _rect.bottom);
getSubWidgetMain()->_setUVSet(glrect);
}
else
{
getSubWidgetMain()->_setUVSet(_rect);
}
}
}
bool Canvas::isLocked() const

View File

@ -94,10 +94,10 @@ namespace MyGUI
}
}
void DDContainer::mouseDrag(MouseButton _id)
bool DDContainer::mouseDrag(MouseButton _id)// expand by genesis-3d
{
if (MouseButton::Left != _id)
return;
return false;// expand by genesis-3d
// нужно ли обновить данные
bool update = false;
@ -121,14 +121,17 @@ namespace MyGUI
else
{
// сбрасываем фокус мыши (не обязательно)
InputManager::getInstance().resetMouseCaptureWidget();
// expand by genesis-3d
// reset or not logic move to item box
//InputManager::getInstance().resetMouseCaptureWidget();
}
}
// дроп не нужен
if (!mNeedDrop)
{
return;
return false;// expand by genesis-3d
}
// делаем запрос, над кем наша мыша
@ -138,7 +141,8 @@ namespace MyGUI
updateDropItems();
// если равно, значит уже спрашивали
if (mOldDrop == item) return;
if (mOldDrop == item)
return true;// expand by genesis-3d
mOldDrop = item;
// сбрасываем старую подсветку
@ -209,6 +213,7 @@ namespace MyGUI
updateDropItemsState(data);
eventChangeDDState(this, state);
return true;// expand by genesis-3d
}
void DDContainer::endDrop(bool _reset)

View File

@ -1628,8 +1628,12 @@ namespace MyGUI
return Base::getTextSize();
}
void EditBox::notifyScrollChangePosition(ScrollBar* _sender, size_t _position)
void EditBox::notifyScrollChangePosition(ScrollBar* _sender, int _position)// expand by genesis-3d
{
if (_position < 0)// expand by genesis-3d
{
_position = 0;
}
if (mClientText == nullptr)
return;

View File

@ -151,6 +151,11 @@ namespace MyGUI
return isFocus;
}
return changeMouseFocus(item, old_mouse_focus, _absx, _absy, _absz);
}
bool InputManager::changeMouseFocus(Widget* item, Widget* old_mouse_focus, int _absx, int _absy, int _absz)
{
if (item)
{
// поднимаемся до рута
@ -474,6 +479,11 @@ namespace MyGUI
}
}
void InputManager::_forceChangeMouseFocus(Widget* _focusNew, int _absx, int _absy, int _absz)
{
changeMouseFocus(_focusNew, mWidgetMouseFocus, _absx, _absy, _absz);
}
// удаляем данный виджет из всех возможных мест
void InputManager::_unlinkWidget(Widget* _widget)
{

View File

@ -31,6 +31,16 @@
namespace MyGUI
{
static const float gDragBias = 3.0f;
static const float gCriticalForceOverflow = 0.1f;
static const float gSpeedTime = 0.1f;
static const float gSpeedDown = 0.25f;
static const float gOverflowTime = 0.2f;
static const float gDefualSpeedWeight = 0.5f;
static const float gTinyTime = 0.001f;
static const float gCriticalSpeed = 2.0f;
static const float gSpeedLerpWeight = 0.8f;
ItemBox::ItemBox() :
mCountItemInLine(0),
@ -43,7 +53,12 @@ namespace MyGUI
mIndexRefuse(ITEM_NONE),
mIsFocus(false),
mItemDrag(nullptr),
mAlignVert(true)
mAlignVert(true),
mPreCoord(0.0f),
mTimeCounter(0.0f),
mScrollSpeed(0.0f),
mMoveCounter(0.0f),
mScrollState(ScrollStop)
{
mChangeContentByResize = true;
}
@ -83,23 +98,40 @@ namespace MyGUI
// подписываем клиент для драгэндропа
if (mClient != nullptr)
{
mClient->_setContainer(this);
}
requestItemSize();
updateScrollSize();
updateScrollPosition();
// expand by genesis-3d
Gui::getInstancePtr()->eventFrameStart += newDelegate(this, &ItemBox::notifyTick);
bindDrag();
if (mHScroll != nullptr)
{
mHScroll->setLimitRange(true);
mHScroll->eventMouseButtonPressed += newDelegate(this, & ItemBox::notifyScrollBarPress);
}
if (mVScroll != nullptr)
{
mVScroll->setLimitRange(true);
mVScroll->eventMouseButtonPressed += newDelegate(this, & ItemBox::notifyScrollBarPress);
}
}
void ItemBox::shutdownOverride()
{
Gui::getInstancePtr()->eventFrameStart -= newDelegate(this, &ItemBox::notifyTick);// expand by genesis-3d
mVScroll = nullptr;
mHScroll = nullptr;
mClient = nullptr;
Base::shutdownOverride();
}
void ItemBox::setPosition(const IntPoint& _point)
{
Base::setPosition(_point);
@ -151,24 +183,41 @@ namespace MyGUI
count_visible = (_getClientWidget()->getWidth() / mSizeItem.width) + 2;
}
size_t start = (mFirstVisibleIndex * mCountItemInLine);
size_t count = (count_visible * mCountItemInLine) + start;
int start = getStartIndex();
int count = (count_visible * mCountItemInLine) + (mFirstVisibleIndex * mCountItemInLine);//start;
size_t index = 0;
for (size_t pos = start; pos < count; ++pos, ++index)
int bias = 0;// expand by genesis-3d
if (mFirstVisibleIndex < 0)// expand by genesis-3d
{
if (mAlignVert)
{
bias = -mFirstVisibleIndex * mSizeItem.height;
}
else
{
bias = -mFirstVisibleIndex * mSizeItem.width;
}
start = 0;
}
int index = 0;
for (int pos = start; pos < count; ++pos, ++index)
{
// дальше нет айтемов
if (pos >= mItemsInfo.size()) break;
if (pos >= (int)mItemsInfo.size())
{
break;
}
Widget* item = getItemWidget(index);
if (mAlignVert)
{
item->setPosition(((int)index % mCountItemInLine) * mSizeItem.width - mContentPosition.left,
(((int)index / mCountItemInLine) * mSizeItem.height) - mFirstOffsetIndex);
(((int)index / mCountItemInLine) * mSizeItem.height) - mFirstOffsetIndex + bias);
}
else
{
item->setPosition((((int)index / mCountItemInLine) * mSizeItem.width) - mFirstOffsetIndex,
item->setPosition((((int)index / mCountItemInLine) * mSizeItem.width) - mFirstOffsetIndex + bias,
((int)index % mCountItemInLine) * mSizeItem.height - mContentPosition.top);
}
@ -184,7 +233,7 @@ namespace MyGUI
}
// все виджеты еще есть, то их надо бы скрыть
while (index < mVectorItems.size())
while (index < (int)mVectorItems.size())
{
mVectorItems[index]->setVisible(false);
index ++;
@ -251,7 +300,7 @@ namespace MyGUI
// сбрасываем старую подсветку
if (mIndexActive != ITEM_NONE)
{
size_t start = (size_t)(mFirstVisibleIndex * mCountItemInLine);
size_t start = (size_t)getStartIndex();
size_t index = mIndexActive;
mIndexActive = ITEM_NONE;
@ -319,7 +368,7 @@ namespace MyGUI
mIndexAccept = (_set && _accept ) ? _index : ITEM_NONE;
mIndexRefuse = (_set && !_accept) ? _index : ITEM_NONE;
size_t start = (size_t)(mFirstVisibleIndex * mCountItemInLine);
size_t start = (size_t)getStartIndex();
if ((_index >= start) && (_index < (start + mVectorItems.size())))
{
IBDrawItemInfo data(_index, mIndexSelect, mIndexActive, mIndexAccept, mIndexRefuse, false, false);
@ -332,7 +381,7 @@ namespace MyGUI
MYGUI_ASSERT_RANGE(_index, mItemsInfo.size(), "ItemBox::setItemData");
mItemsInfo[_index].data = _data;
size_t start = (size_t)(mFirstVisibleIndex * mCountItemInLine);
size_t start = (size_t)getStartIndex();
if ((_index >= start) && (_index < (start + mVectorItems.size())))
{
IBDrawItemInfo data(_index, mIndexSelect, mIndexActive, mIndexAccept, mIndexRefuse, true, false);
@ -421,7 +470,7 @@ namespace MyGUI
{
MYGUI_ASSERT_RANGE(_index, mItemsInfo.size(), "ItemBox::redrawItemAt");
size_t start = (size_t)(mFirstVisibleIndex * mCountItemInLine);
size_t start = (size_t)getStartIndex();
if ((_index >= start) && (_index < (start + mVectorItems.size())))
{
IBDrawItemInfo data(_index, mIndexSelect, mIndexActive, mIndexAccept, mIndexRefuse, true, false);
@ -434,7 +483,7 @@ namespace MyGUI
MYGUI_ASSERT_RANGE_AND_NONE(_index, mItemsInfo.size(), "ItemBox::setIndexSelected");
if (_index == mIndexSelect) return;
size_t start = (size_t)(mFirstVisibleIndex * mCountItemInLine);
size_t start = (size_t)getStartIndex();
// сбрасываем старое выделение
if (mIndexSelect != ITEM_NONE)
@ -604,14 +653,25 @@ namespace MyGUI
void ItemBox::notifyMouseDrag(Widget* _sender, int _left, int _top, MouseButton _id)
{
mouseDrag(_id);
// expand by genesis-3d
if(mouseDrag(_id))
{
}
else if (dragClent(_left, _top, _id))
{
}
else
{
InputManager::getInstance().resetMouseCaptureWidget();
}
}
void ItemBox::notifyMouseButtonPressed(Widget* _sender, int _left, int _top, MouseButton _id)
{
mouseButtonPressed(_id);
if ( MouseButton::Left == _id)
DDContainer::mouseButtonPressed(_id);
scrollStop();
if ( MouseButton::Left == _id)
{
size_t old = mIndexSelect;
@ -645,6 +705,11 @@ namespace MyGUI
{
bool needEvent = !mStartDrop;
mouseButtonReleased(_id);
if (!isDraging())
{
preDrag();
checkScrollState();
}
if (needEvent)
eventNotifyItem(this, IBNotifyItemData(getIndexByWidget(_sender), IBNotifyItemData::MouseReleased, _left, _top, _id));
@ -652,6 +717,11 @@ namespace MyGUI
void ItemBox::notifyRootMouseChangeFocus(Widget* _sender, bool _focus)
{
if (isDraging())
{
return;
}
size_t index = calcIndexByWidget(_sender);
if (_focus)
{
@ -660,10 +730,15 @@ namespace MyGUI
// сбрасываем старый
if (mIndexActive != ITEM_NONE)
{
size_t old_index = mIndexActive;
int old_index = (int)mIndexActive;
mIndexActive = ITEM_NONE;
IBDrawItemInfo data(old_index, mIndexSelect, mIndexActive, mIndexAccept, mIndexRefuse, false, false);
requestDrawItem(this, mVectorItems[old_index - (mFirstVisibleIndex * mCountItemInLine)], data);
int index = old_index - getStartIndex();// expand by genesis-3d
if (0 <= index && index < (int)mVectorItems.size())
{
requestDrawItem(this, mVectorItems[old_index - getStartIndex()], data);
}
}
mIndexActive = index;
@ -714,7 +789,7 @@ namespace MyGUI
}
}
void ItemBox::notifyScrollChangePosition(ScrollBar* _sender, size_t _index)
void ItemBox::notifyScrollChangePosition(ScrollBar* _sender, int _index)
{
if (_sender == mVScroll)
{
@ -730,6 +805,15 @@ namespace MyGUI
void ItemBox::notifyMouseWheel(Widget* _sender, int _rel)
{
if (mDraging)// expand by genesis-3d
{
return;
}
if (ScrollStop != mScrollState)// expand by genesis-3d
{
scrollStop();
}
if (mAlignVert)
{
if (mContentSize.height <= 0) return;
@ -787,7 +871,455 @@ namespace MyGUI
if (nullptr != mHScroll) mHScroll->setScrollPosition(mContentPosition.left);
}
void ItemBox::setContentPosition(const IntPoint& _point)
//------------------------------------------------------------------------------//
// expand by genesis-3d
void ItemBox::setVScrollVisible(bool _value)
{
mVisibleVScroll = _value;
updateScrollSize();
updateScrollPosition();
}
int ItemBox::getStartIndex() const
{
if (mFirstVisibleIndex > 0)
{
return mFirstVisibleIndex * mCountItemInLine;
}
else
{
return 0;
}
}
void ItemBox::setHScrollVisible(bool _value)
{
mVisibleHScroll = _value;
updateScrollSize();
updateScrollPosition();
}
bool ItemBox::isVScrollVisible() const
{
return mVisibleVScroll;
}
bool ItemBox::isHScrollVisible() const
{
return mVisibleHScroll;
}
inline float __lerp(float x, float y, float scale)
{
return x + (y - x) * scale;
}
inline float __abs(float x)
{
if (x < 0)
{
return -x;
}
return x;
}
inline float __dragLerp(float overflow, float length, float preCoord, float currentCoord)
{
float scale = overflow / (float)length;
if (scale >= 1.0f)
{
return preCoord;
}
return __lerp(currentCoord, preCoord, scale);
}
float ItemBox::defualtSpeed() const
{
float len = mAlignVert ? (float)mSizeItem.height : (float)mSizeItem.width;
return len * gDefualSpeedWeight;
}
bool ItemBox::headEmpty() const
{
return (mPreCoord < 0.0f);
}
bool ItemBox::tailEmpty() const
{
float sizeItem = mAlignVert ? (float)mSizeItem.height : (float)mSizeItem.width;
float clientSize = mAlignVert ? (float)mClient->getHeight() : (float)mClient->getWidth();
float button = clientSize - (sizeItem * mCountLines - mPreCoord);
return (button > 0.0f); //button empty.
}
int ItemBox::dragOperator(int _current, int _length, int _sizeItem)
{
float bias = (float)(_current - mPreMouse); // mouse move.
if (bias > gDragBias || gDragBias < -bias)
{
resetCurrentActiveItem();
}
float out = mPreCoord - bias; // new content pos.
if (out < 0.0f)// headEmpty.
{
if (bias > 0.0f)
{
out = __dragLerp(-out, (float)_length, mPreCoord, out);
}
}
else
{
float button = _length - (_sizeItem * mCountLines - out);
if (button > 0.0f) //tailEmpty.
{
if (bias < 0.0f)
{
out = __dragLerp(button, (float)_length, mPreCoord, out);
}
}
}
dragMove(out - mPreCoord);
mPreCoord = out;
mPreMouse = _current;
return (int)out;
}
void ItemBox::onClientDragBegin(Widget* _sender, int _left, int _top, MouseButton _id)
{
preDrag();
ScrollViewBase::onClientDragBegin(_sender, _left, _top, _id);
}
void ItemBox::onClientDragEnd(Widget* _sender)
{
checkScrollState();
ScrollViewBase::onClientDragEnd(_sender);
}
void ItemBox::onClientDrag(Widget* _sender, int _left, int _top, MouseButton _id)
{
if (MouseButton::Left == _id)
{
if (mAlignVert)
{
mContentPosition.top = dragOperator(_top, mClient->getHeight(), mSizeItem.height);
}
else
{
mContentPosition.left = dragOperator(_left, mClient->getWidth(), mSizeItem.width);
}
updateContentPosition(mContentPosition);
if (nullptr != mVScroll) mVScroll->setScrollPosition(mContentPosition.top, true);
if (nullptr != mHScroll) mHScroll->setScrollPosition(mContentPosition.left, true);
}
}
void ItemBox::notifyScrollBarPress(Widget* _sender, int _left, int _top, MouseButton _id)
{
if (ScrollInertia == mScrollState && _id == MouseButton::Left)
{
scrollStop();
}
}
void ItemBox::pushContentPosition()
{
if (mAlignVert)
{
mContentPosition.top = (int)mPreCoord;
}
else
{
mContentPosition.left = (int)mPreCoord;
}
updateContentPosition(mContentPosition);
if (nullptr != mVScroll) mVScroll->setScrollPosition(mContentPosition.top, true);
if (nullptr != mHScroll) mHScroll->setScrollPosition(mContentPosition.left, true);
}
void ItemBox::finalSpeed()
{
if (mTimeCounter > gSpeedTime)
{
testSpeed();
}
else if (mTimeCounter > gTinyTime)
{
float speed = mMoveCounter / gSpeedTime;
float mini = speed * gSpeedLerpWeight;
mScrollSpeed = __lerp(mScrollSpeed, speed, gSpeedLerpWeight * (mTimeCounter / gSpeedTime));
if (__abs(mScrollSpeed) < __abs(mini))
{
mScrollSpeed = mini;
}
}
else
{
resetCounter();
}
}
void ItemBox::resetCounter()
{
mTimeCounter = 0.0f;
mMoveCounter = 0.0f;
}
void ItemBox::testSpeed()
{
float speed = mMoveCounter / gSpeedTime;
mScrollSpeed = __lerp(mScrollSpeed, speed, gSpeedLerpWeight);
resetCounter();
}
void ItemBox::dragMove(float move)
{
mMoveCounter += move;
}
void ItemBox::checkScrollState()
{
finalSpeed();
resetCounter();
if (headEmpty())
{
mScrollState = ScrollOverflow;
}
else
{
if (tailEmpty())
{
mScrollState = ScrollOverflow;
}
else
{
float defualt_speed = defualtSpeed();
if (-defualt_speed < mScrollSpeed && mScrollSpeed < defualt_speed)
{
mScrollState = ScrollStop;
mScrollSpeed = 0.0f;
}
else
{
mScrollState = ScrollInertia;
}
}
}
}
void ItemBox::preDrag()
{
const IntPoint& point = InputManager::getInstance().getLastPressedPosition(MouseButton::Left);
if (mAlignVert)
{
mPreCoord = (float)mContentPosition.top;
mPreMouse = point.top;
}
else
{
mPreCoord = (float)mContentPosition.left;
mPreMouse = point.left;
}
scrollStop();
}
void ItemBox::scrollStop()
{
resetCounter();
mScrollSpeed = 0.0f;
mScrollState = ScrollStop;
}
void ItemBox::scrollOverflow(float time)
{
mTimeCounter += time;
if (headEmpty())
{
if (mTimeCounter < gOverflowTime)
{
float coord = mPreCoord;
mPreCoord = __lerp(mPreCoord, 0, mTimeCounter / gOverflowTime);
pushContentPosition();
mPreCoord = coord;
}
else
{
mPreCoord = 0;
pushContentPosition();
scrollStop();
}
}
else
{
float sizeItem = mAlignVert ? (float)mSizeItem.height : (float)mSizeItem.width;
float clientSize = mAlignVert ? (float)mClient->getHeight() : (float)mClient->getWidth();
float head = (sizeItem * mCountLines) - clientSize;
if (head < 0.0f)
{
head = 0.0f;
}
if (mTimeCounter < gOverflowTime)
{
float coord = mPreCoord;
mPreCoord = __lerp(mPreCoord, head, mTimeCounter / gOverflowTime);
pushContentPosition();
mPreCoord = coord;
}
else
{
mPreCoord = head;
pushContentPosition();
scrollStop();
}
}
}
void ItemBox::scrollForceOverflow(float time)
{
mTimeCounter += time;
if (mTimeCounter > gOverflowTime)
{
time = gOverflowTime - (mTimeCounter - time);
mPreCoord += mScrollSpeed * time;
resetCounter();
mScrollState = ScrollOverflow;
}
else
{
mPreCoord += mScrollSpeed * time;
float clientSize = mAlignVert ? (float)mClient->getHeight() : (float)mClient->getWidth();
float limit = clientSize * gCriticalForceOverflow;
if (mPreCoord < -limit)
{
mPreCoord = -limit;
resetCounter();
mScrollState = ScrollOverflow;
}
else
{
float sizeItem = mAlignVert ? (float)mSizeItem.height : (float)mSizeItem.width;
float head = (sizeItem * mCountLines) - clientSize;
if (mPreCoord - head > limit)
{
mPreCoord = head + limit;
}
}
}
pushContentPosition();
}
void ItemBox::scrollInertia(float time)
{
float weight = 1.0f - mTimeCounter * gSpeedDown;
if (weight > 0.0f)
{
float speed = mScrollSpeed * weight;
if (-gCriticalSpeed < speed && speed < gCriticalSpeed)
{
scrollStop();
}
else
{
mTimeCounter += time;
mPreCoord += speed * time;
pushContentPosition();
if (headEmpty())
{
mScrollState = ScrollForceOverflow;
mScrollSpeed = speed;
resetCounter();
}
else if (tailEmpty())
{
mScrollState = ScrollForceOverflow;
mScrollSpeed = speed;
resetCounter();
}
}
}
}
void ItemBox::notifyTick(float time)
{
if (isDraging())
{
mTimeCounter += time;
if (mTimeCounter > gSpeedTime)
{
testSpeed();
}
}
else
{
switch(mScrollState)
{
case ScrollInertia:
{
scrollInertia(time);
break;
}
case ScrollForceOverflow:
{
scrollForceOverflow(time);
break;
}
case ScrollOverflow:
{
scrollOverflow(time);
break;
}
default:
break;
}
}
}
inline int _offset_check(int a, int b)
{
if (a < 0)
{
int t = (-a) % b;
return b - t;
}
else
{
return a % b;
}
}
inline int _index_check(int a, int b)
{
if (a < 0)
{
return (int)(a / (float)b) - 1;
}
else
{
return a / b;
}
}
//------------------------------------------------------------------------------//
void ItemBox::updateContentPosition(const IntPoint& _point)
{
mContentPosition = _point;
@ -795,19 +1327,24 @@ namespace MyGUI
if (mAlignVert)
{
mFirstVisibleIndex = mContentPosition.top / mSizeItem.height;
mFirstOffsetIndex = mContentPosition.top % mSizeItem.height;
mFirstVisibleIndex = _index_check(mContentPosition.top , mSizeItem.height); // expand by genesis-3d
mFirstOffsetIndex = _offset_check(mContentPosition.top , mSizeItem.height); // expand by genesis-3d
}
else
{
mFirstVisibleIndex = mContentPosition.left / mSizeItem.width;
mFirstOffsetIndex = mContentPosition.left % mSizeItem.width;
mFirstVisibleIndex = _index_check(mContentPosition.left , mSizeItem.width); // expand by genesis-3d
mFirstOffsetIndex = _offset_check(mContentPosition.left , mSizeItem.width); // expand by genesis-3d
}
_updateAllVisible(old != mFirstVisibleIndex);
_resetContainer(true);
}
void ItemBox::setContentPosition(const IntPoint& _point)
{
updateContentPosition(_point);
}
void ItemBox::redrawAllItems()
{
_updateAllVisible(true);
@ -820,7 +1357,7 @@ namespace MyGUI
size_t ItemBox::calcIndexByWidget(Widget* _widget)
{
return *_widget->_getInternalData<size_t>() + (mFirstVisibleIndex * mCountItemInLine);
return *_widget->_getInternalData<size_t>() + getStartIndex();
}
IntSize ItemBox::getContentSize()
@ -922,6 +1459,14 @@ namespace MyGUI
{
if (_key == "VerticalAlignment")
setVerticalAlignment(utility::parseValue<bool>(_value));
else if (_key == "HScrollVisible")
{
setHScrollVisible(utility::parseValue<bool>(_value));
}
else if (_key == "VScrollVisible")
{
setVScrollVisible(utility::parseValue<bool>(_value));
}
else
{
Base::setPropertyOverride(_key, _value);

View File

@ -238,8 +238,12 @@ namespace MyGUI
_resetContainer(true);
}
void ListBox::notifyScrollChangePosition(ScrollBar* _sender, size_t _position)
void ListBox::notifyScrollChangePosition(ScrollBar* _sender, int _position)// expand by genesis-3d
{
if (_position < 0)// expand by genesis-3d
{
_position = 0;
}
_setScrollView(_position);
_sendEventChangeScroll(_position);
}

View File

@ -45,7 +45,8 @@ namespace MyGUI
mScrollViewPage(0),
mMinTrackSize(0),
mMoveToClick(false),
mVerticalAlignment(true)
mVerticalAlignment(true),
mLimitRange(true)
{
}
@ -147,7 +148,13 @@ namespace MyGUI
mWidgetTrack->setVisible(true);
// и обновляем позицию
pos = (int)(((size_t)(pos - getTrackSize()) * mScrollPosition) / (mScrollRange - 1) + mSkinRangeStart);
//pos = (int)(((size_t)(pos - getTrackSize()) * mScrollPosition) / (mScrollRange - 1) + mSkinRangeStart); old code
// expand by genesis-3d
int bias = (pos - getTrackSize()) * mScrollPosition;
int result = (int)(bias / (float)(mScrollRange - 1));
pos = result + mSkinRangeStart;
// ---------------------------------------------------------------------------------
mWidgetTrack->setPosition(mWidgetTrack->getLeft(), pos);
if (nullptr != mWidgetFirstPart)
@ -179,7 +186,13 @@ namespace MyGUI
mWidgetTrack->setVisible(true);
// и обновляем позицию
pos = (int)(((size_t)(pos - getTrackSize()) * mScrollPosition) / (mScrollRange - 1) + mSkinRangeStart);
//pos = (int)(((size_t)(pos - getTrackSize()) * mScrollPosition) / (mScrollRange - 1) + mSkinRangeStart); old code
// expand by genesis-3d
int bias = (pos - getTrackSize()) * mScrollPosition;
int result = (int)(bias / (float)(mScrollRange - 1));
pos = result + mSkinRangeStart;
// ---------------------------------------------------------------------------------
mWidgetTrack->setPosition(pos, mWidgetTrack->getTop());
if (nullptr != mWidgetFirstPart)
@ -196,7 +209,27 @@ namespace MyGUI
}
}
void ScrollBar::TrackMove(int _left, int _top)
void ScrollBar::updatePreActionOffset()
{
mPreActionOffset.left = mWidgetTrack->getLeft();
mPreActionOffset.top = mWidgetTrack->getTop();
}
void ScrollBar::setLimitRange(bool _value)
{
mLimitRange = _value;
}
bool ScrollBar::getLimitRange() const
{
return mLimitRange;
}
// ----------------------------------------------------------------------
void ScrollBar::TrackMove(int _left, int _top)// expand by genesis-3d
{
if (mWidgetTrack == nullptr)
return;
@ -206,11 +239,19 @@ namespace MyGUI
if (mVerticalAlignment)
{
// расчитываем позицию виджета
int start = mPreActionOffset.top + (_top - point.top);
if (start < (int)mSkinRangeStart)
start = (int)mSkinRangeStart;
else if (start > (getTrackPlaceLength() - (int)mSkinRangeEnd - mWidgetTrack->getHeight()))
start = (getTrackPlaceLength() - (int)mSkinRangeEnd - mWidgetTrack->getHeight());
//int start = mPreActionOffset.top + (_top - point.top); // old code.
// expand by genesis-3d
int bias = (_top - point.top);
int start = (mPreActionOffset.top + bias);
// -----------------------------------
if (mLimitRange)// expand by genesis-3d
{
if (start < (int)mSkinRangeStart)
start = (int)mSkinRangeStart;
else if (start > (getTrackPlaceLength() - (int)mSkinRangeEnd - mWidgetTrack->getHeight()))
start = (getTrackPlaceLength() - (int)mSkinRangeEnd - mWidgetTrack->getHeight());
}
if (mWidgetTrack->getTop() != start)
mWidgetTrack->setPosition(mWidgetTrack->getLeft(), start);
@ -221,23 +262,34 @@ namespace MyGUI
pos = pos * (int)(mScrollRange - 1) / (getLineSize() - getTrackSize());
// проверяем на выходы и изменения
if (pos < 0)
pos = 0;
else if (pos >= (int)mScrollRange)
pos = (int)mScrollRange - 1;
if (pos == (int)mScrollPosition)
return;
if (mLimitRange)// expand by genesis-3d
{
if (pos < 0)
pos = 0;
else if (pos >= (int)mScrollRange)
pos = (int)mScrollRange - 1;
if (pos == (int)mScrollPosition)
return;
}
mScrollPosition = pos;
}
else
{
// расчитываем позицию виджета
int start = mPreActionOffset.left + (_left - point.left);
if (start < (int)mSkinRangeStart)
start = (int)mSkinRangeStart;
else if (start > (getTrackPlaceLength() - (int)mSkinRangeEnd - mWidgetTrack->getWidth()))
start = (getTrackPlaceLength() - (int)mSkinRangeEnd - mWidgetTrack->getWidth());
//int start = mPreActionOffset.left + (_left - point.left);// old code.
// expand by genesis-3d
int bias = (_left - point.left);
int start = (mPreActionOffset.left + bias);
// -----------------------------------
if (mLimitRange)// expand by genesis-3d
{
if (start < (int)mSkinRangeStart)
start = (int)mSkinRangeStart;
else if (start > (getTrackPlaceLength() - (int)mSkinRangeEnd - mWidgetTrack->getWidth()))
start = (getTrackPlaceLength() - (int)mSkinRangeEnd - mWidgetTrack->getWidth());
}
if (mWidgetTrack->getLeft() != start)
mWidgetTrack->setPosition(IntPoint(start, mWidgetTrack->getTop()));
@ -248,12 +300,16 @@ namespace MyGUI
pos = pos * (int)(mScrollRange - 1) / (getLineSize() - getTrackSize());
// проверяем на выходы и изменения
if (pos < 0)
pos = 0;
else if (pos >= (int)mScrollRange)
pos = (int)mScrollRange - 1;
if (pos == (int)mScrollPosition)
return;
if (mLimitRange)// expand by genesis-3d
{
if (pos < 0)
pos = 0;
else if (pos >= (int)mScrollRange)
pos = (int)mScrollRange - 1;
if (pos == (int)mScrollPosition)
return;
}
mScrollPosition = pos;
}
@ -354,8 +410,7 @@ namespace MyGUI
}
else if (_sender == mWidgetTrack)
{
mPreActionOffset.left = _sender->getLeft();
mPreActionOffset.top = _sender->getTop();
updatePreActionOffset();// expand by genesis-3d
}
}
@ -380,13 +435,19 @@ namespace MyGUI
updateTrack();
}
void ScrollBar::setScrollPosition(size_t _position)
void ScrollBar::setScrollPosition(int _position, bool _force)
{
if (_position == mScrollPosition)
return;
if (mLimitRange && !_force)
{
if (_position < 0)
_position = 0;
if (_position >= mScrollRange)
_position = 0;
}
if (_position >= mScrollRange)
_position = 0;
mScrollPosition = _position;
updateTrack();
@ -500,7 +561,7 @@ namespace MyGUI
return mScrollRange;
}
size_t ScrollBar::getScrollPosition() const
int ScrollBar::getScrollPosition() const
{
return mScrollPosition;
}

View File

@ -103,8 +103,12 @@ namespace MyGUI
updateView();
}
void ScrollView::notifyScrollChangePosition(ScrollBar* _sender, size_t _position)
void ScrollView::notifyScrollChangePosition(ScrollBar* _sender, int _position)// expand by genesis-3d
{
if (_position < 0)// expand by genesis-3d
{
_position = 0;
}
if (mRealClient == nullptr)
return;

View File

@ -23,6 +23,7 @@
#include "MyGUI_Precompiled.h"
#include "MyGUI_ScrollViewBase.h"
#include "MyGUI_ScrollBar.h"
#include "MyGUI_InputManager.h"
namespace MyGUI
{
@ -35,7 +36,8 @@ namespace MyGUI
mVisibleVScroll(true),
mVRange(0),
mHRange(0),
mChangeContentByResize(false)
mChangeContentByResize(false),
mDraging(false)
{
}
@ -53,7 +55,8 @@ namespace MyGUI
IntSize viewSize = getViewSize();
// вертикальный контент не помещается
if (contentSize.height > viewSize.height)
//if (contentSize.height > viewSize.height) old code.
if (contentSize.height > viewSize.height && mVisibleVScroll) // expand by genesis-3d
{
if (mVScroll != nullptr)
{
@ -141,7 +144,8 @@ namespace MyGUI
// горизонтальный контент не помещается
if (contentSize.width > viewSize.width)
//if (contentSize.width > viewSize.width) old code.
if (contentSize.width > viewSize.width && mVisibleHScroll) // expand by genesis-3d
{
if (mHScroll != nullptr)
{
@ -364,4 +368,77 @@ namespace MyGUI
{
}
void ScrollViewBase::bindDrag()
{
if (mClient != nullptr)
{
mClient->eventMouseDrag += newDelegate(this, &ScrollViewBase::notifyClentDrag);
mClient->eventMouseButtonPressed += newDelegate(this, &ScrollViewBase::notifyClentPress);
mClient->eventMouseButtonReleased += newDelegate(this, &ScrollViewBase::notifyClentRelease);
mClient->eventMouseLostFocus += newDelegate(this, &ScrollViewBase::notifyClentLostFocus);
}
}
bool ScrollViewBase::dragClent(int _left, int _top, MouseButton _id)
{
if (MouseButton::Left == _id)
{
if (mClient)
{
InputManager::getInstancePtr()->_forceChangeMouseFocus(mClient, _left, _top, 0);
mClient->eventMouseButtonPressed(mClient, _left, _top, _id);
return true;
}
}
return false;
}
bool ScrollViewBase::isDraging() const
{
return mDraging;
}
void ScrollViewBase::notifyClentPress(Widget* _sender, int _left, int _top, MouseButton _id)
{
onClientDragBegin(_sender, _left, _top, _id);
}
void ScrollViewBase::notifyClentDrag(Widget* _sender, int _left, int _top, MouseButton _id)
{
onClientDrag(_sender, _left, _top, _id);
}
void ScrollViewBase::notifyClentLostFocus(Widget* _sender, Widget* _newFocus)
{
if (mDraging)
{
onClientDragEnd(_sender);
}
}
void ScrollViewBase::notifyClentRelease(Widget* _sender, int _left, int _top, MouseButton _id)
{
if (mDraging)
{
onClientDragEnd(_sender);
}
}
void ScrollViewBase::onClientDrag(Widget* _sender, int _left, int _top, MouseButton _id)
{
}
void ScrollViewBase::onClientDragBegin(Widget* _sender, int _left, int _top, MouseButton _id)
{
mDraging = true;
}
void ScrollViewBase::onClientDragEnd(Widget* _sender)
{
mDraging = false;
}
} // namespace MyGUI

View File

@ -66,16 +66,14 @@ namespace MyGUI
delete mInputManager;
}
void initialise( const std::string& _group, const std::string& _logName = MYGUI_PLATFORM_LOG_FILENAME)
void initialise(int bufferWidth, int bufferHeight, const std::string& _group, const std::string& _logName = MYGUI_PLATFORM_LOG_FILENAME)
{
assert(!mIsInitialise);
mIsInitialise = true;
mRenderManager->setResolution(0, 0);
mRenderManager->initialise(0, 0, bufferWidth, bufferHeight);
if (!_logName.empty())
LogManager::getInstance().createDefaultSource(_logName);
mRenderManager->initialise();
mDataManager->initialise(_group);
}

View File

@ -33,8 +33,11 @@ THE SOFTWARE.
#include "MyGUI_IVertexBuffer.h"
#include "MyGUI_RenderManager.h"
#include "graphicsystem/GraphicSystem.h"
#include "RenderSystem.h"
namespace Graphic
{
class Material;
}
namespace MyGUI
{
@ -48,7 +51,7 @@ namespace MyGUI
public:
GenesisRenderManager();
virtual ~GenesisRenderManager();
void initialise();
void initialise(int width, int height, int bufferWidth, int bufferHeight);
void shutdown();
static GenesisRenderManager& getInstance();
@ -89,20 +92,17 @@ namespace MyGUI
virtual bool checkTexture(ITexture* _texture);
#endif
void setResolution(int width, int height);//0 means auto.
void setResolution(const IntSize& size);//0 means auto.
void setResolution(int width, int height, int bufferWidth, int bufferHeight);//0 means auto.
const IntSize& getResolution() const;
bool autoResolutionWidth() const;
bool autoResolutionHeight() const;
void windowResized();
void windowResized(int w, int h);
void deviceReseted();
void windowResized(int bufferWidth, int bufferHeight);
void deviceReseted(int bufferWidth, int bufferHeight);
void renderGUI();
void renderGUI(float time);
bool getManualRender();
@ -116,7 +116,7 @@ namespace MyGUI
private:
void resetViewSize(int w, int h);
void resetViewSize(int bufferWidth, int bufferHeight);
void destroyAllResources();
void updateRenderInfo();
@ -140,7 +140,6 @@ namespace MyGUI
void _checkShader();
void _beforeDraw();
GPtr<Graphic::Material> m_shader;
//GPtr<RenderBase::RenderStateObject> m_renderState;
RenderBase::GPUProgramHandle* m_shaderHandle;
static Util::String s_resourcePath;

View File

@ -38,6 +38,11 @@ THE SOFTWARE.
#include "core/singleton.h"
#include "util/array.h"
namespace Resources
{
class TextureResInfo;
}
namespace MyGUI
{
@ -96,15 +101,13 @@ namespace MyGUI
size_t mNumElemBytes;
ITextureInvalidateListener* mListener;
typedef unsigned char Byte;
size_t m_width;
size_t m_height;
TextureBuffer m_texStream;
RenderBase::TextureHandle m_texHandle;
static Util::String s_resourcePath;
GPtr<Resources::TextureResInfo> m_texRes;
bool m_bManualCreate;
static Util::String s_resourcePath;
};
inline GenesisTexture::TextureBuffer& GenesisTexture::GetBuffer()
@ -112,11 +115,6 @@ namespace MyGUI
return m_texStream;
}
inline RenderBase::TextureHandle GenesisTexture::GetTextureHandle() const
{
return m_texHandle;
}
class GenesisTextureMgr : public Core::RefCounted
{

View File

@ -53,7 +53,7 @@ namespace MyGUI
public:
void AddVertexBuffer(GenesisVertexBuffer* const& pBuffer);
void RemoveVertexBuffer(GenesisVertexBuffer* const& pBuffer);
void ResetAllBuffers() const;
private:

View File

@ -28,6 +28,9 @@ THE SOFTWARE.
****************************************************************************/
#include "stdneb.h"
#include <cstring>
#include "graphicsystem/GraphicSystem.h"
#include "MyGUI_GenesisRTTexture.h"
#include "MyGUI_GenesisRenderManager.h"

View File

@ -27,18 +27,21 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#include "stdneb.h"
#include "graphicsystem/GraphicSystem.h"
#include "rendersystem/RenderSystem.h"
#include "materialmaker/parser/GenesisShaderParser.h"
#include "foundation/io/ioserver.h"
#include "MyGUI_GenesisDataManager.h"
#include "MyGUI_GenesisRenderManager.h"
#include "MyGUI_GenesisTexture.h"
#include "MyGUI_GenesisVertexBuffer.h"
#include "MyGUI_LogManager.h"
#include "MyGUI_GenesisDiagnostic.h"
#include "MyGUI_Timer.h"
#include "MyGUI_Gui.h"
#include "MyGUI_GenesisInput.h"
#include "materialmaker/parser/GenesisShaderParser.h"
#include "foundation/io/ioserver.h"
#include "MyGUI_GenesisVertexBufferManager.h"
#include "MyGUI_GenesisTexture.h"
@ -81,14 +84,14 @@ namespace MyGUI
m_shader = NULL;
}
void GenesisRenderManager::initialise()
void GenesisRenderManager::initialise(int width, int height, int bufferWidth, int bufferHeight)
{
mIsInitialise = true;
windowResized();
_checkShader();
m_VertexMgr = MyGUI::GenesisVertexBufferMgr::Create();
m_TextureMgr = MyGUI::GenesisTextureMgr::Create();
setResolution(width, height, bufferWidth, bufferHeight);
}
void GenesisRenderManager::shutdown()
@ -124,11 +127,11 @@ namespace MyGUI
delete _buffer;
}
void GenesisRenderManager::resetViewSize(int w, int h)
void GenesisRenderManager::resetViewSize(int bufferWidth, int bufferHeight)
{
if (0 == mResolutionConfig.width)
{
mCurrentResolution.width = w;
mCurrentResolution.width = bufferWidth;
}
else
{
@ -137,7 +140,7 @@ namespace MyGUI
if (0 == mResolutionConfig.height)
{
mCurrentResolution.height = h;
mCurrentResolution.height = bufferHeight;
}
else
{
@ -146,36 +149,22 @@ namespace MyGUI
GenesisInputManager::getInstancePtr()->_setScreenSize((float)mCurrentResolution.width, (float)mCurrentResolution.height);
}
void GenesisRenderManager::setResolution(int width, int height)
void GenesisRenderManager::setResolution(int width, int height, int bufferWidth, int bufferHeight)
{
mResolutionConfig.set(width, height);
windowResized();
windowResized(bufferWidth, bufferHeight);
}
void GenesisRenderManager::setResolution(const IntSize& size)
void GenesisRenderManager::windowResized(int bufferWidth, int bufferHeight)
{
mResolutionConfig = size;
windowResized();
}
void GenesisRenderManager::windowResized()
{
const RenderBase::DisplayMode& dm = GraphicSystem::Instance()->GetMainViewPortWindow()->GetDisplayMode();
resetViewSize(dm.GetWidth(), dm.GetHeight());
resetViewSize(bufferWidth, bufferHeight);
updateRenderInfo();
onResizeView(mCurrentResolution);
}
void GenesisRenderManager::windowResized(int w, int h)
void GenesisRenderManager::deviceReseted(int bufferWidth, int bufferHeigh)
{
resetViewSize(w, h);
updateRenderInfo();
onResizeView(mCurrentResolution);
}
void GenesisRenderManager::deviceReseted()
{
windowResized();
windowResized(bufferWidth, bufferHeigh);
m_VertexMgr->ResetAllBuffers();
m_TextureMgr->ReLoadManualTextures();
@ -327,20 +316,13 @@ namespace MyGUI
return mCountBatch;
}
void GenesisRenderManager::renderGUI()
void GenesisRenderManager::renderGUI(float time)
{
Gui* gui = Gui::getInstancePtr();
if (gui == nullptr || nullptr == m_shaderHandle)
return;
static Timer timer;
static unsigned long last_time = timer.getMilliseconds();
unsigned long now_time = timer.getMilliseconds();
unsigned long time = now_time - last_time;
onFrameEvent((float)((double)(time) / (double)1000));
last_time = now_time;
onFrameEvent(time);
_beforeDraw();

View File

@ -93,7 +93,7 @@ namespace MyGUI
: mName(_name)
, mGroup(_group)
, mRenderTarget(nullptr)
, m_texHandle(NULL)
, m_texRes(NULL)
, m_width(0)
, m_height(0)
, mNumElemBytes(0)
@ -130,25 +130,23 @@ namespace MyGUI
void GenesisTexture::destroy()
{
//[zhongdaohuan 2012/12/12] 如果这个texture是由render target创建的那么这个texture的句柄应该由render target类来管理。
//现在的terender target还不能由mygui自己创建所以所有render target都是源于mygui外部
//所以现在不会因mygui而引发内存泄漏问题如果以后mygui内部自己也可以创建render target那么这里的逻辑应该重新评估。
if (nullptr == mRenderTarget)
{
if (m_bManualCreate)
{
if (m_texHandle.IsValid())
if (m_texRes->GetHandle())
{
GraphicSystem::Instance()->RemoveTexture(m_texHandle);
m_texHandle = NULL;
GraphicSystem::Instance()->RemoveTexture(m_texRes->GetHandle());
m_texRes = NULL;
}
}
GenesisTextureMgr::Instance()->RemoveManualTexture(this);
}
m_texStream = NULL;
m_texRes = NULL;
mRenderTarget = nullptr;
m_bManualCreate = false;
mNumElemBytes = 0;
mOriginalFormat = PixelFormat::Unknow;
mOriginalUsage = TextureUsage::Default;
@ -358,14 +356,15 @@ namespace MyGUI
tex->SetStream( m_texStream.upcast<IO::Stream>() );
m_texStream->Close();
//m_texStream->SetAccessMode( IO::Stream::ReadAccess );
m_texHandle = Graphic::GraphicSystem::Instance()->CreateTexture(tex);
RenderBase::TextureHandle handle = Graphic::GraphicSystem::Instance()->CreateTexture(tex);
m_texRes = Resources::TextureResInfo::Create();
m_texRes->SetHandle(handle);
GenesisTextureMgr::Instance()->AddManualTexture(this);
m_bManualCreate = true;
}
else
{
m_texHandle = NULL;
m_texRes = NULL;
m_width = 0;
m_height = 0;
mOriginalUsage = TextureUsage::Default;
@ -499,10 +498,9 @@ namespace MyGUI
m_texStream = NULL;*/
GPtr<TextureResInfo> tri = Resources::ResourceManager::Instance()->CreateTextureInfo(url, 0);
m_texHandle = tri->GetHandle();
m_texRes = Resources::ResourceManager::Instance()->CreateTextureInfo(url, 0);
RenderBase::TEXTURE_DESC texDesc;
GraphicSystem::Instance()->GetTextureDesc(m_texHandle, texDesc);
GraphicSystem::Instance()->GetTextureDesc(m_texRes->GetHandle(), texDesc);
m_width = texDesc.width;
m_height = texDesc.height;
@ -518,15 +516,31 @@ namespace MyGUI
GenesisRTTexture* wjRt = static_cast<GenesisRTTexture*>(mRenderTarget);
const GPtr<Graphic::RenderToTexture>& rendetToTexture = wjRt->getRenderToTexture();
const GPtr<RenderBase::RenderTarget>& renderTarget = rendetToTexture->GetRenderTarget();
m_width = renderTarget->GetWidth();
m_height = renderTarget->GetHeight();
mOriginalUsage = TextureUsage::RenderTarget;
setFormat(FormatWjToMyGui(renderTarget->GetColorBufferFormat()));
m_texHandle = rendetToTexture->GetTextureHandle();
m_texRes = NULL;
m_bManualCreate = false;
}
RenderBase::TextureHandle GenesisTexture::GetTextureHandle() const
{
if (m_texRes.isvalid())
{
return m_texRes->GetHandle();
}
if (mRenderTarget)
{
GenesisRTTexture* wjRt = static_cast<GenesisRTTexture*>(mRenderTarget);
const GPtr<Graphic::RenderToTexture>& rendetToTexture = wjRt->getRenderToTexture();
return rendetToTexture->GetTextureHandle();
}
return NULL;
}
void GenesisTexture::setFormat(PixelFormat format)
{
mOriginalFormat = format;

View File

@ -49,6 +49,7 @@ namespace MyGUI
GenesisVertexBuffer::~GenesisVertexBuffer()
{
destroyVertexBuffer();
GenesisVertexBufferMgr::Instance()->RemoveVertexBuffer(this);
}
bool _createVertexComponent(Util::Array<RenderBase::VertexComponent>& vertexComponents)

View File

@ -55,6 +55,16 @@ namespace MyGUI
}
}
void GenesisVertexBufferMgr::RemoveVertexBuffer( GenesisVertexBuffer* const& pBuffer )
{
IndexT res = m_AllVertexBuffers.FindIndex(pBuffer);
if (res != InvalidIndex)
{
m_AllVertexBuffers.EraseIndex(res);
}
}
void GenesisVertexBufferMgr::ResetAllBuffers() const
{
SizeT nCount = m_AllVertexBuffers.Size();

View File

@ -42,6 +42,7 @@ namespace Particles
ColorAffector::ColorAffector(void) : ParticleAffector(),mMinAlpha(0.0f),mMaxAlpha(1.0f),mTimeAlpha(false)
, mColorCtlType(CCT_GRADCURVE)
{
mAffectType = AT_Color;
mMinMaxColorA.SetCurveState(Math::MinMaxCurve::Scalar);
mMinMaxColorR.SetCurveState(Math::MinMaxCurve::Scalar);
mMinMaxColorG.SetCurveState(Math::MinMaxCurve::Scalar);
@ -74,7 +75,7 @@ namespace Particles
return;
Math::Color32 clr;
float percent = (particle->mTotalTimeToLive - particle->mTimeToLive)/particle->mTotalTimeToLive;
float percent = particle->mTimeFraction;
float randomSid = Math::n_rand(0.0f,1.0f);
clr.r = Math::n_scalartoByte(mMinMaxColorR.Calculate(percent,randomSid));

View File

@ -38,7 +38,7 @@ namespace Particles
//-----------------------------------------------------------------------
GravityAffector::GravityAffector() : ParticleAffector()
{
mAffectType = AT_Gravity;
mName = "GravityAffector";
}
//-----------------------------------------------------------------------
@ -46,7 +46,7 @@ namespace Particles
{
if(!GetEnable())
return;
float percent = (particle->mTotalTimeToLive - particle->mTimeToLive)/particle->mTotalTimeToLive;
float percent = particle->mTimeFraction;
Math::float3 gravityDir(mMinMaxPosX.Calculate(percent,particle->mRandom0)
, mMinMaxPosY.Calculate(percent,particle->mRandom1)
@ -59,7 +59,7 @@ namespace Particles
float gravity = mMinMaxGravity.Calculate(percent,particle->mRandom3);
Math::scalar _curTime = (Math::scalar)mParentSystem->GetCurrentFrameTime();
particle->mDirection += gravity * gravityDir * _curTime * _calculateAffectSpecialisationFactor(particle);
particle->mDirection += gravity * gravityDir * _curTime;
}
//-------------------------------------------------------------------------------

View File

@ -37,6 +37,7 @@ namespace Particles
LimitAffector::LimitAffector(void) : ParticleAffector()
, mSeparateAxis(false)
{
mAffectType = AT_Limit;
mName = "LimitAffector";
mLimitX.SetScalar(0.0f);
mLimitY.SetScalar(0.0f);
@ -53,7 +54,7 @@ namespace Particles
if (particle)
{
float curTime = (particle->mTotalTimeToLive - particle->mTimeToLive)/particle->mTotalTimeToLive;
float curTime = particle->mTimeFraction;
//mAxisX
float limitX = mLimitX.Calculate(curTime,particle->mRandom0);

View File

@ -39,7 +39,7 @@ namespace Particles
, mSpaceCoord(SCT_LOCAL)
{
mName = "LinearForceAffector";
mAffectType = AT_INCREASE;
mAffectType = AT_Force;
}
//-----------------------------------------------------------------------
void LinearForceAffector::_preProcessParticles()
@ -54,8 +54,7 @@ namespace Particles
if (mTimeSinceLastUpdate >= mTimeStep)
{
float percent = (particle->mTotalTimeToLive - particle->mTimeToLive)/particle->mTotalTimeToLive;
float percent = particle->mTimeFraction;
Math::float3 forceVec(mForceVectorX.Calculate(percent,particle->mRandom0) ,
mForceVectorY.Calculate(percent,particle->mRandom1),
@ -63,7 +62,6 @@ namespace Particles
if ( mSpaceCoord == SCT_WORLD )
{
forceVec = forceVec.transformVector(Math::matrix44::inverse(mParentSystem->GetWorldMatrix()));
}
@ -106,6 +104,13 @@ namespace Particles
pMarcro->TurnOn(ShaderProgramCompiler::ShaderMarcro::m_sParticleForce);
}
//--------------------------------------------------------------------------------
const Math::float3 LinearForceAffector::_getEndPos(const Math::float3& pos,const Math::float3 speed,float time)
{
Math::float3 endPos;
endPos = pos + speed*time + 0.5*mShaderParam*time*time;
return endPos;
}
//--------------------------------------------------------------------------------
Math::MinMaxCurve* LinearForceAffector::getMinMaxCurve(ParticleCurveType pct)
{
switch(pct)

View File

@ -63,6 +63,8 @@ namespace Particles
void SetShaderParam();
void InitShaderParam();
void SetShaderMask(const GPtr<ShaderProgramCompiler::ShaderMarcro>& pMarcro);
inline const Math::float3& GetShaderParam() const;
const Math::float3 _getEndPos(const Math::float3& pos,const Math::float3 speed,float time);
protected:
Math::float3 mScaledVector;
ForceApplication mForceApplication;
@ -124,6 +126,11 @@ namespace Particles
{
mSpaceCoord = sct;
}
//--------------------------------------------------------------------------------
inline const Math::float3& LinearForceAffector::GetShaderParam() const
{
return mShaderParam;
}
}

View File

@ -36,6 +36,7 @@ namespace Particles
//-----------------------------------------------------------------------
MovementAffector::MovementAffector() : ParticleAffector()
{
mAffectType = AT_Movement;
mMinMaxSpeed.SetScalar( 1.0f );
mName = "MovementAffector";
}
@ -44,7 +45,7 @@ namespace Particles
{
if(!GetEnable())
return;
float percent = (particle->mTotalTimeToLive - particle->mTimeToLive)/particle->mTotalTimeToLive;
float percent = particle->mTimeFraction;
Math::float3 GravityPos(mMinMaxPosX.Calculate(percent,particle->mRandom0)
, mMinMaxPosY.Calculate(percent,particle->mRandom1)
@ -79,6 +80,19 @@ namespace Particles
pMarcro->TurnOn(ShaderProgramCompiler::ShaderMarcro::m_sParticleMovement);
}
//--------------------------------------------------------------------------------
const Math::float3 MovementAffector::_getEndPos(const Math::float3& pos,const Math::float3 speed,float time)
{
Math::float3 endPos = pos;
Math::float3 aimPos;
aimPos.setFromFloat4(mShaderParam);
Math::float3 dir = aimPos - pos;
dir.normalise();
dir *= mShaderParam.w();
endPos += dir*time;
return endPos;
}
//--------------------------------------------------------------------------------
Math::MinMaxCurve* MovementAffector::getMinMaxCurve(ParticleCurveType pct)
{
switch(pct)

View File

@ -43,6 +43,7 @@ namespace Particles
void SetShaderParam();
void InitShaderParam();
void SetShaderMask(const GPtr<ShaderProgramCompiler::ShaderMarcro>& pMarcro);
const Math::float3 _getEndPos(const Math::float3& pos,const Math::float3 speed,float time);
protected:
Math::MinMaxCurve mMinMaxSpeed;

View File

@ -37,7 +37,7 @@ namespace Particles
ScaleAffector::ScaleAffector(void) : ParticleAffector()
, mIsAxialScale(false)
{
mAffectType = AT_Scale;
mScaleX.SetScalar(1.0f);
mScaleY.SetScalar(1.0f);
mScaleZ.SetScalar(1.0f);
@ -50,7 +50,7 @@ namespace Particles
{
if( !GetEnable())
return;
float percent = (particle->mTotalTimeToLive - particle->mTimeToLive)/particle->mTotalTimeToLive;
float percent = particle->mTimeFraction;
Math::float3 particleSize(mScaleX.Calculate(percent,particle->mRandom0),
mScaleY.Calculate(percent,particle->mRandom1),

View File

@ -51,8 +51,20 @@ namespace Particles
mTexStart(0),
mTexEnd(1)
{
mAffectType = AT_Texture;
mName = "TextureAnimatorAffector";
mMinMaxTexAnimation.SetCurveState(Math::MinMaxCurve::Curve);
Util::Array<Math::float2> _list;
Util::Array<bool> _type;
_list.Append(Math::float2(0,0));
_type.Append(true);
_type.Append(true);
_list.Append(Math::float2(0.5,0.5));
_list.Append(Math::float2(0.5,0.5));
_list.Append(Math::float2(1,1));
_type.Append(true);
_type.Append(true);
mMinMaxTexAnimation.SetCurveFromArray(_list,_type);
}
//--------------------------------------------------------------------------------
void TextureAnimatorAffector::_onActivate(void)
@ -125,7 +137,7 @@ namespace Particles
if(!mEnable)
return;
float percent = (particle->mTotalTimeToLive - particle->mTimeToLive)/particle->mTotalTimeToLive;
float percent = particle->mTimeFraction;
float time = mCycles * percent;
float texCoordIndex = 0;

View File

@ -36,6 +36,7 @@ namespace Particles
//-----------------------------------------------------------------------
TextureRotatorAffector::TextureRotatorAffector(void) : ParticleAffector()
{
mAffectType = AT_Rotation;
mName = "TextureRotatorAffector";
}
//------------------------------------------------------------------------
@ -49,7 +50,7 @@ namespace Particles
if(!GetEnable())
return;
float percent = (particle->mTotalTimeToLive - particle->mTimeToLive)/particle->mTotalTimeToLive;
float percent = particle->mTimeFraction;
float rotatorAngularVelocity = mMinMaxRotation.Calculate(percent,particle->mRandom0);

View File

@ -38,6 +38,7 @@ namespace Particles
//-----------------------------------------------------------------------
VortexAffector::VortexAffector(void) : ParticleAffector()
{
mAffectType = AT_Vortex;
mName = "VortexAffector";
}
//------------------------------------------------------------------------
@ -49,7 +50,7 @@ namespace Particles
{
if(!GetEnable())
return;
float percent = (particle->mTotalTimeToLive - particle->mTimeToLive)/particle->mTotalTimeToLive;
float percent = particle->mTimeFraction;
Math::vector normal(mMinMaxNormalX.Calculate(percent,particle->mRandom0),
mMinMaxNormalY.Calculate(percent,particle->mRandom1),
mMinMaxNormalZ.Calculate(percent,particle->mRandom2) );

View File

@ -59,16 +59,15 @@ namespace Particles
mParentSystem->SetLoadEmitterMesh(false);
}
mMeshName = name;
#ifdef __GENESIS_EDITOR__ // edtior use
mRealMeshName = name;
#endif
mMeshRes = NULL;
mVertList.Clear();
}
//--------------------------------------------------------------------------------
void ModelEmitter::SetMeshRes(void* resource)
{
if (mParentSystem)
{
mParentSystem->SetLoadEmitterMesh(false);
}
mMeshRes = resource;
}
//-----------------------------------------------------------------------
@ -84,7 +83,9 @@ namespace Particles
if (mVertList.IsEmpty())
{
Resources::MeshRes* meshres = (Resources::MeshRes*)mMeshRes;
#ifdef __GENESIS_EDITOR__ // edtior use
mRealMeshName = meshres->GetResourceId().AsString();
#endif
const Resources::NormalData::value_type* normals = meshres->GetVertexData<Resources::NormalData>();
const Resources::PositionData::value_type* verteies = meshres->GetVertexData<Resources::PositionData>();

View File

@ -51,7 +51,11 @@ namespace Particles
void SetMeshEmitType(MeshEmitType);
MeshEmitType GetMeshEmitType(void) const;
#ifdef __GENESIS_EDITOR__ // edtior use
const Util::String& GetRealMeshName(void) const;
protected:
Util::String mRealMeshName;
#endif
protected:
Util::String mMeshName;
void* mMeshRes;
@ -59,6 +63,7 @@ namespace Particles
Util::Array<ParticleVertexData> mVertList;
public:
// @ISerialization::GetVersion. when change storage, must add SerializeSVersion count
virtual Serialization::SVersion GetVersion() const;
@ -94,7 +99,13 @@ namespace Particles
{
return mEmitType;
}
#ifdef __GENESIS_EDITOR__ // edtior use
//--------------------------------------------------------------------------------
inline const Util::String& ModelEmitter::GetRealMeshName(void) const
{
return mRealMeshName;
}
#endif
}
#endif

View File

@ -49,7 +49,7 @@ namespace Particles
Math::float3 mNormal;
Math::float2 mTexCoord;
};
struct SimpleGPUParticleVertex {
struct SpriteGPUParticleVertex {
Math::Color32 mColor;
Math::float3 mPosition;
Math::float3 mNormal;
@ -57,6 +57,14 @@ namespace Particles
float mSize;
};
struct BoardGPUParticleVertex {
Math::Color32 mColor;
Math::float4 mTangent;
Math::float3 mPosition;
Math::float3 mNormal;
Math::float2 mTexCoord;
};
enum ColorContrlType{CCT_CONST, CCT_RND_CONST, CCT_GRADCURVE, CCT_RND_GRADCURVE};
enum SpaceCoordType{SCT_LOCAL, SCT_WORLD, SCT_CAMERA};
@ -192,7 +200,7 @@ namespace Particles
inline IndexT GenerateRandomSeed(void* p)
{
return ( (IndexT)p ) & 0xFFFF;
return ( (intptr_t)p ) & 0xFFFF;
}
// From Ogre: rotation of a vector by a quaternion

View File

@ -36,7 +36,7 @@ namespace Particles
: mParentSystem(NULL)
, mIsActive(false)
, mName("Affector")
, mAffectType(ParticleAffector::AT_DEFAULT)
, mAffectType(ParticleAffector::UnKnown)
, mEnable(true)
{
@ -100,40 +100,6 @@ namespace Particles
{
particle->mPosition += (particle->mDirection * (Math::scalar)mParentSystem->GetCurrentFrameTime() );
}
//------------------------------------------------------------------------
Math::scalar ParticleAffector::_calculateAffectSpecialisationFactor (Particle* particle)
{
switch (mAffectType)
{
case AT_DEFAULT:
return 1.0f;
break;
case AT_INCREASE:
{
if(particle)
return particle->mTimeFraction;
else
return 1.0f;
}
break;
case AT_DECREASE:
{
if (particle)
{
return 1.0f - particle->mTimeFraction;
}
else
{
return 1.0f;
}
}
break;
default:
return 1.0f;
break;
}
}
//--------------------------------------------------------------------------------
Math::MinMaxCurve* ParticleAffector::getMinMaxCurve(ParticleCurveType pct)
{

View File

@ -38,9 +38,17 @@ namespace Particles
enum AffectType
{
AT_DEFAULT,
AT_INCREASE,
AT_DECREASE
AT_Color,
AT_Gravity,
AT_Limit,
AT_Force,
AT_Movement,
AT_Scale,
AT_Texture,
AT_Rotation,
AT_Vortex,
UnKnown
};
@ -90,10 +98,9 @@ namespace Particles
virtual void InitShaderParam();
virtual void SetShaderMask(const GPtr<ShaderProgramCompiler::ShaderMarcro>& pMarcro);
Math::scalar _calculateAffectSpecialisationFactor (Particle* particle);
virtual Math::MinMaxCurve* getMinMaxCurve(ParticleCurveType pct);
virtual void _switchParticleType(bool _isMobile);
virtual const Math::float3 _getEndPos(const Math::float3& pos,const Math::float3 speed,float time);
protected:
ParticleSystem* mParentSystem;
Util::String mName;
@ -185,6 +192,11 @@ namespace Particles
{
//empty
}
//------------------------------------------------------------------------
inline const Math::float3 ParticleAffector::_getEndPos(const Math::float3& pos,const Math::float3 speed,float time)
{
return pos;
}
}

View File

@ -48,6 +48,11 @@ namespace Particles
Load_2(obj,pReader);
return;
}
else if(3 == ver)
{
Load_3(obj,pReader);
return;
}
n_error(" %s Load unknown version.\n", obj->GetClassName().AsCharPtr() );
}
//------------------------------------------------------------------------
@ -59,7 +64,7 @@ namespace Particles
int specialisation;
pReader->SerializeInt( s_AffectSpecialisation , specialisation);
obj->SetAffectType((ParticleAffector::AffectType)specialisation);
//obj->SetAffectType((ParticleAffector::AffectType)specialisation);
}
void Load_2(ParticleAffector* obj, SerializeReader* pReader)
{
@ -68,12 +73,21 @@ namespace Particles
obj->SetEnable(active);
Load_1(obj,pReader);
}
void Load_3(ParticleAffector* obj, SerializeReader* pReader)
{
bool active;
pReader->SerializeBool(s_AffectorEnable,active);
obj->SetEnable(active);
Util::String name;
pReader->SerializeString( s_AffectorName, name );
obj->SetName( name );
}
//------------------------------------------------------------------------
void Save( const ParticleAffector* obj, SerializeWriter* pWriter )
{
pWriter->SerializeBool(s_AffectorEnable,obj->GetEnable());
pWriter->SerializeString( s_AffectorName, obj->GetName() );
pWriter->SerializeInt( s_AffectSpecialisation, (int)obj->GetAffectType());
}
};
@ -81,7 +95,7 @@ namespace Particles
// @ISerialization::GetVersion. when change storage, must add SerializeVersion count
SVersion ParticleAffector::GetVersion() const
{
return 2;
return 3;
}
//------------------------------------------------------------------------

View File

@ -111,6 +111,7 @@ namespace Particles
float GetGPUParticleRate(); //for gpu particles;
float GetGPUParticleLife();
void Reset();
private:
bool mShapeVisible;
public:
@ -332,6 +333,10 @@ namespace Particles
{
return mMinMaxLiveTime.Calculate(0,Math::n_rand(0.0f,1.0f));
}
inline void ParticleEmitter::Reset()
{
mRemainder = 0;
}
}
#endif // __particleemitter_H__

View File

@ -45,7 +45,7 @@ namespace Particles
const Timing::Time ParticleSystem::MinFrameTime(0.000001);
const float ParticleSystem::MinUpdateTime(0.033f);
const float ParticleSystem::MaxUpdateTime(0.33f);
const float ParticleSystem::UpdateFactor(0.5f);
const float ParticleSystem::UpdateFactor(0.002f);
//------------------------------------------------------------------------
ParticleSystem::ParticleSystem()
: mIsActive(false)
@ -199,9 +199,10 @@ namespace Particles
mNeedUpdate = false;
mUpdateTarget = true;
Timing::Time time = App::GameTime::Instance()->GetFrameTime();
double curFrame = GameTime::Instance()->GetTime();
if(mIsPlaying)
mMobileTime = curFrame;
{
mMobileTime += time;
}
Timing::Time total = time;
//====================================================================================
@ -212,7 +213,7 @@ namespace Particles
#endif
if(bNeedLimitRate)
{
_fpsControl();
//_fpsControl();
mCurrentTimeForFps += time;
if(mCurrentTimeForFps < mspf)
{
@ -306,7 +307,7 @@ namespace Particles
{
mIsPlaying = false;
mIsStop = true;
Reset();
}
@ -375,6 +376,7 @@ namespace Particles
mLastUpdateFrameIndex = -1;
ParticleSystemDataChanged();
_resetPool(mQuota);
mEmitter->Reset();
}
//------------------------------------------------------------------------
@ -865,7 +867,7 @@ namespace Particles
}
return delayTime;
}
void ParticleSystem::SetupGPUParticles(SimpleGPUParticleVertex* particleVertex,int quato)
void ParticleSystem::SetupSpriteGPUParticles(SpriteGPUParticleVertex* particleVertex,int quato)
{
float rate = mEmitter->GetGPUParticleRate();
float life = mEmitter->GetGPUParticleLife();
@ -877,6 +879,8 @@ namespace Particles
if(mIsPreLoop && mIsPlaying)
_time -= life;
Math::Color32 _color;
Math::bbox _box;
_box.begin_extend();
while (totalPar < quato)
{
mEmitter->_emit(particle,(float)mDuration*totalPar/quato);
@ -887,7 +891,80 @@ namespace Particles
particleVertex[totalPar].mTexCoord.set(_time,particle->mTotalTimeToLive);
_time += rateFps;
totalPar ++;
_box.extend(Math::point(
particle->mPosition.x(),particle->mPosition.y(),particle->mPosition.z()));
Math::float3 endPos;
endPos = _getEndPos(particle->mPosition,particle->mDirection,life);
_box.extend(Math::point(
endPos.x(),endPos.y(),endPos.z()));
}
_box.end_extend();
_box.pmax += Math::point(
particle->mSize.x()*0.5f,particle->mSize.y()*0.5f,particle->mSize.z()*0.5f);
_box.pmin -= Math::point(
particle->mSize.x()*0.5f,particle->mSize.y()*0.5f,particle->mSize.z()*0.5f);
SetLocalBoundingBox(_box);
delete particle;
}
void ParticleSystem::SetupBoardGPUParticles(BoardGPUParticleVertex* particleVertex,ushort* indicies,int quato)
{
float rate = mEmitter->GetGPUParticleRate();
float life = mEmitter->GetGPUParticleLife();
mDuration = life;
float rateFps = 1.0f/rate;
int totalPar = 0;
Particle* particle = new Particle();
float _time = (float)mDelayTime;
if(mIsPreLoop && mIsPlaying)
_time = -life;
mMobileTime = 0;
Math::Color32 _color;
Math::bbox _box;
float halfSize = 0;
_box.begin_extend();
while (totalPar < quato)
{
mEmitter->_emit(particle,(float)mDuration*totalPar/quato);
halfSize = 0.5f*particle->mSize.x();
particleVertex[4*totalPar].mColor = particle->mColor.HexARGB();
particleVertex[4*totalPar].mPosition = particle->mPosition;
particleVertex[4*totalPar].mTangent.set(-halfSize,halfSize,0,0);
particleVertex[4*totalPar].mNormal = particle->mDirection;
particleVertex[4*totalPar].mTexCoord.set(_time,particle->mTotalTimeToLive);
particleVertex[4*totalPar+1] = particleVertex[4*totalPar];
particleVertex[4*totalPar+1].mTangent.set(-halfSize,-halfSize,0,1);
particleVertex[4*totalPar+2] = particleVertex[4*totalPar];
particleVertex[4*totalPar+2].mTangent.set(halfSize,-halfSize,1,1);
particleVertex[4*totalPar+3] = particleVertex[4*totalPar];
particleVertex[4*totalPar+3].mTangent.set(halfSize,halfSize,1,0);
indicies[6*totalPar] = 4*totalPar;
indicies[6*totalPar+1] = 4*totalPar + 1;
indicies[6*totalPar+2] = 4*totalPar + 2;
indicies[6*totalPar+3] = 4*totalPar + 2;
indicies[6*totalPar+4] = 4*totalPar + 3;
indicies[6*totalPar+5] = 4*totalPar ;
_time += rateFps;
totalPar ++;
_box.extend(Math::point(
particle->mPosition.x(),particle->mPosition.y(),particle->mPosition.z()));
Math::float3 endPos;
endPos = _getEndPos(particle->mPosition,particle->mDirection,life);
_box.extend(Math::point(
endPos.x(),endPos.y(),endPos.z()));
}
_box.end_extend();
_box.pmax += Math::point(
particle->mSize.x()*0.5f,particle->mSize.y()*0.5f,particle->mSize.z()*0.5f);
_box.pmin -= Math::point(
particle->mSize.x()*0.5f,particle->mSize.y()*0.5f,particle->mSize.z()*0.5f);
SetLocalBoundingBox(_box);
delete particle;
}
void ParticleSystem::ParticleSystemDataChanged()
@ -910,7 +987,7 @@ namespace Particles
Math::bbox box = GetBoundingBox();
Math::float4 boxSizeVec = box.pmax - box.pmin;
float boxSize = boxSizeVec.x()*boxSizeVec.x()+boxSizeVec.y()*boxSizeVec.y()+boxSizeVec.z()*boxSizeVec.z();
Graphic::Camera* pMainCam = Graphic::GraphicSystem::Instance()->GetSceneDefaultCamera();
if(pMainCam == NULL)
return;
@ -964,5 +1041,17 @@ namespace Particles
mAffectors[index]->SetShaderMask(pMarcro);
}
}
//--------------------------------------------------------------------------------
const Math::float3 ParticleSystem::_getEndPos(const Math::float3& pos,const Math::float3 speed,float time)
{
ParticleAffectorPtr affector = NULL;
Math::float3 endPos = pos + speed*time;
for ( IndexT index = 0; index < mAffectors.Size(); ++index)
{
affector = mAffectors[index];
endPos = affector->_getEndPos(pos,speed,time);
}
return endPos;
}
}

View File

@ -205,7 +205,8 @@ namespace Particles
void SetUpdateUnVis(bool _update);
const bool GetUpdateUnVis() const;
void _NeedUpdate();
void SetupGPUParticles(SimpleGPUParticleVertex* particleVertex,int quato);
void SetupSpriteGPUParticles(SpriteGPUParticleVertex* particleVertex,int quato);
void SetupBoardGPUParticles(BoardGPUParticleVertex* particleVertex,ushort* indicies,int quato);
bool _NeedUpdateBox();
void ParticleSystemDataChanged();
void SetShaderParam();
@ -229,6 +230,7 @@ namespace Particles
void _repeatUpdate(float);
void _techUpdate(Timing::Time frameTime,IndexT frameIndex );
void _fpsControl();
const Math::float3 _getEndPos(const Math::float3& pos,const Math::float3 speed,float time);
protected:
bool mIsActive;
bool mPlayOnAwake;

View File

@ -25,6 +25,7 @@ THE SOFTWARE.
#include "particles/particlesystem.h"
#include "particles/particletechnique.h"
namespace Particles
{
using namespace Serialization;
@ -183,7 +184,6 @@ namespace Particles
pReader->SerializeBool(s_PlayOnAwake, playOnAwake );
#if __EDIT_STATUS__
obj->SetPlayOnAwake( playOnAwake, EditStatus::IsPlayingGame() );
#else
obj->SetPlayOnAwake( playOnAwake);
#endif
@ -207,8 +207,8 @@ namespace Particles
bool playOnAwake;
pReader->SerializeBool(s_PlayOnAwake, playOnAwake );
#ifdef __GENESIS_EDITOR__
obj->SetPlayOnAwake( playOnAwake);
#if __EDIT_STATUS__
obj->SetPlayOnAwake( playOnAwake, EditStatus::IsPlayingGame() );
#else
obj->SetPlayOnAwake( playOnAwake, true );
#endif
@ -277,8 +277,8 @@ namespace Particles
bool playOnAwake;
pReader->SerializeBool(s_PlayOnAwake, playOnAwake );
#ifdef __GENESIS_EDITOR__
obj->SetPlayOnAwake( playOnAwake);
#if __EDIT_STATUS__
obj->SetPlayOnAwake( playOnAwake, EditStatus::IsPlayingGame() );
#else
obj->SetPlayOnAwake( playOnAwake, true );
#endif
@ -350,8 +350,8 @@ namespace Particles
bool playOnAwake;
pReader->SerializeBool(s_PlayOnAwake, playOnAwake );
#ifdef __GENESIS_EDITOR__
obj->SetPlayOnAwake( playOnAwake);
#if __EDIT_STATUS__
obj->SetPlayOnAwake( playOnAwake, EditStatus::IsPlayingGame() );
#else
obj->SetPlayOnAwake( playOnAwake, true );
#endif
@ -518,8 +518,8 @@ namespace Particles
bool playOnAwake = parSystem->GetPlayOnAwake();
#ifdef __GENESIS_EDITOR__
SetPlayOnAwake(playOnAwake);
#if __EDIT_STATUS__
SetPlayOnAwake( playOnAwake, EditStatus::IsPlayingGame() );
#else
SetPlayOnAwake(playOnAwake, true);
#endif

View File

@ -217,7 +217,7 @@ namespace Particles
vbd2.Setup(needCount, sizeof(ParticleVertexData), RenderBase::BufferData::Dynamic,RenderBase::PrimitiveTopology::TriangleList, false);
}
void ParticleTarget::_initSimpleGPUVertexBuffer(Graphic::VertexBufferData2& vbd2, SizeT needCount)
void ParticleTarget::_initSpriteGPUVertexBuffer(Graphic::VertexBufferData2& vbd2, SizeT needCount)
{
Util::Array<RenderBase::VertexComponent>& verDeclare = vbd2.GetVertexComponents();
verDeclare.Append( VertexComponent(VertexComponent::Color,0, VertexComponent::ColorBGRA) );
@ -225,9 +225,9 @@ namespace Particles
verDeclare.Append( VertexComponent(VertexComponent::Normal,0, VertexComponent::Float3) );
verDeclare.Append( VertexComponent(VertexComponent::TexCoord, 0, VertexComponent::Float2) );
verDeclare.Append( VertexComponent(VertexComponent::Size, 0, VertexComponent::Float) );
vbd2.Setup(needCount, sizeof(SimpleGPUParticleVertex), RenderBase::BufferData::Dynamic,RenderBase::PrimitiveTopology::PointList, false);
vbd2.Setup(needCount, sizeof(SpriteGPUParticleVertex), RenderBase::BufferData::Dynamic,RenderBase::PrimitiveTopology::PointList, false);
}
void ParticleTarget::_initAffectGPUVertexBuffer(Graphic::VertexBufferData2& vbd2, SizeT needCount)
void ParticleTarget::_initBoardGPUVertexBuffer(Graphic::VertexBufferData2& vbd2, SizeT needCount)
{
Util::Array<RenderBase::VertexComponent>& verDeclare = vbd2.GetVertexComponents();
verDeclare.Append( VertexComponent(VertexComponent::Color,0, VertexComponent::ColorBGRA) );
@ -235,8 +235,7 @@ namespace Particles
verDeclare.Append( VertexComponent(VertexComponent::Position,0, VertexComponent::Float3) );
verDeclare.Append( VertexComponent(VertexComponent::Normal,0, VertexComponent::Float3) );
verDeclare.Append( VertexComponent(VertexComponent::TexCoord, 0, VertexComponent::Float2) );
verDeclare.Append( VertexComponent(VertexComponent::Size, 0, VertexComponent::Float) );
vbd2.Setup(needCount, sizeof(SimpleGPUParticleVertex), RenderBase::BufferData::Dynamic,RenderBase::PrimitiveTopology::PointList, false);
vbd2.Setup(needCount, sizeof(BoardGPUParticleVertex), RenderBase::BufferData::Static,RenderBase::PrimitiveTopology::TriangleList, false);
}
void ParticleTarget::_initVertexBufferData(Graphic::IndexBufferData2& ibd2, SizeT needCount)
{

View File

@ -349,8 +349,8 @@ namespace Particles
virtual void _RotatorParticle(Particle* particle, ParticleVertexData* particleVertex);
virtual Math::MinMaxCurve* getMinMaxCurve(ParticleCurveType pct);
void _initVertexBufferData(Graphic::VertexBufferData2& vbd2, SizeT needCount);
void _initSimpleGPUVertexBuffer(Graphic::VertexBufferData2& vbd2, SizeT needCount);
void _initAffectGPUVertexBuffer(Graphic::VertexBufferData2& vbd2, SizeT needCount);
void _initSpriteGPUVertexBuffer(Graphic::VertexBufferData2& vbd2, SizeT needCount);
void _initBoardGPUVertexBuffer(Graphic::VertexBufferData2& vbd2, SizeT needCount);
void _initVertexBufferData(Graphic::IndexBufferData2& ibd2, SizeT needCount);
protected:
void restActiveElemCount();

View File

@ -63,16 +63,44 @@ namespace Particles
mPrimDirty = true;
return;
}
Graphic::VertexBufferData2 vbd2;
Graphic::DynamicBuffer dvb;
_initSimpleGPUVertexBuffer(vbd2, quato);
dvb.SetSize(quato*sizeof(SimpleGPUParticleVertex));
SimpleGPUParticleVertex* particleVertex = dvb.GetBufferPtr<SimpleGPUParticleVertex>();
mParentSystem->SetupGPUParticles(particleVertex,quato);
mParentSystem->InitShaderParam();
Graphic::VertexBufferData2 vbd2;
Graphic::IndexBufferData2 ibd2;
/*
_initSpriteGPUVertexBuffer(vbd2, quato);
dvb.SetSize(quato*sizeof(SpriteGPUParticleVertex));
SpriteGPUParticleVertex* particleVertex = dvb.GetBufferPtr<SpriteGPUParticleVertex>();
mParentSystem->SetupSpriteGPUParticles(particleVertex,quato);
mPrimitiveHandle = Graphic::GraphicSystem::Instance()->CreatePrimitiveHandle(&vbd2);
mActiveVertexCount = quato;
Graphic::GraphicSystem::Instance()->UpdatePrimitiveHandle(mPrimitiveHandle, &dvb);
mPrimDirty = true;
mNeedPrimitive = false;
*/
mActiveVertexCount = 4*quato;
mActiveIndexCount = 6*quato;
vbd2.Setup(mActiveVertexCount,sizeof(BoardGPUParticleVertex),
RenderBase::BufferData::Static,RenderBase::PrimitiveTopology::TriangleList,true);
ibd2.Setup(mActiveIndexCount, RenderBase::BufferData::Static, RenderBase::IndexBufferData::Int16, true);
BoardGPUParticleVertex* particleVertex = vbd2.GetBufferPtr<BoardGPUParticleVertex>();
ushort* indicies = ibd2.GetBufferPtr<ushort>();
mParentSystem->SetupBoardGPUParticles(particleVertex,indicies,quato);
_initBoardGPUVertexBuffer(vbd2,mActiveVertexCount);
if(mPrimitiveHandle.IsValid())
{
Graphic::GraphicSystem::Instance()->RemovePrimitive(mPrimitiveHandle);
}
mPrimitiveHandle = Graphic::GraphicSystem::Instance()->CreatePrimitiveHandle(&vbd2,&ibd2);
mPrimDirty = true;
mNeedPrimitive = false;
}

View File

@ -27,6 +27,8 @@ THE SOFTWARE.
#include "ETC_Header.h"
#include "foundation/io/filestream.h"
#include "foundation/io/memorystream.h"
#include "rendersystem/base/GraphicCardCapability.h"
#include "rendersystem/RenderSystem.h"
// must define FREEIMAGE_LIB when use FreeImage as static lib
#define FREEIMAGE_LIB
@ -136,8 +138,8 @@ namespace Resources
//#else
FreeImage_Initialise(false);
n_printf("FreeImage version: %s Info: %s \n", FreeImage_GetVersion(), FreeImage_GetCopyrightMessage());
n_printf("FreeImage Supported formats: \n");
n_debuglog("FreeImage version: %s Info: %s \n", FreeImage_GetVersion(), FreeImage_GetCopyrightMessage());
n_debuglog("FreeImage Supported formats: \n");
for (int iType = 0; iType < FreeImage_GetFIFCount(); ++iType)
{
@ -159,7 +161,7 @@ namespace Resources
Util::String strType = strArray[index];
strType.ToUpper();
n_printf( " %s", strType.AsCharPtr() );
n_debuglog( " %s", strType.AsCharPtr() );
if ( InvalidIndex == mExtReg.FindIndex( strType ) )
{
@ -167,7 +169,7 @@ namespace Resources
}
}
}
n_printf("\n");
n_debuglog("\n");
// Set error handler
FreeImage_SetOutputMessage(FreeImageLoadErrorHandler);
@ -261,6 +263,7 @@ namespace Resources
{
n_assert( mStream.isvalid() && pImage.isvalid() );
#if RENDERDEVICE_D3D9
// check if dds
if ( stream->GetSize() >= 4 )
{
@ -278,6 +281,33 @@ namespace Resources
// prepare check other
stream->Seek(0, IO::Stream::Begin );
}
#endif
#if RENDERDEVICE_OPENGLES
const RenderBase::GraphicCardCapability& caps = RenderBase::RenderSystem::Instance()->GetGraphicCardCapability();
if (caps.mS3TC)
{
// check if dds
if ( stream->GetSize() >= 4 )
{
//Read first byte to identify format
uint32 magic;
stream->Read(&magic,sizeof(uint32) );
FlipEndian(&magic, sizeof(uint32), 1);
if ( DDS_MAGIC == magic )
{
stream->Seek(0, IO::Stream::Begin );
return LoadDXT(stream, pImage );
}
// prepare check other
stream->Seek(0, IO::Stream::Begin );
}
}
#endif
// check if PVRTC
if ( stream->GetSize() >= sizeof(PVRTCTexHeader) )

View File

@ -86,7 +86,10 @@ namespace Resources
bool ret = LoadPhysXMaterialResByVersion(pRes,pReader,version);
if(pRes->GetMat())
{
pRes->SetMat(NULL);
}
//pReader->EndFileSerialize();
return ret;
}

View File

@ -148,7 +148,7 @@ void ShaderJoint::_ParseVsOutput(const CommonShaderSetting* pCommon, const Shadi
}
Util::String testCode = includeContent + m_sJointedSource + g_sSimpleLight;
Util::String testCode = "#define D3D9\n" + includeContent + m_sJointedSource + g_sSimpleLight;
testCode += "float4 psMain (" + m_CustomFunc.paramInputType + " p) : COLOR\n";
testCode += "{\n";

View File

@ -52,6 +52,9 @@ namespace Sound
//------------------------------------------------------------------------------
bool SoundSystemDSPOpenAL::setParameter( int index, float value , bool integer)
{
if(!CheckDspSupport())
return false;
if ( m_type != AL_FILTER_LOWPASS )
{
if (integer)
@ -75,6 +78,9 @@ namespace Sound
//------------------------------------------------------------------------------
bool SoundSystemDSPOpenAL::setParameters( int index, float* pan)
{
if(!CheckDspSupport())
return false;
alEffectfv( m_uiFilter, index, pan);
return true;
}
@ -82,11 +88,15 @@ namespace Sound
//------------------------------------------------------------------------------
bool SoundSystemDSPOpenAL::init(ALuint type)
{
if(!CheckDspSupport())
return false;
// Clear AL Error State
alGetError();
ALboolean result = ALFWIsEFXSupported();
n_assert(result == AL_TRUE);
if( result == AL_FALSE )
return false;
alGenAuxiliaryEffectSlots(1, &m_uiEffectSlot);
if ( alGetError() != AL_NO_ERROR )
@ -143,6 +153,9 @@ namespace Sound
//------------------------------------------------------------------------------
bool SoundSystemDSPOpenAL::uninit()
{
if(!CheckDspSupport())
return false;
if ( alIsFilter(m_uiFilter) )
alDeleteFilters( 1, &m_uiFilter );
@ -159,6 +172,9 @@ namespace Sound
bool SoundSystemDSPOpenAL::apply( SoundSystemSource* sss, int sendIndex)
{
if(!CheckDspSupport())
return false;
m_sendIndex = sendIndex;
if(sss)
@ -204,6 +220,9 @@ namespace Sound
bool SoundSystemDSPOpenAL::unapply( SoundSystemSource* sss )
{
if(!CheckDspSupport())
return false;
if(sss)
{
ALuint uiSource = NULL;
@ -222,5 +241,16 @@ namespace Sound
return false;
}
bool SoundSystemDSPOpenAL::CheckDspSupport()
{
ALCcontext* pContext = alcGetCurrentContext();
ALCdevice* pDevice = alcGetContextsDevice(pContext);
if(!alcIsExtensionPresent(pDevice, (ALCchar*)ALC_EXT_EFX_NAME))
return false;
return true;
}
}
#endif // __USE_AUDIO__ || __GENESIS_EDITOR__

View File

@ -52,6 +52,8 @@ namespace Sound
int GetSendIndex() { return m_sendIndex; }
protected:
bool CheckDspSupport();
ALuint m_type;
ALuint m_uiEffectSlot; // effect slot
ALuint m_uiFilter; // filter

View File

@ -485,8 +485,8 @@ namespace Sound
bool SoundSystemOpenAL::createDSPByType( ALuint type, GPtr<SoundSystemDSP>& dsp )
{
dsp = SoundSystemDSPOpenAL::Create();
dsp->init(type);
return true;
bool result = dsp->init(type);
return result;
}
}

View File

@ -24,7 +24,7 @@ THE SOFTWARE.
#ifndef __SPRITE_MESH_H__
#define __SPRITE_MESH_H__
#include "foundation/core/refcounted.h"
#include "foundation/Util/array.h"
#include "foundation/util/array.h"
#include "foundation/math/size.h"
#include "foundation/math/float3.h"
#include "foundation/math/color.h"

View File

@ -32,7 +32,7 @@ THE SOFTWARE.
#elif __PS3__
#include "core/ps3/precompiled.h"
#elif __OSX__
#include "core/OSX/precompiled.h"
#include "core/osx/precompiled.h"
#elif __ANDROID__
#include "core/android/precompiled.h"
#else

View File

@ -950,29 +950,45 @@ namespace Terrain
}
void TerrainDataSource::GetColorMapData(Math::Color32* buffer,const int xStart /* = 0 */,const int yStart /* = 0 */,const int width /* = -1 */,const int height /* = -1 */)
{
if(GetImagesData(mColorMap,xStart,yStart,width,height,buffer,COLOR32))
return;
memset (buffer, 0, width * height * sizeof(Math::Color32));
if (mColorMap.isvalid())
{
if(GetImagesData(mColorMap,xStart,yStart,width,height,buffer,COLOR32))
return;
}
else
{
memset (buffer, 0, width * height * sizeof(Math::Color32));
}
}
void TerrainDataSource::GetColorMapData(Math::ColorF* buffer,const int xStart /* = 0 */,const int yStart /* = 0 */,const int width /* = -1 */,const int height /* = -1 */)
{
if(GetImagesData(mColorMap,xStart,yStart,width,height,buffer,COLORF))
return;
memset (buffer, 0, width * height * sizeof(Math::ColorF));
if (mColorMap.isvalid())
{
if(GetImagesData(mColorMap,xStart,yStart,width,height,buffer,COLORF))
return;
}
else
{
memset (buffer, 0, width * height * sizeof(Math::ColorF));
}
}
void TerrainDataSource::SetColorMapData(Math::ColorF* buffer,const int xStart /* = 0 */,const int yStart /* = 0 */,const int width /* = -1 */,const int height /* = -1 */)
{
SetImagesData(mColorMap,xStart,yStart,width,height,buffer,COLORF);
if (mColorMap)
if (mColorMap.isvalid())
{
SetImagesData(mColorMap,xStart,yStart,width,height,buffer,COLORF);
Graphic::GraphicSystem::Instance()->UpdateTexture(mColorMap->GetHandle(), &_UpdateTextureFunction, mColorMap);
//RefreshBasemap(xStart,yStart,width,height);
}
}
void TerrainDataSource::SetColorMapData(Math::Color32* buffer,const int xStart /* = 0 */,const int yStart /* = 0 */,const int width /* = -1 */,const int height /* = -1 */)
{
SetImagesData(mColorMap,xStart,yStart,width,height,buffer,COLOR32);
if (mColorMap)
if (mColorMap.isvalid())
{
SetImagesData(mColorMap,xStart,yStart,width,height,buffer,COLOR32);
Graphic::GraphicSystem::Instance()->UpdateTexture(mColorMap->GetHandle(), &_UpdateTextureFunction, mColorMap);
//RefreshBasemap(xStart,yStart,width,height);
}
}
//------------------------------------------------------------------------------
//other unclassify methods
@ -1053,10 +1069,29 @@ namespace Terrain
height = texture->GetHeight() - yStart;
}
n_assert( xStart >= 0 && xStart < texture->GetWidth() && "xStart is invalid" );
n_assert( yStart >= 0 && yStart < texture->GetHeight() && "yStart is invalid" );
n_assert( width >= 1 && width + xStart <= texture->GetWidth() && "width is invalid");
n_assert( height >= 1 && height + yStart <= texture->GetHeight() && "height is invalid");
if( !(xStart >= 0 && xStart < texture->GetWidth()) )
{
n_warning("This operation is invalid");
return false;
}
if( !(yStart >= 0 && yStart < texture->GetHeight()) )
{
n_warning("This operation is invalid");
return false;
}
if( !(width >= 1 && width + xStart <= texture->GetWidth()) )
{
n_warning("This operation is invalid");
return false;
}
if( !(height >= 1 && height + yStart <= texture->GetHeight()) )
{
n_warning("This operation is invalid");
return false;
}
if (datatype == COLORF)
{

View File

@ -190,6 +190,12 @@ namespace Vegetation
Util::FixedArray<uchar>& GetIndices();
void GetReferenceResourceId(Util::Array<Resources::ReferenceResource>& list) const;
#ifdef __GENESIS_EDITOR__
void SetEditorVisible(bool bVis);
bool IsVisible() const;
#endif
protected:
void _onActive(void);
void _onDeactive(void);
@ -238,6 +244,9 @@ namespace Vegetation
friend class VegetationServer;
#ifdef __GENESIS_EDITOR__
bool m_bEditorVis;
#endif
};
//--------------------------------------------------------------------------------
@ -353,6 +362,18 @@ namespace Vegetation
{
return m_indices;
}
#ifdef __GENESIS_EDITOR__
inline void VegetationObject::SetEditorVisible(bool bVis)
{
m_bEditorVis = bVis;
}
inline bool VegetationObject::IsVisible() const
{
return m_bEditorVis;
}
#endif
}
#endif //__VEGETATION_OBJECT_H__

View File

@ -254,6 +254,7 @@ SET ( SCRIPTFEATURE_HEADER_FILES
scriptfeature/script_root_instance.h
scriptfeature/script_IAP_instance.h
scriptfeature/script_render_buffer_filter.h
scriptfeature/script_app.h
)
@ -273,6 +274,7 @@ SET ( SCRIPTFEATURE_SOURCE_FILES
scriptfeature/script_root_instance.cc
scriptfeature/script_IAP_instance.cc
scriptfeature/script_render_buffer_filter.cc
scriptfeature/script_app.cc
)
#scriptfeature inc folder
@ -393,8 +395,13 @@ SET ( GUIFEATURE_FILES
guifeature/guievent.cc
guifeature/FontFeature.h
guifeature/FontFeature.cc
)
SET ( JNI_FILES
Jni/imejni.h
Jni/imejni.cc
Jni/jnihelper.h
Jni/jnihelper.cc
)
SET ( GUIBIND_FILES
guibind/scriptbind_gui.cc
@ -669,6 +676,11 @@ SOURCE_GROUP(
FILES
${GUIFEATURE_FILES}
)
SOURCE_GROUP(
"Jni"
FILES
${JNI_FILES}
)
SOURCE_GROUP(
"GuiBind"
FILES
@ -815,6 +827,7 @@ ADD_LIBRARY(
${SPRITEBACTH_FILES}
${GUIFEATURE_FILES}
${GUIBIND_FILES}
${JNI_FILES}
)
#Organize projects into folders

181
Engine/app/Jni/Jnihelper.cc Normal file
View File

@ -0,0 +1,181 @@
/****************************************************************************
Copyright (c) 2011-2013,WebJet Business Division,CYOU
http://www.genesis-3d.com.cn
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#if __ANDROID__
#include "stdneb.h"
#include "jnihelper.h"
#include <string.h>
#include "players/GenesisA/simplegameapplication.h"
namespace App
{
//////////////////////////////////////////////////////////////////////////
// java vm helper function
//////////////////////////////////////////////////////////////////////////
static bool getEnv(JNIEnv **env)
{
bool bRet = true;
*env = Genesis::DemoPublishGameApplication::Instance()->GetJNIEvn();
return bRet;
}
bool JniHelper::GetEnv(JNIEnv **env)
{
return getEnv(env);
}
static jclass getClassID_(const char *className, JNIEnv *env)
{
JNIEnv *pEnv = env;
jclass ret = 0;
do
{
if (! pEnv)
{
if (! getEnv(&pEnv))
{
break;
}
}
ret = pEnv->FindClass(className);
if (! ret)
{
n_warning("Failed to find class of %s", className);
break;
}
} while (0);
return ret;
}
static bool getStaticMethodInfo_(JniMethodInfo &methodinfo, const char *className, const char *methodName, const char *paramCode)
{
jmethodID methodID = 0;
JNIEnv *pEnv = 0;
bool bRet = false;
do
{
if (! getEnv(&pEnv))
{
break;
}
jclass classID = getClassID_(className, pEnv);
methodID = pEnv->GetStaticMethodID(classID, methodName, paramCode);
if (! methodID)
{
n_warning("Failed to find static method id of %s", methodName);
break;
}
methodinfo.classID = classID;
methodinfo.env = pEnv;
methodinfo.methodID = methodID;
bRet = true;
} while (0);
return bRet;
}
static bool getMethodInfo_(JniMethodInfo &methodinfo, const char *className, const char *methodName, const char *paramCode)
{
jmethodID methodID = 0;
JNIEnv *pEnv = 0;
bool bRet = false;
do
{
if (! getEnv(&pEnv))
{
break;
}
jclass classID = getClassID_(className, pEnv);
methodID = pEnv->GetMethodID(classID, methodName, paramCode);
if (! methodID)
{
n_warning("Failed to find method id of %s", methodName);
break;
}
methodinfo.classID = classID;
methodinfo.env = pEnv;
methodinfo.methodID = methodID;
bRet = true;
} while (0);
return bRet;
}
static std::string jstring2string_(jstring jstr)
{
if (jstr == NULL)
{
return "";
}
JNIEnv *env = 0;
if (! getEnv(&env))
{
return 0;
}
const char* chars = env->GetStringUTFChars(jstr, NULL);
std::string ret(chars);
env->ReleaseStringUTFChars(jstr, chars);
return ret;
}
//////////////////////////////////////////////////////////////
jclass JniHelper::GetClassID(const char *className, JNIEnv *env)
{
return getClassID_(className, env);
}
bool JniHelper::GetStaticMethodInfo(JniMethodInfo &methodinfo, const char *className, const char *methodName, const char *paramCode)
{
return getStaticMethodInfo_(methodinfo, className, methodName, paramCode);
}
bool JniHelper::GetMethodInfo(JniMethodInfo &methodinfo, const char *className, const char *methodName, const char *paramCode)
{
return getMethodInfo_(methodinfo, className, methodName, paramCode);
}
std::string JniHelper::jstring2string(jstring str)
{
return jstring2string_(str);
}
}
#endif

View File

@ -0,0 +1,56 @@
/****************************************************************************
Copyright (c) 2011-2013,WebJet Business Division,CYOU
http://www.genesis-3d.com.cn
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#ifndef __JNI_HELPER_H__
#define __JNI_HELPER_H__
#if __ANDROID__
#include <jni.h>
#include <string>
namespace App
{
typedef struct JniMethodInfo_
{
JNIEnv * env;
jclass classID;
jmethodID methodID;
} JniMethodInfo;
class JniHelper
{
public:
static bool GetEnv(JNIEnv **env);
static jclass GetClassID(const char *className, JNIEnv *env=0);
static bool GetStaticMethodInfo(JniMethodInfo &methodinfo, const char *className, const char *methodName, const char *paramCode);
static bool GetMethodInfo(JniMethodInfo &methodinfo, const char *className, const char *methodName, const char *paramCode);
static std::string jstring2string(jstring str);
private:
};
}
#endif
#endif // __JNI_HELPER_H__

67
Engine/app/Jni/imejni.cc Normal file
View File

@ -0,0 +1,67 @@
/****************************************************************************
Copyright (c) 2011-2013,WebJet Business Division,CYOU
http://www.genesis-3d.com.cn
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#if __ANDROID__
#include "imejni.h"
#include <string.h>
#include <jni.h>
#include "Jnihelper.h"
namespace App
{
static char* s_classname= "org/genesis/lib/GenesisGLSurfaceView";
void IMEJni::ShowKeyboardJNI(int bOpen)
{
if (bOpen)
{
IMEJni::OpenKeyboardJNI();
}
else
{
IMEJni::CloseKeyboardJNI();
}
}
void IMEJni::OpenKeyboardJNI()
{
JniMethodInfo t;
if (JniHelper::GetStaticMethodInfo(t, s_classname, "openIMEKeyboard", "()V")) {
t.env->CallStaticVoidMethod(t.classID, t.methodID);
t.env->DeleteLocalRef(t.classID);
}
}
void IMEJni::CloseKeyboardJNI()
{
JniMethodInfo t;
if (JniHelper::GetStaticMethodInfo(t, s_classname, "closeIMEKeyboard", "()V")) {
t.env->CallStaticVoidMethod(t.classID, t.methodID);
t.env->DeleteLocalRef(t.classID);
}
}
}
#endif

39
Engine/app/Jni/imejni.h Normal file
View File

@ -0,0 +1,39 @@
/****************************************************************************
Copyright (c) 2011-2013,WebJet Business Division,CYOU
http://www.genesis-3d.com.cn
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#ifndef __IME_JNI_H__
#define __IME_JNI_H__
namespace App
{
class IMEJni
{
public:
static void ShowKeyboardJNI(int bOpen);
static void OpenKeyboardJNI();
static void CloseKeyboardJNI();
};
}
#endif // __IME_JNI_H__

View File

@ -52,6 +52,7 @@ __ImplementClass(App::Actor, 'GACT', Core::RefCounted);
uint Actor::s_fastIdCounter = 0;
const GPtr<Actor> Actor::NullActor;
const ActorPropertySet ActorPropertySet::s_defaultVal;
//------------------------------------------------------------------------------
/**
*/
@ -61,6 +62,7 @@ Actor::Actor() :
mActivated(false),
mActiveControl(false),
mTemplateName(""),
mModelName(""),
mIsLinkTemplate(false),
mLayerID(eSL_Defualt),
mTagID(1),
@ -79,7 +81,6 @@ Actor::Actor() :
#ifdef __GENESIS_EDITOR__
mQueryMask(0),
mFrozen(false),
mLocked(false),
#endif
mEditorFlag(0),
mPriority(ResourcePriority::Undefinition)
@ -159,9 +160,23 @@ Actor::_Destory(bool forceShutDown )
//------------------------------------------------------------------------
void Actor::SetLayerID(LayerID id)
{
if (id == mLayerID)
return;
n_assert(id < 32);
n_assert(0 <= id);
mLayerID = id;
#if __USE_PHYSX__ || __GENESIS_EDITOR__
//从脚本设置的话需要更新物理形状的groupId
GPtr<PhysicsBodyComponent> com = FindComponent<PhysicsBodyComponent>();
if(com.isvalid() && com->GetEntity()->IsValid())
{
com->GetEntity()->SetGroupID(id);
}
#endif
IndexT i;
for (i = 0; i < this->mComponents.Size(); ++i)
{
@ -1055,7 +1070,16 @@ Actor::AttachComponent(const GPtr<Component>& prop)
{
n_assert(0 != prop);
this->mComponents.Append(prop);
//修复bug252 脚本组件应当放在最后
SizeT len = mComponents.Size();
if (len > 0 && mComponents[len-1]->IsA(ScriptComponent::RTTI))
{
mComponents.Insert(len-1, prop);
}
else
{
mComponents.Append(prop);
}
prop->_SetActor(this);
prop->SetupAllResource();
if ( IsActive())
@ -1372,7 +1396,7 @@ void Actor::SetActiveStateForTemplate()
}
//------------------------------------------------------------------------
void Actor::CopyFrom( const GPtr<Actor>& pSource, bool includePrivateProperty, bool isTemplate , bool needRecurVFL )
void Actor::CopyFrom( const GPtr<Actor>& pSource,const ActorPropertySet& actorPropertySet, bool includePrivateProperty, bool isTemplate , bool needRecurVFL )
{
//#ifdef _DEBUG
// mCopyedActor = 1;
@ -1437,7 +1461,7 @@ void Actor::CopyFrom( const GPtr<Actor>& pSource, bool includePrivateProperty, b
mChildren[i] = pNewChild;
}
n_assert( mChildren[i].isvalid() );
mChildren[i]->CopyFrom( pSourceChild, true , isTemplate , needRecurVFL); // Dest Child is just Create, Copy All from Source Child
mChildren[i]->CopyFrom( pSourceChild,ActorPropertySet::s_defaultVal, true , isTemplate , needRecurVFL); // Dest Child is just Create, Copy All from Source Child
}
}
@ -1455,52 +1479,85 @@ void Actor::CopyFrom( const GPtr<Actor>& pSource, bool includePrivateProperty, b
AttachComponent( pDestCom );
}
}
//更新 新加入的Component的显示属性
SetVisible(pSource->GetVisible(), needRecurVFL);
#ifdef __GENESIS_EDITOR__
SetFrozen(pSource->GetFrozen(), needRecurVFL);
SetLocked(pSource->GetLocked(), needRecurVFL);
#endif
SetLocalBoundingBox(pSource->GetLocalBoundingBox());
SetTemplateName( pSource->GetTemplateName() );
_CopyFrom_MustProperty(pSource,needRecurVFL);
if ( includePrivateProperty )
{
// copy actor property, just serialization's property need copy
//SetVisible(pSource->GetVisible());
_CopyFrom_IncludeProperty(pSource,actorPropertySet);
if ( pSource->GetActiveControl() )
Active();
else
Deactive();
SetName( pSource->GetName() );
SetLinkTemplate( pSource->IsLinkTemplate() );
SetLayerID( pSource->GetLayerID() );
SetTagID( pSource->GetTagID() );
SetTransform( pSource->GetPosition(), pSource->GetRotation(), pSource->GetScale() );
// for templatedActors
SetTmpActiveState( pSource->IsActive() );
#ifdef __GENESIS_EDITOR__
SetQueryMask(pSource->GetQueryMask());
#endif
SetEditorFlag( pSource->GetEditorFlag() );
}
if (isTemplate)
{
SetLayerID( pSource->GetLayerID() );
SetTagID( pSource->GetTagID() );
SetTransform( this->GetPosition(), this->GetRotation(), this->GetScale() );
SetTmpActiveState( pSource->IsActive() );
#ifdef __GENESIS_EDITOR__
SetQueryMask(pSource->GetQueryMask());
#endif
SetEditorFlag( pSource->GetEditorFlag() );
_CopyFrom_CommonProperty(pSource,actorPropertySet);
}
}
//------------------------------------------------------------------------
void Actor::_CopyFrom_MustProperty( const GPtr<Actor>& pSource, bool needRecurVFL)
{
//更新 新加入的Component的显示属性
SetVisible(pSource->GetVisible(), needRecurVFL);
#ifdef __GENESIS_EDITOR__
SetFrozen(pSource->GetFrozen(), needRecurVFL);
#endif
SetLocalBoundingBox(pSource->GetLocalBoundingBox());
SetTemplateName( pSource->GetTemplateName() );
SetModelName(pSource->GetModelName());
}
//------------------------------------------------------------------------
void Actor::_CopyFrom_IncludeProperty( const GPtr<Actor>& pSource,const ActorPropertySet& actorPropertySet)
{
if ( pSource->GetActiveControl() )
Active();
else
Deactive();
bool bRootTemplateActor = actorPropertySet.TestFlag(ActorPropertySet::logic_exclusive_RootActorName) &&
this->GetTemplateName().IsValid() &&
(!this->GetParent() || this->GetParent() && !this->GetParent()->GetTemplateName().IsValid());
if ( !bRootTemplateActor )
{
SetName( pSource->GetName() );
}
SetLinkTemplate( pSource->IsLinkTemplate() );
_CopyFrom_CommonProperty(pSource,actorPropertySet);
if ( actorPropertySet.TestFlag(ActorPropertySet::logic_exclusive_pos_rot) )
{
SetTransform( this->GetPosition(), this->GetRotation(), pSource->GetScale() );
}
else
{
SetTransform( pSource->GetPosition(), pSource->GetRotation(), pSource->GetScale() );
}
SetPriority(pSource->GetPriority());
}
//------------------------------------------------------------------------
void Actor::_CopyFrom_TemplateProperty( const GPtr<Actor>& pSource,const ActorPropertySet& actorPropertySet)
{
_CopyFrom_CommonProperty(pSource,actorPropertySet);
SetTransform( this->GetPosition(), this->GetRotation(), this->GetScale() );
}
//------------------------------------------------------------------------
void Actor::_CopyFrom_CommonProperty( const GPtr<Actor>& pSource,const ActorPropertySet& actorPropertySet)
{
SetLayerID( pSource->GetLayerID() );
SetTagID( pSource->GetTagID() );
SetTmpActiveState( pSource->IsActive() );
#ifdef __GENESIS_EDITOR__
SetQueryMask(pSource->GetQueryMask());
#endif
SetEditorFlag( pSource->GetEditorFlag() );
}
//------------------------------------------------------------------------
void
Actor::SetPriority( const Resources::Priority priority )
@ -1632,15 +1689,33 @@ Actor::FindChildIndex(FastId id) const
}
//------------------------------------------------------------------------
const GPtr<Actor>&
Actor::FindChild(FastId id) const
Actor::FindChild(FastId id, bool includeGrandson) const
{
IndexT findIndex = FindChildIndex(id);
return GetChild( findIndex );
SizeT count = mChildren.Size();
for ( IndexT index = 0; index < count; ++index )
{
if ( mChildren[index]->GetFastId() == id )
{
return mChildren[index];
}
}
if (includeGrandson)
{
for ( IndexT index = 0; index < count; ++index )
{
const GPtr<Actor>& result = mChildren[index]->FindChild(id, includeGrandson);
if (result.isvalid())
{
return result;
}
}
}
return NullActor;
}
//------------------------------------------------------------------------
const GPtr<Actor>&
Actor::FindChildByTag(App::TagID id) const
Actor::FindChildByTag(App::TagID id, bool includeGrandson) const
{
// @todo may be need optimize, eg. Binary Search
SizeT count = mChildren.Size();
@ -1651,10 +1726,21 @@ Actor::FindChildByTag(App::TagID id) const
return mChildren[index];
}
}
if (includeGrandson)
{
for ( IndexT index = 0; index < count; ++index )
{
const GPtr<Actor>& result = mChildren[index]->FindChildByTag(id, includeGrandson);
if (result.isvalid())
{
return result;
}
}
}
return NullActor;
}
//------------------------------------------------------------------------
void Actor::FindChildrenByTag(const App::TagID id,Util::Array< GPtr<Actor> >& actors) const
void Actor::FindChildrenByTag(const App::TagID id,Util::Array< GPtr<Actor> >& actors, bool includeGrandson) const
{
SizeT count = mChildren.Size();
for ( IndexT index = 0; index < count; ++index )
@ -1663,10 +1749,14 @@ void Actor::FindChildrenByTag(const App::TagID id,Util::Array< GPtr<Actor> >& ac
{
actors.Append(mChildren[index]);
}
if (includeGrandson)
{
mChildren[index]->FindChildrenByTag(id, actors, includeGrandson);
}
}
}
const GPtr<Actor>&
Actor::FindChild(const Util::String& name) const
Actor::FindChild(const Util::String& name, bool includeGrandson) const
{
// @todo may be need optimize, eg. Binary Search
SizeT count = mChildren.Size();
@ -1677,12 +1767,24 @@ const GPtr<Actor>&
return mChildren[index];
}
}
if (includeGrandson)
{
for ( IndexT index = 0; index < count; ++index )
{
const GPtr<Actor>& result = mChildren[index]->FindChild(name, includeGrandson);
if (result.isvalid())
{
return result;
}
}
}
return NullActor;
}
//------------------------------------------------------------------------
const GPtr<Actor>&
Actor::FindChild(const Util::Guid& guid) const
Actor::FindChild(const Util::Guid& guid, bool includeGrandson) const
{
// @todo may be need optimize, eg. Binary Search
SizeT count = mChildren.Size();
@ -1693,6 +1795,18 @@ Actor::FindChild(const Util::Guid& guid) const
return mChildren[index];
}
}
if (includeGrandson)
{
for ( IndexT index = 0; index < count; ++index )
{
const GPtr<Actor>& result = mChildren[index]->FindChild(guid, includeGrandson);
if (result.isvalid())
{
return result;
}
}
}
return NullActor;
}
@ -1784,27 +1898,12 @@ Actor::_DirtyWorldTransform()
// dirty child
GPtr<Actor> children;
#ifdef __GENESIS_EDITOR__
bool bLocked = false;
#endif
SizeT numActor = mChildren.Size();
for ( IndexT i = 0; i < numActor; ++i )
{
children = mChildren[i];
#ifdef __GENESIS_EDITOR__
/*子actor处于锁定状态时其世界坐标不应该跟着父actor的变换而变换
*/
bLocked = children->GetLocked();
if ( bLocked )
{
const Actor *parent = children->GetParent();
children->SetLockedActorLocalTransform(parent);
continue;
}
#endif
children->_DirtyWorldTransform();
}
}
@ -1884,29 +1983,8 @@ Actor::SaveTerrainFile(void) const
}
//------------------------------------------------------------------------------
#ifdef __GENESIS_EDITOR__
void Actor::SetLocked(bool bLocked , bool needRecursive/* = true*/)
{
mLocked = bLocked;
if (needRecursive)
{
SizeT count = mChildren.Size();
for ( IndexT index = 0; index < count; ++index )
{
mChildren[index]->SetLocked(bLocked);
}
}
}
//------------------------------------------------------------------------------
void Actor::SetLockedActorTransformRecursive(const GPtr<App::Actor>& pSource)
{
n_assert(pSource);
SetTransform(pSource->GetPosition(),pSource->GetRotation(),pSource->GetScale());
SizeT count = mChildren.Size();
for ( IndexT index = 0; index < count; ++index )
{
mChildren[index]->SetLockedActorTransformRecursive(pSource->GetChild(index));
}
}
//------------------------------------------------------------------------------
void Actor::SetFrozen(bool bFrozen , bool needRecursive/* = true*/)
{
@ -1923,7 +2001,7 @@ void Actor::SetFrozen(bool bFrozen , bool needRecursive/* = true*/)
#endif
//------------------------------------------------------------------------------
void Actor::SetVisible( bool bVisible , bool needRecursive /*= true*/ )
{
{
mVisible = bVisible;
if ( NULL != FindComponent<RenderComponent>() )
@ -1934,8 +2012,12 @@ void Actor::SetVisible( bool bVisible , bool needRecursive /*= true*/ )
{
GPtr<RenderComponent> renderCom = coms[i].downcast<RenderComponent>();
n_assert(renderCom.isvalid());
#ifdef __GENESIS_EDITOR__
renderCom->SetEditorVisible(bVisible);
#else
renderCom->SetVisible(bVisible);
#endif
}
}
@ -1950,7 +2032,11 @@ void Actor::SetVisible( bool bVisible , bool needRecursive /*= true*/ )
{
continue;
}
#ifdef __GENESIS_EDITOR__
vegeRenderCom->SetEditorVisible(bVisible);
#else
vegeRenderCom->SetVisible(bVisible);
#endif
}
}
if (needRecursive)
@ -1963,6 +2049,7 @@ void Actor::SetVisible( bool bVisible , bool needRecursive /*= true*/ )
}
//暂未处理其它component对显示隐藏属性的响应如相机、灯光、声音、粒子
return;
}
//------------------------------------------------------------------------------
bool Actor::GetVisible() const
@ -1985,32 +2072,7 @@ bool Actor::IsChildOfAnimationActor()
}
return false;
}
//------------------------------------------------------------------------
/*设置锁定actor的局部坐标时是不需要调_DirtyWorldTransform()函数的,因为
*/
#ifdef __GENESIS_EDITOR__
void Actor::SetLockedActorLocalTransform( const Actor *parent )
{
if ( parent )
{
const Math::matrix44 &parentWT = parent->GetWorldTransform();
Math::matrix44 inversepw = Math::matrix44::inverse(parentWT);
const Math::matrix44 &worldTransform = GetWorldTransform();
mLocaTrans = Math::matrix44::multiply( inversepw , worldTransform );
mLocaTrans.setrow3( Math::float4(0.0f,0.0f,0.0f,1.0f));
mLocaTrans.decompose( mLocalScale, mLocalRotation, mLocalPosition );
return;
}
else
{
mLocalPosition = mWorldPosition;
mLocalRotation = mWorldRotation;
mLocalScale = mWorldScale;
mLocaTrans = mWorldTrans;
}
}
#endif
//------------------------------------------------------------------------------
#if NEBULA3_ENABLE_PROFILING
//------------------------------------------------------------------------

Some files were not shown because too many files have changed in this diff Show More