原文:http://www.cnblogs.com/graphics/archive/2010/07/05/1771110.html #include <iostream> #include <map> #include <string> using namespace std ; int main(void) { map<int, string> m ; m.insert(pair<int, string>(1, "abc")) ; m.insert(pair<int, string>(2, "def")) ; m.insert(pair<int, string>(3, "def")) ; m.insert(pair<int, string>(4, "ghi")) ; map<int, string>::iterator itor ; // 错误的写法 for (itor = m.begin(); itor != m.end(); ++itor) { if (itor->second == "def") { m.erase(itor) ; // map是关联式容器,调用erase后,当前迭代器已经失效 } } // 正确的写法 for (itor = m.begin(); itor != m.end();) { if (itor->second == "def") { m.

Continue reading

问题现象 4.19版本启用Substance Plugin后,Generate Visual Studio Project Files时报错: Exception while generating include data for UE4Editor: Unable to instantiate module 'SubstanceCore': System.NullReferenceException: La référence d'objet n'est pas définie à une instance d'un objet. à UnrealBuildTool.Rules.SubstanceCore..ctor(ReadOnlyTargetRules Target) dans d:\3D\UE4.19\UnrealEngine-release\Engine\Plugins\Substance\Source\SubstanceCore\SubstanceCore.Build.cs:ligne 116 (referenced via UE4Editor.Target.cs -> Substance.uplugin) 解决办法 修改:UE_4.19\Engine\Plugins\Marketplace\Substance\Source\SubstanceCore\SubstanceCore.Build.cs 将116行到124行注掉,并追加一行: IncludePS4Files = false; 参考自:https://forum.allegorithmic.com/index.php?topic=23285.0 你简单,世界就是童话;心复杂,世界就是迷宫。

Continue reading

Advanced Sessions Plugin https://forums.unrealengine.com/community/community-content-tools-and-tutorials/41043-advanced-sessions-plugin Online Subsystem Steam https://docs.unrealengine.com/en-us/Programming/Online/Steam Steam, Using the Steam SDK During Development https://wiki.unrealengine.com/Steam,_Using_the_Steam_SDK_During_Development Integrating Steam SDK – Part 1 http://orfeasel.com/steam_integration_p1/ Handling Steam Achievements – Steam Integration Part 2 http://orfeasel.com/handling-steam-achievements-steam-integration-part-2/ 中文翻译: 集成 Steam SDK(一) http://gad.qq.com/program/translateview/7191581 处理Steam成就系统——接入Steam SDK(二) http://gad.qq.com/program/translateview/7191582 Shipping模式下steam集成无效的问题 在打包输出目录下,例如:\WindowsNoEditor\MyProj\Binaries\Win64\,新建一个文本文件:steam_appid.txt,并且内容为“480”。480表示steam测试使用的app id。 参考自:Steam integration not working on a Shipping Build https://answers.unrealengine.com/questions/474029/steam-integration-not-working-on-a-shipping-build.html 人生没有彩排,每天都是直播。阳光,源自你内心的澄澈!

Continue reading

keywords:UE4、Lighting、灯光 Lighting Content Examples https://docs.unrealengine.com/en-us/Resources/ContentExamples/Lighting Light Propagation Volumes Light Propagation Volumes https://docs.unrealengine.com/en-us/Engine/Rendering/LightingAndShadows/LightPropagationVolumes Dynamic GI : Getting the Most out of LPV ( Light Propagation Volume ) https://forums.unrealengine.com/community/community-content-tools-and-tutorials/103572-dynamic-gi-getting-the-most-out-of-lpv-light-propagation-volume Lighting Channels https://docs.unrealengine.com/en-us/Engine/Rendering/LightingAndShadows/LightingChannels 注意事项: Lighting Channels是动态的,意思是:静态光(Static Lights)或者Mobility为Static的Static Mesh Actor不受Lighting Channels影响。要使用Lighting Channels,Static Mesh Actor和Lights的Mobility必须设置为Stationary或者Movable。 材质类型影响:Lighting Channels只影响直接光照(direct lighting)下Opaque类型材质,Translucent或者Masked类型材质没有效果。 Lighting Channels对性能开销不大,可以忽略不计。 移动端的Lighting Channels: 4.13版本开始,才支持移动端的Lighting Channel。 移动端多个Directional Light支持不同Lighting Channels。 一个Primitives只受一个Directional Light影响,如果primitves勾选了多个Lighting Channel,那么只会启用第一个。 CSM Shadows只会投射到与光源Lighting Channels相同的primitives上。 动态点光源在移动端支持Lighting Channels的所有特性,与桌面级特性相同。 我只担心一件事,我怕我配不上自己所受的苦难。----陀思妥耶夫斯基

Continue reading

Post Process Materials https://docs.unrealengine.com/en-us/Engine/Rendering/PostProcessEffects/PostProcessMaterials Stylized Rendering Post Processing https://docs.unrealengine.com/en-us/Resources/Showcases/Stylized/PostProcessing Post Processing Content Examples https://docs.unrealengine.com/en-us/Resources/ContentExamples/PostProcessing 1.2 - ShadingModel https://docs.unrealengine.com/en-us/Resources/ContentExamples/MaterialProperties/1_2 抱必死的心,走永远的路。

Continue reading

[UE4]Shadows

keywords:UE4、Shadows、Scene Optimization、阴影、场景优化 Dynamic Scene Shadows https://docs.unrealengine.com/en-us/Resources/ContentExamples/DynamicSceneShadows Cascaded Shadows https://docs.unrealengine.com/en-us/Platforms/Mobile/Lighting/HowTo/CascadedShadow 人会长大三次。第一次是在发现自己不是世界中心的时候。第二次是在发现即使再怎么努力,终究还是有些事令人无能为力的时候。第三次是在,明知道有些事可能会无能为力,但还是会尽力争取的时候。

Continue reading

keywords:UE4、protobuf-lite、Android NDK、ParseFromArray、Crash protobuf与android ndk编译后,集成到UE4中执行时,每当执行ParseFromArray时就会崩溃(Windows版本没有问题): MessageTest msg; bool rs = msg.ParseFromArray(buffer, buffer_size); 解决办法:将ParseFromArray()函数内部的代码复制出来,放在工程的代码中,然后再执行。 protobuf 2.x #ifndef __ProtobufHelper_H__ #define __ProtobufHelper_H__ #include <google/protobuf/message_lite.h> #include <google/protobuf/io/coded_stream.h> class ProtobufHelper { public: static bool Parse(::google::protobuf::MessageLite& Message, const char* Data, int Size) { ::google::protobuf::io::CodedInputStream input(reinterpret_cast<const uint8*>(Data), Size); return Message.MergePartialFromCodedStream(&input) && input.ConsumedEntireMessage(); } }; #endif protobuf 3.x #ifndef __ProtobufHelper_H__ #define __ProtobufHelper_H__ #include <google/protobuf/message_lite.h> #include <google/protobuf/io/coded_stream.h> #include "CoreMinimal.h" class ProtobufHelper { public: static bool Parse(::google::protobuf::MessageLite& Message, const void* Data, int Size) { ::google::protobuf::io::CodedInputStream input(static_cast<const uint8*>(Data), Size); Message.

Continue reading

ifstream,ofstream读写二进制文件 #include <iostream> #include <fstream> using namespace std; int main(int argc, char** argv) { int a[5] = {1,2,3,4,5}; int b[5]; ofstream ouF; ouF.open("./me.dat", std::ofstream::binary); ouF.write(reinterpret_cast<const char*>(a), sizeof(int)*5); ouF.close(); ifstream inF; inF.open("./me.dat", std::ifstream::binary); inF.read(reinterpret_cast<char*>(b), sizeof(int)*5); inF.close(); for (int i = 0; i < 5; i++) { cout << b[i] << endl; } return 0; } 参考自:https://blog.csdn.net/bendanban/article/details/30039193 C模式读写二进制文件 //采用C模式写二进制文件 void DataWrite_CMode() { //准备数据 double pos[200]; for(int i = 0; i < 200; i ++ ) pos[i] = i ; //写出数据 FILE *fid; fid = fopen("binary.

Continue reading

protobuf源码NDK编译配置 假设工程结构如下: protobuf-build |-jni |- Android.mk |- Application.mk |- google |-protobuf Android.mk LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) CC_LITE_SRC_FILES := \ google/protobuf/arena.cc \ google/protobuf/arenastring.cc \ google/protobuf/extension_set.cc \ google/protobuf/generated_message_table_driven_lite.cc \ google/protobuf/generated_message_util.cc \ google/protobuf/io/coded_stream.cc \ google/protobuf/io/zero_copy_stream.cc \ google/protobuf/io/zero_copy_stream_impl_lite.cc \ google/protobuf/message_lite.cc \ google/protobuf/repeated_field.cc \ google/protobuf/stubs/atomicops_internals_x86_gcc.cc \ google/protobuf/stubs/atomicops_internals_x86_msvc.cc \ google/protobuf/stubs/bytestream.cc \ google/protobuf/stubs/common.cc \ google/protobuf/stubs/int128.cc \ google/protobuf/stubs/io_win32.cc \ google/protobuf/stubs/once.cc \ google/protobuf/stubs/status.cc \ google/protobuf/stubs/statusor.cc \ google/protobuf/stubs/stringpiece.cc \ google/protobuf/stubs/stringprintf.cc \ google/protobuf/stubs/structurally_valid.cc \ google/protobuf/stubs/strutil.cc \ google/protobuf/stubs/time.cc \ google/protobuf/wire_format_lite.

Continue reading

引用静态库头文件: LOCAL_C_INCLUDES += ../include/ 引用静态库: LOCAL_LDLIBS += ../lib/libMyBoostLib.a Android.mk: LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) LOCAL_MODULE := helloJNI LOCAL_SRC_FILES := mainActivity.cpp LOCAL_C_INCLUDES := $(LOCAL_PATH)/inc/ LOCAL_LDLIBS := -llog -L$(LOCAL_PATH)/inc/ -lMyLibrary include $(BUILD_SHARED_LIBRARY) Include prebuilt static library https://stackoverflow.com/questions/18983037/include-prebuilt-static-library 故兵无常势,水无常形。能因敌变化而取胜者,谓之神。故五行无常胜,四时无常位,日有短长,月有死生。

Continue reading

先拖一个Progress Bar控件 再设置Style -》 Style -》 Background Image 再设置Percent的大小,来预览进度条颜色填充效果 也可以自定义填充颜色:Fill Color and Opacity 也可以去掉颜色,改成图片填充 注意,如果使用图片作为填充色,则Fill Color and Opacity需要改成默认值,否则填充图片颜色会受到影响。 然后再设置填充图片的Padding 你最好不要爱上我,因为游侠是不需要女人的,游侠非常孤独。----《森林好小子》

Continue reading

添加一个Button,大小设置为300x300 Image 当Draw As设置为Image时,图片会被整体拉伸 Box 图片会被分成九宫格(3x3),其中4个脚的格子大小固定,不会随分辨率改变而拉伸,上下边沿格子会跟随分辨率横向拉伸,左右边沿格子会跟随分辨率纵向拉伸 Border Border模式,Margin设置为0.25 Border模式,Margin设置为0.5 Marin表示Image边沿格子的大小,数值是百分比。例如,假设Margin设置为0.5,则表示边沿格子的大小为图片的50%。 Border模式下,Image不会随着屏幕大小拉伸,而是固定大小。例如,当Margin为0.5,且Viewport变小时,每个格子的图片不会被拉伸: 有些动物主要是皮值钱,譬如狐狸;有些动物主要是肉值钱,譬如牛;有些动物主要是骨头值钱,譬如人。——丰子恺

Continue reading

keywords:UE4、Dynamic Load、Animation Blueprint、LoadObject、动画蓝图 问题现象 假如用以下方式加载动画蓝图: FString AnimBPStringTest = "AnimBlueprint'/Game/ThirdPerson/Animations/ThirdPerson_AnimBP.ThirdPerson_AnimBP'"; UAnimBlueprint* AnimationBP = LoadObject<UAnimBlueprint>(NULL, *AnimBPStringTest); 在PIE和Standalone模式下都可加载成功,但是一旦打包运行(打包配置中添加了该资源cook)就会加载失败,并提示如下错误: LogUObjectGlobals:Warning: Failed to find object 'AnimBlueprint /Game/ThirdPerson/Animations/ThirdPerson_AnimBP.ThirdPerson_AnimBP' 解决办法 貌似动画蓝图比较特殊,用LoadObject无法加载,如果要获取动画蓝图Class,可以通过如下方式加载: // get the blueprint class reference from the editor FString AnimClassStringTest = "Class'/Game/mixamo/Heidi/IcloneAnimBP.IcloneAnimBP_C'"; // load the class UClass* AnimationClass = LoadObject<UClass>(NULL, *AnimClassStringTest); if (!AnimationClass) return; // assign the anim blueprint class to your skeletal mesh component Skeletal3DMeshComponent->SetAnimInstanceClass(AnimationClass); 参考:Why can’t i dynamically load an animation BP in a packaged game

Continue reading

keywords:UE4、InverseTransformVector、InverseTransformVector、InverseTransformPosition 实例代码: //返回摄像机Rotation相对角色Rotation的偏移量Offset FRotator ASBaseCharacter::GetAimOffsets() const { const FVector AimDirWS = GetBaseAimRotation().Vector(); const FVector AimDirLS = ActorToWorld().InverseTransformVectorNoScale(AimDirWS); const FRotator AimRotLS = AimDirLS.Rotation(); return AimRotLS; } https://github.com/tomlooman/EpicSurvivalGameSeries/blob/4a6ee9a6081529fadbe0f693b2e4e6729d5ec08d/SurvivalGame/Source/SurvivalGame/Private/Player/SBaseCharacter.cpp#L374 如果只是想获取两个Rotation之间的Offset,更简单的办法: FRotator R1; FRotator R2; FRotator Offset = R2 - R1; 无欲则刚,关心则乱。----《论语》

Continue reading

keywords:UE4、Animation Blend Nodes、动画融合实例 各个Blend节点的解释:Blend Nodes https://docs.unrealengine.com/en-us/Engine/Animation/NodeReference/Blend 动画融合实例可以参考: EpicSurvivalGameSeries\SurvivalGame\Content\AnimStarterPack\Player_AnimBP 该蓝图中实现逻辑:角色握枪动作跟随摄像机方向动态融合。 项目地址:https://github.com/tomlooman/EpicSurvivalGameSeries 有作用者器宇定是不凡,有智慧者才情决然不露。----弘一法师

Continue reading

Author's picture

Neil Wang

久长唯有品格

TechArtist

Yichang·Hubei